Thien Dinh
Thien Dinh

Reputation: 373

Mule routing Web service using choice flow control

I'm trying to use choice flow control to route SOAP web service, it depends on payload to change to matching web-service. Here is my flow

<flow name="ProxyServiceFlow1" doc:name="ProxyServiceFlow1">
    <http:inbound-endpoint exchange-pattern="request-response"
        address="http://localhost:8081/hrManagerServiceProxy" doc:name="HTTP" />
    <set-variable variableName="clientType"
        value="#[message.inboundProperties['http.query.params']['clientType']]"
        doc:name="Set clientType" />
    <choice doc:name="Choice">
        <when expression="#[clientType == 'unsecure']">
            <cxf:proxy-service namespace="http://service.freetalk.viettel.com/"
                service="RegisterServiceService" payload="body" wsdlLocation="unsecure.wsdl"
                enableMuleSoapHeaders="false" doc:name="SOAP" />
            <http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://localhost:8081/HR/hrManagerService" doc:name="HTTP"/>
        </when>
        <otherwise>
            <cxf:proxy-service namespace="http://service.freetalk.viettel.com/"
                service="RegisterServiceService" payload="body" wsdlLocation="unsecure2.wsdl"
                enableMuleSoapHeaders="false" doc:name="SOAP" />
            <http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://localhost:8081/HR/hrManagerService" doc:name="HTTP"/>
        </otherwise>
    </choice>
</flow>

It's just my thought, because I google many times but still get no result. Someone please give me some advises.

Upvotes: 0

Views: 665

Answers (1)

user1760178
user1760178

Reputation: 6657

Its not the cxf:proxy-service that needs to be used along with the HTTP Outbound.
It should be cxf:proxy-client

Try using cxf:proxy-client with your http:outbound-endpoint.

    <choice doc:name="Choice">
        <when expression="#[clientType == 'unsecure']">
            <http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://localhost:8081/HR/hrManagerService" doc:name="HTTP">
                <cxf:proxy-client payload="body" enableMuleSoapHeaders="true">      
                </cxf:proxy-client> 
            </http:outbound-endpoint>
        </when>
        <otherwise>             
            <http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://localhost:8081/HR/hrManagerService" doc:name="HTTP">
                <cxf:proxy-client payload="body" enableMuleSoapHeaders="true">      
                </cxf:proxy-client> 
            </http:outbound-endpoint>
        </otherwise>
    </choice>

Hope this helps.

Upvotes: 1

Related Questions