0

i'm developing soap app using Spring + SOAP+JAXB+XSD

i want to add the namespace to the soap request xml

My Existing request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:res="http://WSInfo.co.in/">
   <soapenv:Header/>
   <soapenv:Body>
  <res:WSRequest>
     <res:ID>9999999</res:ID>
     <res:NAME>JOHN</res:NAME>
     <res:MOBILE>9876543210</res:MOBILE>
     <res:EMAIL>john@gmail.com</res:EMAIL>
  </res:WSRequest>
   </soapenv:Body>
</soapenv:Envelope>

My Expected request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:res="http://WSInfo.com/">
   <soapenv:Header/>
   <soapenv:Body>
  <res:WSRequest xmlns:res="http://WSInfo.com">
       <res:ID>9999999</res:ID>
     <res:NAME>JOHN</res:NAME>
     <res:MOBILE>9876543210</res:MOBILE>
     <res:EMAIL>john@gmail.com</res:EMAIL>
      </res:WSRequest>
   </soapenv:Body>

if you see the expected request i want to add the below

<res:WSRequest xmlns:res="http://WSInfo.com">

My Endpoint class

@Endpoint
public class MyEndpoint 
{
private static final String TARGET_NAMESPACE = "http://WSInfo.co.in/"";

@PayloadRoot(localPart = "WSRequest", namespace = TARGET_NAMESPACE)
public @ResponsePayload WSResponse getwsDetails(@RequestPayload WSRequest request) throws Exception
{
WSResponse response =new WSResponse();
//logic goes here
    return response;
    }
}

Please advise on how to alter the request xml with namespace

Both works, but if i want to test the service using SoapUI assertions fails as the request and response should have the same namespace. In my case the request envelop header has the namespace and not the res:WSRequest

Appreciate if you could help

Thanks in advance

VK Da NINJA
  • 510
  • 7
  • 19
senthil raja
  • 79
  • 1
  • 1
  • 5

0 Answers0