Community

Problem in retrieving WSDL from remote endpoint

reply from Vitaliy Lukashev in JBoss ESB Development - View the full discussion

Hi all !

 

I want to know have i a right in decision?

 

in a HttpGatewayServlet class:

 

protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // if it's a wsdl request, serve up the contract then short-circuit
        if ("wsdl".equalsIgnoreCase(req.getQueryString())) {
            resp.setCharacterEncoding("UTF-8");
            Charset charset = Charset.forName("UTF-8");  // add
            CharsetEncoder chr = charset.newEncoder(); //add
            String mimeType = (contract != null ? contract.getMimeType() : "text/xml");
            resp.setContentType(mimeType);
            String data = (contract != null ? contract.getData() : "<definitions/>");
            ByteBuffer bbuf = chr.encode(CharBuffer.wrap(data)); //add
            resp.setContentLength(bbuf.capacity()); // this is problem place i change length buf
            Writer writer = new BufferedWriter(resp.getWriter());
            writer.write(data);
            writer.flush();
            return;
        }

Reply to this message by going to Community

Start a new discussion in JBoss ESB Development at Community