Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Get cxf-codegen-plugin to generate the Holder classes

$
0
0
0 down vote favorite

I'm upgrading a web-service client that was previously using axis to now use
CXF. Note that the web-service belongs to a 3rd party, so I have no access
to modify the wsdl myself.

<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>

As you can see, with the way, the messages and operations are documented in
the WSDL, a binding style of WRAPPED is chosen when the wsdl2java is invoked
thru the cxf-codegen-plugin, which is fine. My old *PortType class,
generated thru axistools-maven-plugin / wsdl2java also had all the methods
in the WRAPPED style with Holder classes as parameter types and without a
return type.

But my problem is, when I was previously using the axistools-maven-plugin to
generate the java classes, all my *Holder classes were also generated
automatically to match the *PortType interface needs. But with the
cx-codegen-plugin, only the *PortType interface reflects the WRAPPED style
requiring Holder types for the OUT parameters; I don't see the *Holder
classes generated as part of the wsdl2java!

Any way I can get the cxf-codegen-plugin to generate the *Holder classes as
part of wsdl2java without writing them myself? I don't want to switch to the
BARE binding style since that would mean a lot of refactoring. I can't
modify the WSDL either like I had mentioned earlier.

I use v3.0.2 of cxf-codegen-plugin and JAXB databinding 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
);

Viewing all articles
Browse latest Browse all 5648

Trending Articles