Announcement Announcement Module
Collapse
No announcement yet.
Add namespace to SOAP envelope using spring integration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Add namespace to SOAP envelope using spring integration

    Hi,
    I am using a WS-outboundGateway to get response using webservices.
    The request that is generated through a SOAP UI client is :
    Code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:lb="http://url">
       <soapenv:Header/>
       <soapenv:Body>
          <lb:retrnTransactionNumber>
    <CREATE_REQUEST>
    
    </CREATE_REQUEST>
    </lb:retrnTransactionNumber>
    </soapenv:Body>
    </soapenv:Envelope>
    The request generated by the ws-outbound gateway is:

    Code:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/><SOAP-ENV:Body>
    <retrnTransactionNumber>        
    <CREATE_REQUEST>
    
    <CREATE_REQUEST>
    <retrnTransactionNumber>    
    </soapenv:Body>
    </soapenv:Envelope>
    How do i add the xmlns dynamically to the soap-envelope.
    If i send <lb:retrnTransactionNumber> Spring integration gives me an error.Saying the element lb is not bound.

    This is my Ws-outboundgateway configuration

    Code:
    <ws:outbound-gateway id="createGateway"
    		 request-channel="createDataChannel" reply-channel="createSerializationChannel"
    		uri="http://localhost:8080/WebserviceTest/services/RequestImpl"  />

    Please help.
    Thanks in advance.
    Regards,
    Annuk

  • #2
    Hello.
    What do you send to the createDataChannel?
    As I see on your configuration without marshaller attribute it must be a Message with payload as some XML-representation: String, Document or Source, that will be transformed on the background to the SOAP-Body.
    So, as I understand, you make your xml-request manually.
    What is problem to add xmlns to the root element of your XML?

    Artem Bilan

    Comment


    • #3
      hi cleric,

      Thanks for your reply...
      I am able to add the namespace to the envelope using an interceptor.
      But i am getting an error which states that the prefix "lb" is not bound to the element "retrnTransactionNumber".


      The interceptor adds the namespace.But i get the above error.

      I create the request manually.So i add the lb tag before retrnTransactionNumber.
      But i get the prefix not bound exception.

      Please help.

      Regards,
      Annuk

      Comment


      • #4
        I create the request manually
        It is bad practice...
        However, if your create XML manualy what's problem to do this:
        Code:
        <retrnTransactionNumber xmlns="http://url">        
        .....
        <retrnTransactionNumber>
        namespace is applied to the tag retrnTransactionNumber and his children without prefix. It is the same if you define xmlns in the root of your XML at all and specify its prefix, and assign the last one to any tag further.

        I hope I've explained...

        Comment


        • #5
          Hi cleric,
          I tried the approach suggested by you through soap-ui.
          But got the following exception:

          [B]soapenv:server.generalException
          [/B

          Thanks for your reply.
          Thanks in advance...

          Please help

          Comment


          • #6
            Ok, try this:
            <lb:retrnTransactionNumber xmlns:lb="http://url">
            <CREATE_REQUEST>

            </CREATE_REQUEST>
            </lb:retrnTransactionNumber>

            Comment


            • #7
              hi cleric,

              Thanks for your reply.
              Tried the approach suggested by you and it worked.

              Thanks for your help...
              Regards,
              Annuk
              Last edited by annuk; Dec 30th, 2011, 02:04 AM.

              Comment

              Working...
              X