Wednesday, December 14, 2011

How add a SOAPAction to the HTTP header of the outgoing request

WSO2 ESB will be used in order to demonstrate this.

Download WSO2 ESB and start the server.

Create a new proxy (Custom proxy) and paste the following configuration. The Header mediator will be used in this proxy.


<proxy xmlns="http://ws.apache.org/ns/synapse" name="test4" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <log />
         <header name="Action" value="foo" />
         <send>
            <endpoint>
               <address uri="http://localhost:6060" />
            </endpoint>
         </send>
      </inSequence>
   </target>
</proxy>
                             
Setting the header mediator in the design view



Setting the send mediator in the design view


In send mediator an Address Endpoint is used to define the url of the service. tcpmon is configured to listen to 6060 port http://localhost:6060.

Following is the output which is given from tcpmon - for soap 1.1

POST HTTP/1.1
Content-Type: text/xml; charset=UTF-8
Accept-Encoding: gzip,deflate
SOAPAction: "foo"
Transfer-Encoding: chunked
Host: 127.0.0.1:6060

Following is the output which is given from tcpmon - for soap 1.2

POST HTTP/1.1
Content-Type: application/soap+xml; charset=UTF-8; action="foo"
Accept-Encoding: gzip,deflate
Transfer-Encoding: chunked
Host: 127.0.0.1:6060

According to [1] this is the expected output. The SOAP 1.1 mandatory SOAPAction HTTP header has been removed in SOAP 1.2.

[1] http://hadleynet.org/marc/whatsnew.html

No comments:

Post a Comment

Using Zotero for academic writing