我正在使用Apache Cxf来创建如下的webservice:
@WebService(name = "xmlServiceSoap", targetNamespace = "http://www.Test.com/")
@BindingType(value = javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
public class MyEndpoint {
@Autowired
MyServiceImpl myServiceImpl;
@WebMethod(action = "http://www.Test.com/MyService")
@WebResult(name = "MyServiceResponse",targetNamespace="http://www.Test.com/")
@SOAPBinding(parameterStyle = ParameterStyle.BARE)
public MyServiceResponse getMyServiceResponse(
@WebParam(name = "MyService", targetNamespace = "http://www.Test.com/") MyService partnerService,
@WebParam(name = "AuthenticationHeader", header = true, targetNamespace = "http://www.Test.com/") AuthenticationHeader header) {
MyServiceResponse res = myServiceImpl.getMyServiceResponse(partnerService, header);
return res;
}
}
问题在于我得到的反应如下:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<ns2:MyServiceResponse xmlns:ns2="http://www.HotelTravel.com/">
<MyServiceResult>
但我想要回复:
<soap:Body>
<MyServiceResponse xmlns="http://www.HotelTravel.com/">
<MyServiceResult>
表示removinf ns2
中的soap:body
。
是否有可能在CXF中实现这一目标?