wso2soawso2-esb

Why WSO2 Send Mediator doesn't wait for response?


I have a WSO2 ESB-4.6.0 proxy that calls another proxy that calls an webservice.

Proxy1 --> Proxy2 --> Endpoint

If I directly call the second proxy via soapUI, the response is correctly returned and printed, but if I call the first proxy, then an blank body is returned.

In the ESB log, the outSequence of the Proxy1 is printed before the outSequence of the Proxy2. Seems like the Send mediator present in the inSequence of the Proxy1 is making an asynchronous call to the Proxy2.
I've tried to replace the Send mediator by the Callout mediator, but the result is the same.
Follow this tutorial, but it didn't works also.

How to forward the response for the Proxy2 to the caller?
Please help. It's killing me!

EDIT

Problem solved! I was using a wrong port to specify the serviceURL parameter for Callout mediator.

EDIT

The current proxies configuration:

Proxy1 (calling Proxy 2 - ManageWorkforce):

<proxy xmlns="http://ws.apache.org/ns/synapse" name="GetAppointmentSchedulePortalReqCS" transports="http https" startOnLoad="true" trace="disable">
    <target>
        <inSequence>
            <xslt key="conf:ManageWorkforce/xslt/GetAppointmentSchedulePortalReqCS_Request.xsl"/>
            <header name="Action" value="getAppointment"/>
            <send>
                <endpoint>
                    <address uri="https://localhost:9443/services/ManageWorkforce"/>
                </endpoint>
            </send>
        </inSequence>
        <outSequence>
            <xslt key="conf:ManageWorkforce/xslt/GetAppointmentSchedulePortalReqCS_Response.xsl"/>
            <send/>
        </outSequence>
        <faultSequence/>
    </target>
    <publishWSDL key="conf:ManageWorkforce/GetAppointmentSchedulePortalReqCS.wsdl" />
</proxy>

Proxy 2 (calling Proxy3 -GetAppointmentPeopleProvCS):

<proxy xmlns="http://ws.apache.org/ns/synapse" name="ManageWorkforce" transports="https http" startOnLoad="true" trace="disable">
    <target>
        <inSequence>
            <switch source="get-property('Action')">
                <case regex="getAppointment">
                    <callout serviceURL="https://localhost:8243/services/GetAppointmentPeopleProvCS" action="getAppointment">
                        <source xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
                        <target xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
                    </callout>
                </case>
                <!-- another cases -->
                <default/>
            </switch>
            <property name="RESPONSE" value="true" scope="default" type="STRING"/>
            <header name="To" action="remove"/>
            <send/>
        </inSequence>
        <outSequence>
            <drop/>
        </outSequence>
        <faultSequence/>
    </target>
    <publishWSDL key="conf:ManageWorkforce/ManageWorkforce.wsdl"/>
    </publishWSDL>
</proxy>

Proxy 3 (calling the service -GetAppointment):

<proxy xmlns="http://ws.apache.org/ns/synapse" name="GetAppointmentPeopleProvCS" transports="http https" serviceGroup="" startOnLoad="true" trace="disable">
    <target>
        <endpoint key="GetAppointment"/>
        <inSequence>
            <xslt key="conf:ManageWorkforce/xslt/GetAppointmentPeopleProvCS_Request.xsl"/>
        </inSequence>
        <outSequence>
            <xslt key="conf:ManageWorkforce/xslt/GetAppointmentPeopleProvCS_Response.xsl"/>
            <send/>
        </outSequence>
        <faultSequence/>
    </target>
</proxy>

Final endpoint (service):

<endpoint xmlns="http://ws.apache.org/ns/synapse" name="GetAppointment">
    <address uri="http://10.13.6.75:9764/services/GetAppointment" />
</endpoint>

Solution

  • There are two mediators to invoke web services. Those are Callout Mediator and Call Mediator. The Callout mediator performs a blocking call and the Call Mediator performs a non-blocking call.

    So, you should use Call mediator if you consider about performance. It's availble in ESB 4.8.0.

    There are two samples for these in wiki docs.

    There is another sample for Call Mediator from Dushan's blog. This has more complex mediators, but you can try out.

    This is just a quick answer.

    I hope this helps.

    Thanks!