1
votes

i have developed a custom mediator and i want to try publish it as a REST service con my WSO2 ESB 4.7.0. Once i created the REST API, the ESB publishes it on the 8280 port. On the client side, the POST REST call needs to specify some http parameters that i need to recover later in the mediator by this code:

org.apache.axis2.context.MessageContext axis2MsgContext;
axis2MsgContext =  ((Axis2MessageContext) synapseMsgContext).getAxis2MessageContext();
HttpServletRequest obj = (HttpServletRequest)axis2MsgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);

if (obj != null) {
    System.out.println("Method :"+ obj.getMethod());
    System.out.println("Content-type :" +obj.getContentType());
    System.out.println("Content-length :"+obj.getContentLength());
    System.out.println("Remote addtress"+obj.getSession().getLastAccessedTime());  
}

The object i get is always null . That's probably because on 8280 ESB uses the NHttp transport.

In what way can i solve this problem?

Have i to activate the HTTP Servlet Transport? How can i do this? By installing the WSO2 Application Server inside the WSO2 ESB (i ve done this, but how can i specify that i want a service to be exposed on 9763 port?)?

What's the difference between HTTP and NHTTP? Does the ESB performance get lower?

1

1 Answers

1
votes

You can configure the WSO2ESB to listen to multiple ports.

By default it uses 8280, You can change this or add another listener.

This can be done by editing wso2esb-4.8.0\repository\conf\axis2\axis2.xml

 <transportReceiver name="http" class="org.apache.synapse.transport.passthru.PassThroughHttpListener">
    <parameter name="port" locked="false">8280</parameter>
    <parameter name="non-blocking" locked="false">true</parameter>
    <!--parameter name="bind-address" locked="false">hostname or IP address</parameter-->
    <!--parameter name="WSDLEPRPrefix" locked="false">https://apachehost:port/somepath</parameter-->
    <parameter name="httpGetProcessor" locked="false">org.wso2.carbon.transport.nhttp.api.PassThroughNHttpGetProcessor</parameter>
    <!--<parameter name="priorityConfigFile" locked="false">location of priority configuration file</parameter>-->
</transportReceiver>

NHTTP or PTT are used to mediate the message.

Best Regards, Malaka