web-service
클라이언트를 이전에 axis
을 사용하여 CXF
으로 업그레이드하고 있습니다. web-service
은 제 3 자에 속하므로 wsdl
자신을 수정할 수있는 권한이 없습니다. wsdl2java
가 잘되는 cxf-codegen-plugin
,를 통해 호출 될 때 당신이 볼 수 있듯이홀더 클래스를 생성하기 위해 cxf-codegen-plugin을 가져 오십시오.
<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>
이 방법과 함께 message
s와 operation
s는 WSDL
에 설명되어 있습니다, WRAPPED
의 바인딩 스타일 선택됩니다. 내 *PortType
클래스를 통해 생성 된 axistools-maven-plugin
/wsdl2java
에는 Holder
클래스의 모든 메소드가 WRAPPED
클래스의 매개 변수 유형 및 반환 유형이없는 모든 메소드가 있습니다.
하지만 이전에 java
클래스를 생성하기 위해 axistools-maven-plugin
를 사용하여 때 내 문제이며, 모든 내 *Holder
클래스는 또한 *PortType
인터페이스 요구 사항에 맞게 자동으로 생성되었다. 그러나 cx-codegen-plugin
의 경우 *PortType
인터페이스 만이 매개 변수에 Holder
유형이 필요한 WRAPPED
스타일을 반영합니다. *Holder
클래스가 wsdl2java
의 일부로 생성 된 것을 볼 수 없습니다!
어떤 식 으로든 cxf-codegen-plugin
은 *Holder
클래스를 wsdl2java
의 일부로 생성 할 수 있습니다. 직접 작성하지 않아도됩니까? BARE
바인딩 스타일로 전환하고 싶지는 않습니다. 많은 리팩토링을 의미 할 것이기 때문입니다. 이전에 언급 한 것처럼 WSDL
을 수정할 수 없습니다.
나는 v3.0.2
을 cxf-codegen-plugin
및 JAXB
데이터 바인딩 fwiw로 사용합니다.
@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
);