5 Replies Latest reply on Apr 17, 2009 1:09 PM by Scott Dawson

    xml post to external webservice

    Chhaya Mudgal Newbie

      Hi,

      I am trying to post xml from soapclient. I am following webservice_consumer1 sample. This sample uses request map to send request. How can i send entire xml not using reques map? Is there any sample that i can follow?

      thanks
      Chhaya

        • 1. Re: xml post to external webservice
          Scott Dawson Apprentice

          Chhaya,
          If you can create the SOAP message yourself, then you might try using the HttpRouter instead of SOAPClient. There's a sample HttpRouter configuration in the https_2way_ssl quickstart.

          Regards,
          Scott

          • 2. Re: xml post to external webservice
            Chhaya Mudgal Newbie

            Thanks Scott for your response.

            I tried posting request using http router but it looks like the xml it is sending is invalid. I am getting response from the server saying "xml invalid, content not allowed in prolog"

            Also i was wondering if we could use http router for invoking web service? Can you share some sample for that?

            thanks
            Chhaya

            • 3. Re: xml post to external webservice
              Scott Dawson Apprentice

              Chhaya,
              I have used the HttpRouter to invoke a web service. The pre-condition is that you already have a valid SOAP message. So, in my case, I use the HttpRouter as a "pass-through". A valid SOAP message is sent in to the ESB and the HttpRouter routes it on to the external target web service.
              The HttpRouter is configured with the web service endpoint, as shown below. If you need to add configuration for SSL, you can see an example of that in the https_2way_ssl quickstart.

              <action name="httprouter" class="org.jboss.soa.esb.actions.routing.http.HttpRouter">
               <property name="endpointUrl" value="http://localhost:9000/Hello"/>
               <property name="method" value="POST" />
               <property name="responseType" value="STRING" />
              </action>
              


              You can find some documentation here: http://www.jboss.org/community/docs/DOC-9973

              Regards,
              Scott


              • 4. Re: xml post to external webservice
                Chhaya Mudgal Newbie

                Scott,
                thanks for your response. When i use httpRouter to invoke webservice where do i set the operation or soapaction. When i send my soap request using myrequestaction i am getting soap fault for soapaction not found.
                --------------------------------------------------------------




                -----------------------------------------------------------------------

                any hep will be highly appreciated.

                thanks
                Chhaya

                • 5. Re: xml post to external webservice
                  Scott Dawson Apprentice

                  Chhaya,
                  You can specify any HTTP headers, including SOAPAction, using the headers property, like this:

                  <action name="httprouter" class="org.jboss.soa.esb.actions.routing.http.HttpRouter">
                   <property name="endpointUrl" value="http://localhost:9000/Hello"/>
                   <property name="method" value="POST" />
                   <property name="responseType" value="STRING" />
                   <property name="headers">
                   <header name="SOAPAction" value="whatever" />
                   </property>
                   </action>
                  


                  Regards,
                  Scott