如何从Apache CXF中的Soap主体中删除命名空间前缀ns2

时间:2015-08-07 14:22:57

标签: java spring soap jaxb cxf

我正在使用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中实现这一目标?

0 个答案:

没有答案