【发布时间】:2016-10-15 11:35:30
【问题描述】:
我已经使用 spring 实现了 JAX 肥皂网络服务。我的方法签名是
字符串验证(字符串参数)
为此我有服务:
@WebService
public class ValidationWS
{
TestValidation TestValidation;
@Resource(name = "wsContext")
WebServiceContext wsContext;
/**
* @return the testValidation
*/
@WebMethod(exclude = true)
public TestValidation getTestValidation()
{
return testValidation;
}
@WebMethod(exclude = true)
public void setTestValidation(final TestValidation testValidation)
{
this.testValidation = testValidation;
}
@WebMethod(operationName = "validateToken")
public String validateToken(final String argu)
{
return testValidation.validate(argu);
}
}
一切都很好并得到以下响应:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:validateResponse xmlns:ns2="http://webservice.validation.test.com/">
<return><validate><returnCode>InvalidToken</returnCode></validate></return>
</ns2:validateResponse>
</S:Body>
</S:Envelope>
但我想要以下格式的回复意味着我的结果不在 tag 下。希望得到以下格式的回复:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns1:validateResponse xmlns:ns1="http://webservice.validation.test.com/">
<validateResult xsi:type="xsd:String"><validate><returnCode>InvalidToken</returnCode></validate></validateResult>
</ns1:validateResponse>
</S:Body>
</S:Envelope>
请告诉我如何实现这一点。正如尝试其他方式但无法找到解决方案。 提前致谢。
【问题讨论】:
标签: spring web-services soap jax-ws