In my WSDL I have an operation
<wsdl:operation name="theMethod">
<wsdl:input message="input1" name="input1"></wsdl:input>
<wsdl:output message="tns:classNumber1" name="classNumber1"></wsdl:output>
</wsdl:operation>
in my xsd, classNumber1
is a complex type and it is a wrapper for another type: classNumber2
<xs:complexType name="classNumber1">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="tns:classNumber2"/>
</xs:sequence>
</xs:complexType>
when I generate classes with cxf (I use cxf maven plugin), I expected that theMethod
to return a ClassNumber1
but it was a ClassNumber2
.
@WebMethod
@ResponseWrapper(localName="classNumber1" , className="com.model.ClassNumber")
public ClassNumber2 theMethod (Input1 input1){
...
}
Is there a way to tell cxf to generate the method with the wrapper CLassNumber1. Thanks.
I find the solution in this doc, question "How can I switch my generated web service method calls from wrapper style to non wrapper-style (or vice-versa)?"
The solution to keep wrappers with cxf generation is to add a binding file in the pom.xml:
<defaultOptions>
<bindingFiles>
<bindingFile>${basedir}/src/main/resources/bindings.xjb</bindingFile>
</bindingFiles>
<noAddressBinding>true</noAddressBinding>
</defaultOptions>
In the binding file you set enableWrapperStyle to false:
<jaxws:bindings
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://java.sun.com/xml/ns/jaxws"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
<enableWrapperStyle>false</enableWrapperStyle>
</jaxws:bindings>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With