Search code examples
wso2esbwso2-esb

WSO2 response binary why?


If using samples axis2Server service is very good. But when I created my own web-service using javax I got a problem.

I used wso2 esb 4.60 default configuration

Web service:

import javax.jws.WebParam;
import javax.jws.WebService;

@WebService
public class Lpu {
    public boolean scheduleAnAppointment(@WebParam(name = "time") Integer time) {
        return true;
    }
}

starting web-service:

import javax.xml.ws.Endpoint;

public class Server {
    public static void main(String[] args)
    {
        Endpoint.publish("http://localhost:8090/WebServices/lpu", new Lpu());
    }
} 

config esb:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
   <sequence name="main">
      <in>
         <log level="full"/>
         <send>
            <endpoint>
               <address uri="http://localhost:8090/WebServices/lpu"/>
            </endpoint>
         </send>
      </in>
      <out>
         <log level="full"/>
         <send/>
      </out>
   </sequence>
</definitions>

response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <axis2ns1:binary xmlns:axis2ns1="http://ws.apache.org/commons/ns/payload">PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxTOkVudmVsb3BlIHhtbG5zOlM9Imh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3NvYXAvZW52ZWxvcGUvIj48UzpCb2R5PjxuczI6c2NoZWR1bGVBbkFwcG9pbnRtZW50UmVzcG9uc2UgeG1sbnM6bnMyPSJodHRwOi8vZmVyLndlYnNlcnZpY2UvIj48cmV0dXJuPmZhbHNlPC9yZXR1cm4+PC9uczI6c2NoZWR1bGVBbkFwcG9pbnRtZW50UmVzcG9uc2U+PC9TOkJvZHk+PC9TOkVudmVsb3BlPg==</axis2ns1:binary>
   </soapenv:Body>
</soapenv:Envelope>

I want getting:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:scheduleAnAppointmentResponse xmlns:ns2="http://lpu.webservice/">
         <return>true</return>
      </ns2:scheduleAnAppointmentResponse>
   </S:Body>
</S:Envelope>

my reguest

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:fer="http://lpu.webservice/">
   <soapenv:Header/>
   <soapenv:Body>
      <lpu:scheduleAnAppointment>
         <time>12</time>
      </lpu:scheduleAnAppointment>
   </soapenv:Body>
</soapenv:Envelope>

Solution

  • ESB 4.6.0 released with pass through transport, which doesnt build the message. So, if you use the log mediator in the sequence you will get the binary response. But at client end you should receive your response in the preferred format.

    If you switch to NIO transport, in the sequence also you can get the actual message payload. For that you need to edit the transport sender and receiver in axis2 configuration(axis2.conf)