我正在使用 Spring + SOAP+JAXB+XSD 开发肥皂应用程序
我想将命名空间添加到肥皂请求xml
我的现有请求
<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>
我的预期请求
<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>
如果您看到预期的请求,我想添加以下内容
<res:WSRequest xmlns:res="http://WSInfo.com">
我的端点类
@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;
}
}
请告知如何xml
使用命名空间更改请求
两者都有效,但如果我想使用SoapUI
断言测试服务失败,因为请求和响应应该具有相同的命名空间。在我的情况下,请求信封标头具有命名空间而不是res:WSRequest
感谢您是否可以提供帮助
提前致谢