Java 如何在ApacheCXF中从Soap主体中删除名称空间前缀ns2
我使用Apache Cxf创建Web服务,如下所示:Java 如何在ApacheCXF中从Soap主体中删除名称空间前缀ns2,java,spring,soap,jaxb,cxf,Java,Spring,Soap,Jaxb,Cxf,我使用Apache Cxf创建Web服务,如下所示: @WebService(name = "xmlServiceSoap", targetNamespace = "http://www.Test.com/") @BindingType(value = javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING) public class MyEndpoint { @Autowired MyServiceImpl myServiceI
@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>
表示在soap:body
中移除ns2。
在CXF中有可能实现这一点吗?您成功做到了吗?您成功解决了吗?您成功做到了吗?您成功解决了吗?