Question

This may be a basic question, I am just getting used to the WSO2 lingo. I have two services that I can deploy independently with WSDLs and pass the proper SOAP request, and return information accordingly. Now I want to combine them into an 'If then, else' statement sort of deal. This would be set up in a sequence of some sort I believe, just not sure how with the filters.

  1. Send in request with authentication request and info request
  2. Do authentication request – continue if passes, 401 on failure
  3. Do info request – get info
  4. Return the info

If you have a sample I could follow or point me to one of the hundreds WSO2 has, I just haven't been able to pull much from them. XML source example for the config could work also. Thanks for the help, and for my ignorance of WSO2 lingo, and workflow.

Was it helpful?

Solution 2

So I ended up with something very similar to this. If someone down the road comes across this and looking for the wso2 configurations.

  <proxy name="name"
          transports="https http"
          startOnLoad="true"
          trace="disable">
      <description/>
      <target>
         <inSequence>
            <property xmlns:ns1="ns1"
                      xmlns:ns="ns"
                      name="userID"
                      expression="//ns:AuthenticateRequest/ns:Credentials/ns1:userID"
                      scope="default"
                      type="STRING"/>
            <property xmlns:ns1="ns1"
                      xmlns:ns="ns1"
                      name="password"
                      expression="//ns:AuthenticateRequest/ns:Credentials/ns1:password"
                      scope="default"
                      type="STRING"/>

            <log>
               <property name="userID" expression="get-property('userID')"/>
               <property name="password" expression="get-property('password')"/>
            </log>
            <header name="Action"
                    value="http://services.com:port/AuthenticateSecureCredential"/>
            <send receive="AuthRecvSequence">
               <endpoint>
                  <address uri="http://server.com:port/DefaultAuthenticationService"/>
               </endpoint>
            </send>
         </inSequence>
      </target>
   </proxy>


   <sequence name="AuthRecvSequence">
      <filter xmlns:ns="ns"
              source="//ns:AuthenticateSecureCredentialResponse/ns:isAuthenticated"
              regex="false">
         <then>
            <makefault version="soap11">
               <code xmlns:soap11Env="http://schemas.xmlsoap.org/soap/envelope/"
                     value="soap11Env:VersionMismatch"/>
               <reason value="Not Authenticated"/>
               <role/>
            </makefault>
            <header name="To" action="remove"/>
            <property name="RESPONSE" value="true" scope="default" type="STRING"/>
            <send/>
            <drop/>
         </then>
         <else>
            <payloadFactory>
               <format>
                  <ns:INFO xmlns:ns="ns"
                                    xmlns:ns1="ns1">
                     <ns:secureCredentials>
                        <ns1:userID>$1</ns1:userID>
                        <ns1:password>$2</ns1:password>
                     </ns:secureCredentials>
                  </ns:INFORequest>
               </format>
               <args>
                  <arg expression="get-property('userID')"/>
                  <arg expression="get-property('password')"/>
               </args>
            </payloadFactory>
            <header name="Action"
                    value="http://services.com/GetINFO"/>
            <send receive="INFOrRecvSeq">
               <endpoint>
                  <address uri="http://server:port/INFOService"/>
               </endpoint>
            </send>
         </else>
      </filter>
   </sequence>

   <sequence name="INFORecvSeq">
      <send/>
   </sequence>
   <sequence name="main">
      <description>The main sequence for the message mediation</description>
   </sequence>

OTHER TIPS

You can have a look at filter mediator to filter messages based on conditions Entitlement Mediator. You can find samples here as a reference which will be helpful for your use case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top