我正在将web-service以前使用的客户端升级axis为现在使用CXF. 请注意,web-service属于第 3 方,因此我无权修改wsdl自己。
<message name="doSomethingRequest">
<part name="parameters" element="doSomething" />
</message>
<message name="doSomethingResponse">
<part name="parameters" element="doSomethingResponse" />
</message>
<portType name="myServicePortType">
<operation name="doSomething">
<input message="doSomethingRequest" />
<output message="doSomethingResponse" />
</operation>
</portType>
如您所见,通过messages 和operations 记录在 中的方式,当通过调用时选择WSDL绑定样式,这很好。我的旧类,通过/生成的所有方法也具有样式中的所有方法,其中类作为参数类型并且没有返回类型。WRAPPEDwsdl2javacxf-codegen-plugin*PortTypeaxistools-maven-pluginwsdl2javaWRAPPEDHolder
但我的问题是,当我以前使用axistools-maven-plugin生成java类时,我的所有*Holder类也都是自动生成的,以匹配*PortType接口需求。但是对于cx-codegen-plugin,只有*PortType接口反映了参数类型WRAPPED需要的样式;我没有看到作为!的一部分生成的类。HolderOUT*Holderwsdl2java
有什么方法可以让我cxf-codegen-plugin生成*Holder类作为其中的一部分,wsdl2java而无需自己编写它们?我不想切换到BARE绑定样式,因为这意味着大量的重构。我不能WSDL像我之前提到的那样修改任何一个。
我使用v3.0.2和数据绑定cxf-codegen-pluginfwiw JAXB。
@RequestWrapper(localName = "doSomething", targetNamespace = "...", className = "...DoSomething")
@WebMethod(action = "urn:#doSomething")
@ResponseWrapper(localName = "doSomethingResponse", targetNamespace = "...", className = "...DoSomethingResponse")
public void doSomething(
@WebParam(name = "requestParam1", targetNamespace = "...")
java.lang.String requestParam1,
@WebParam(name = "requestParam2", targetNamespace = "...")
java.lang.String requestParam2,
// the below holders for SomeType1 and SomeType2, i.e the SomeType1Holder and SomeType2Holder, are not auto-generated as part of the wsdl2java
@WebParam(mode = WebParam.Mode.OUT, name = "responseParam1", targetNamespace = "...")
javax.xml.ws.Holder<SomeType1> responseParam1,
@WebParam(mode = WebParam.Mode.OUT, name = "responseParam2", targetNamespace = "...")
javax.xml.ws.Holder<SomeType2> responseParam2
);