1
votes

I am migrating a service that was built to run on WSO2 ESB 4.0 to WSO2 ESB 4.7 and have run into a problem. The service I am migrating is a custom proxy with a SOAP 1.2 binding interface. This proxy makes outbound calls to a SOAP 1.1 based service.

The ESB 4.0 server is using the Http NIO transport and it appears that transport would use a message formatter (I'm guessing) to manage the SOAP message conversion in the ESB between SOAP 1.1 and 1.2 when sending a response message back to the client.

The ESB 4.7 is using the Http PassThrough transport, which does not have the SOAP message conversion capabilities, so SOAP envelope namespaces and HTTP header information has to be changed manually in a sequence.

Is it possible to configure both Http PassThrough and Http NIO to be active on the same ESB and configure individual services to use one or the other? I've tried, and have been unsuccessful, and my research so far seems to indicate one or the other.

EDIT1 - Response to RaviU:

Thanks RaviU. The ESB 4.7.0 will support automatic conversion of SOAP 1.1 to 1.2 if it is configured to use the HTTP NIO transport. In other words, it behaves like the ESB 4.0 server. The automatic conversion of SOAP 1.1 to 1.2 does not appear to occur when the ESB 4.7.0 is configured to use HttpPassThrough transport. This makes sense because that transport does not care about content type. The problem I have when using HttpPassThrough is that I have to manually change the SOAP envelope to 1.2 and set the appropriate http headers before sending back to the client. This is because they are changed when the service calls the SOAP 1.1 service. If I use the HTTP NIO transport, the manual steps are taken care of automatically by the ESB. I'm assuming this is done by a message formatter before the message is returned to the client.

1
You can't have two different transports for HTTP - axis2 uses the protocol prefix to identify the transport to use - and due to this reason you cannot have two different transports with the name 'http'. You said that the ESB 4.7.0 does not have capability to convert the message between SOAP 1.1. and 1.2? I'm not sure what you mean by this as the WSO2 ESB comes with support for both versions of SOAP. Is there a specific issue you're running into?RaviU
RaviU, I've edited my post to answer your questions.Chris
Hi Chris, I'm a little late to get back to you, sorry about that! I understand your issue now. The reason why it doesn't automatically do this conversion with passthrough transport is because of the selective build mechanism (i.e. it decides whether or not to build the message from the buffer based on the mediators used). In order to fix this you could in your inSequence detect through xPath what the incoming SOAP version is and store this in a property that you could then use in your outSequence to decide the messageType to be used to do the conversion for you.RaviU

1 Answers

0
votes

Apologies with the late response. You can fix your conversion issue doing something like:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="TestProxy"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <filter xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
                 source="namespace-uri(/*)"
                 regex="http://www.w3.org/2003/05/soap-envelope">
            <then>
               <property name="incomingSOAPVersion" value="soap12"/>
            </then>
            <else>
               <property name="incomingSOAPVersion" value="soap11"/>
            </else>
         </filter>
         <log level="custom">
            <property name="SOAP_VERSION_LOG" expression="$ctx:incomingSOAPVersion"/>
         </log>
         <send>
            <endpoint>
               <address uri="http://localhost:8280/services/echo.echoHttpSoap11Endpoint"
                        format="soap11"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <filter source="$ctx:incomingSOAPVersion" regex="soap11">
            <then>
               <send>
                  <endpoint>
                     <default format="soap11"/>
                  </endpoint>
               </send>
            </then>
            <else>
               <send>
                  <endpoint>
                     <default format="soap12"/>
                  </endpoint>
               </send>
            </else>
         </filter>
      </outSequence>
   </target>
   <publishWSDL uri="http://localhost:8280/services/echo?wsdl"/>
   <description/>
</proxy>

You can also set the messageType instead of using default endpoint. This is also a possible solution:

<sequence xmlns="http://ws.apache.org/ns/synapse" name="soapVersion">
   <filter xmlns:ns="http://org.apache.synapse/xsd" source="$axis2:messageType" regex="application\/soap\+xml">
      <then>
          <property name="incomingSOAPVersion" value="soap12"/>
      </then>
      <else>
          <property name="incomingSOAPVersion" value="soap11"/>
      </else>
   </filter>
</sequence>

Either should work, but the second solution should be slightly better performing since it does not evaluate xPath.