How to control the position of namespaces in java soap request

27 Views Asked by At

How can I change this soap request:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <Action xmlns="http://www.w3.org/2005/08/addressing">http://example.com/schemas/sumServiceInterface1.0</Action>
        <MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:1ae430f4-98e2-4fbd-b037-166b389eba35</MessageID>
    </soap:Header>
    <soap:Body>
        <ns2:sum xmlns:ns2="http://example.com/schemas/sumServiceInterface1.0">
            <firstNum>5</firstNum>
            <secondNum>3</secondNum>
        </ns2:sum>
    </soap:Body>
</soap:Envelope>

to

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
   xmlns:ns2="http://example.com/schemas/sumServiceInterface1.0">
   <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
      <wsa:Action>http://example.com/schemas/sumServiceInterface1.0/sum</wsa:Action>
      <wsa:MessageID>uuid:6291605f-3892-4e26-8868-4bc13b90211d</wsa:MessageID>
   </soapenv:Header>
   <soapenv:Body>
      <ns2:sum>
         <firstNum>5</firstNum>
         <secondNum>3</secondNum>
      </ns2:sum>
   </soapenv:Body>
</soapenv:Envelope>

the soap client is written in Spring + Apache CXF In the first request, target namespace "http://example.com/schemas/sumServiceInterface1.0" is in the Body tag while in the second request, it is in the Envelope tag. Aslo in the first request, the namespace of WS-Addressing "http://www.w3.org/2005/08/addressing" is in both Action and MessageID tags while it is in the Header tag in the second request

0

There are 0 best solutions below