jmhostalet
jmhostalet

Reputation: 4639

WSO2 ESB how to handle soap operations independently

I need to "connect" each operation of my soap service to a rest service. In wso2-esb I've defined a new proxy service with a predefined wsdl, so far so good, I've published the service and I can "see" the operations from soap-ui.

Now I need to define (I think) an In-secuence, my first problem is that I need to distinguish between op1, op2 and op3, because each soap operation goes to a different rest service

What kind of mediator do I need to split my request depending on the operation invoked by the client?

Thank you!

enter image description here

Upvotes: 1

Views: 847

Answers (1)

Chilcano
Chilcano

Reputation: 168

This escenario is very similar a "Message Router" Pattern where you have to use SOAP Header value for routing, no value in message content as EIP.

Well, to get what SOAP operation is called you will need to get SOAP Header value, here a sample proxy:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="proxy_router_by_header"
       transports="http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <log level="full"/>
         <property name="MY_SOAP_ACTION"
                   expression="get-property('Action')"
                   scope="default"
                   type="STRING"/>
         <log level="custom">
            <property name="* Action sample1" expression="get-property('MY_SOAP_ACTION')"/>
         </log>
         <log level="custom">
            <property name="* Action sample2" expression="$ctx:MY_SOAP_ACTION"/>
         </log>
         <filter source="get-property('MY_SOAP_ACTION')" regex=".*mediate.*">
            <then>
               <log level="custom">
                  <property name="* Evaluation" value=" inside of filter TRUE"/>
               </log>
            </then>
            <else>
               <log level="custom">
                  <property name="* Evaluation" value=" inside of filter FALSE"/>
               </log>
            </else>
         </filter>
      </inSequence>
   </target>
   <description/>
</proxy>

I hope this help you. Regards.

Upvotes: 1

Related Questions