3 Replies Latest reply on Dec 25, 2013 9:03 PM by sanjay bhupathiraju

    Using HTTPRouter to send a SOAP 1.1 request fails

    sanjay bhupathiraju Newbie

      I am unable to make the HTTPRouter configuration work with SOAP1.1 requests. I guess the only difference between sending a SOAP1.1 and SOAP1.2 request is the Content-Type parameter value. If I use the following configuration using Content-Type "application/SOAP+xml", then I am able to see a valid SOAP 1.2 request and response from a web service.

       

      However I can't make this to work for Content-Type value ="text/xml" as shown below.

      Can anyone tell me why this fails?

       

      Here is my jboss-esb.xml and smooks action. The input to my smooks action is a java object in the message from which I use SAX and free marker to do the templating.

       

      Jboss-esb.xml

       

      <action class="org.jboss.soa.esb.smooks.SmooksAction" name="create-details-query">

           <property name="smooksConfig" value="/smooks/smooks-query.xml"/>

           <property name="resultType" value="STRING" />

      </action>

      <action class="org.jboss.soa.esb.actions.routing.http.HttpRouter" name="query-right-now">

          <property name="Content-Type" value="text/xml"/>

            <property name="method" value="POST"/>

            <property name="endpointUrl" value="${org.test.endpoint}">

            <http-client-property name="keystore" value="${javax.net.ssl.trustStore}"/>

            <http-client-property name="keystore-passw" value="${javax.net.ssl.trustStorePassword}"/>

              </property>

      </action>

       

       

       

       

      smooks-query.xml

       

      <?xml version="1.0" encoding='UTF-8'?>

      <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"

      xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">

       

       

      <params>

        <param name="stream.filter.type">SAX</param>

        <param name="default.serialization.on">false</param>

      </params>

       

       

        <resource-config selector="entry,simpleReport">

        <resource>org.milyn.delivery.DomModelCreator</resource>

        </resource-config>

       

       

        <ftl:freemarker applyOnElement="com.wcustom.ws.messages.v1__2.RunReport">

        <ftl:template><!--<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

        <soapenv:Header>

        </soapenv:Header>

        <soapenv:Body>

        <v1:Delimiter>${entry["com.wcustom.ws.messages.v1__2.RunReport"].delimiter}</v1:Delimiter>

        <v1:ReturnRawResult>${entry["com.wcustom.ws.messages.v1__2.RunReport"].returnRawResult}</v1:ReturnRawResult>

        </soapenv:Body>

        </soapenv:Envelope>--></ftl:template>

        </ftl:freemarker>

       

       

      </smooks-resource-list>

        • 1. Re: Using HTTPRouter to send a SOAP 1.1 request fails
          Tom Cunningham Master

          Sanjay,

           

          Are you seeing a stack trace when this happens?   Any way you can attach a short reproducible example (including a sample WS)?

          • 2. Re: Re: Using HTTPRouter to send a SOAP 1.1 request fails
            sanjay bhupathiraju Newbie

            Sorry for not attaching my logs in the first place. I thought this would be a very simple configuration issue in HTTPRouter and I thought a log would be unnecessary. Thanks for your response. Here is the detailed log.

             

            I am trying to call a webservice using my client esb HttpRouter configuration. The webservice that I am calling supports SOAP 1.1 as per the documentation. The data that I wanted to send to the webservice is packed in a Java object and sent over an esb aware message and it will be eventually picked up by smooks action "smooks-query.xml" as shown above in jboss-esb.xml

             

            I am using freemarker to do some templating and also I am populating my data from the esb message into the SOAP 1.1 template. As shown clearly, the envelope of the header is pointing to "http://schemas.xmlsoap.org/soap/envelope/" which indicates that this is a SOAP 1.1 message. I am thereby feeding my string result to HttpRouter action with Content-Type set to "text/xml".

             

            Following is the interesting part I copied and pasted from the attached log. I see that the Content-Type is set to text/xml for request. However I see that the Content Type is received as "application/soap+xml"

            When I used SOAP UI to test this, I see the request and response headers are set to Content Type "text/xml" and I see no problem in getting my results back from the web service. So I am assuming HttpRouter action might not be sending my message in SOAP 1.1 format as per my esb configuration. That could be why the webservice is returning a content type of "applicaiton/soap+xml".

             

            How can I debug this? Is there an example of HttpRouter that is configured for SOAP 1.1 anywhere on the web? I have looked at the quick start and many forums on HttpRouter. Some say that Content-Type param goes inside the <headers> element in esb configuration. I tried that and I found no improvement.


            2013-12-23 18:38:21,307 892962 DEBUG [httpclient.wire.header] (pool-47-thread-1:) >> "Content-Type: text/xml[\r][\n]"
            2013-12-23 18:38:21,307 892962 DEBUG [httpclient.wire.header] (pool-47-thread-1:) >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
            2013-12-23 18:38:21,307 892962 DEBUG [httpclient.wire.header] (pool-47-thread-1:) >> "Host: custhelp.com[\r][\n]"
            2013-12-23 18:38:21,307 892962 DEBUG [httpclient.wire.header] (pool-47-thread-1:) >> "Content-Length: 1438[\r][\n]"
            2013-12-23 18:38:21,307 892962 DEBUG [httpclient.wire.header] (pool-47-thread-1:) >> "[\r][\n]"
            2013-12-23 18:38:21,478 893133 DEBUG [httpclient.wire.header] (pool-47-thread-1:) << "HTTP/1.1 500 Internal Server Error[\r][\n]"
            2013-12-23 18:38:21,478 893133 DEBUG [httpclient.wire.header] (pool-47-thread-1:) << "HTTP/1.1 500 Internal Server Error[\r][\n]"
            2013-12-23 18:38:21,494 893149 DEBUG [httpclient.wire.header] (pool-47-thread-1:) << "Date: Mon, 23 Dec 2013 23:38:21 GMT[\r][\n]"
            2013-12-23 18:38:21,494 893149 DEBUG [httpclient.wire.header] (pool-47-thread-1:) << "Server: Apache[\r][\n]"
            2013-12-23 18:38:21,494 893149 DEBUG [httpclient.wire.header] (pool-47-thread-1:) << "RNT-Time: D=140194 t=1387841901354564[\r][\n]"
            2013-12-23 18:38:21,494 893149 DEBUG [httpclient.wire.header] (pool-47-thread-1:) << "RNT-Machine: 0.70[\r][\n]"
            2013-12-23 18:38:21,494 893149 DEBUG [httpclient.wire.header] (pool-47-thread-1:) << "X-Cnection: close[\r][\n]"
            2013-12-23 18:38:21,494 893149 DEBUG [httpclient.wire.header] (pool-47-thread-1:) << "Transfer-Encoding: chunked[\r][\n]"
            2013-12-23 18:38:21,494 893149 DEBUG [httpclient.wire.header] (pool-47-thread-1:) << "Content-Type: application/soap+xml;charset=UTF-8[\r][\n]"
            2013-12-23 18:38:21,494 893149 DEBUG [httpclient.wire.header] (pool-47-thread-1:) << "[\r][\n]"
            2013-12-23 18:38:21,509 893164 WARN  [org.jboss.soa.esb.actions.routing.http.HttpRouter] (pool-47-thread-1:) Received status code '500' on HTTP org.apache.commons.httpclient.methods.PostMethod@af54bc request to 'https://custhelp.com/cgi-bin/cfg/services/soap'.
            2013-12-23 18:38:21,541 893196 DEBUG [httpclient.wire.content] (pool-47-thread-1:) << "1"
            2013-12-23 18:38:21,541 893196 DEBUG [httpclient.wire.content] (pool-47-thread-1:) << "9"
            2013-12-23 18:38:21,541 893196 DEBUG [httpclient.wire.content] (pool-47-thread-1:) << "f"
            2013-12-23 18:38:21,541 893196 DEBUG [httpclient.wire.content] (pool-47-thread-1:) << "[\r]"
            2013-12-23 18:38:21,541 893196 DEBUG [httpclient.wire.content] (pool-47-thread-1:) << "[\n]"
            2013-12-23 18:38:21,541 893196 DEBUG [httpclient.wire.content] (pool-47-thread-1:) << "<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><soapenv:Fault><soapenv:Code><soapenv:Value>soapenv:Sender</soapenv:Value></soapenv:Code><soapenv:Reason><soapenv:Text xmlns:xml="http://www.w3.org/XML/1998/namespace" "
            2013-12-23 18:38:21,541 893196 DEBUG [httpclient.wire.content] (pool-47-thread-1:) << "xml:lang="en">XML builder done with pulling. Pull parser cannot pull any more</soapenv:Text></soapenv:Reason></soapenv:Fault></soapenv:Body></soapenv:Envelope>"

             

            I searched for the response body "XML builder done * " on the web. The reason for this might be that I am sending some duplicate elements in the header. But the header I have works perfect in SOAP UI.

            • 3. Re: Using HTTPRouter to send a SOAP 1.1 request fails
              sanjay bhupathiraju Newbie

              I solved this problem. There is an attribute called "MappedHeaderList". This has to be set using the following property in HttpRouter configuration. Here "SOAPAction" is a constant string.

              <property name="MappedHeaderList" value="SOAPAction"/>


              This was my first step. The final step is to send the SOAP request action name in the ESB properties.


              So, Before we feed the esb Message to this HttpRouter configuration, I had a set an esb property called "SOAPAction" with value "MySoapActionName".

              That's it.



              But to make this work, I had to learn how HttpRouter works using HttpClient. I downloaded the source for Apache HttpClient and there is an example which shows the configuration of HttpClient for SOAP 1.1. I debugged HttpRouter and found out that it uses several config attributes to configure Apache HttpClient. I just had to find which attributes suit my needs.


              MappedHeaderList is the attribute that HttpRouter uses and this will be passed to HttpClient as one of the parameters.