Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在ApacheCXF中从Soap主体中删除名称空间前缀ns2_Java_Spring_Soap_Jaxb_Cxf - Fatal编程技术网

Java 如何在ApacheCXF中从Soap主体中删除名称空间前缀ns2

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

我使用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 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中有可能实现这一点吗?

您成功做到了吗?您成功解决了吗?您成功做到了吗?您成功解决了吗?