You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Thomas GL <to...@free.fr> on 2010/09/09 17:51:57 UTC

wsdl2java: avoiding INOUT parameters in wrapper style

Hi,

We are using CXF 2.2.5 for a project, and we are trying to upgrade to current version (2.2.10).
But it happens that, for many of our services, the Java interface generated by wsdl2java does change.
Here is an example:

<wsdl:definitions ...>
  <wsdl:types>
    <xsd:schema ...>
      <xsd:complexType name="Update">
        <xsd:sequence>
          <xsd:element name="installedResource" type="InstalledResource"/>
        </xsd:sequence>
      </xsd:complexType>
      <xsd:complexType name="UpdateResponse">
        <xsd:sequence>
          <xsd:element name="installedResource" type="InstalledResource"/>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="update">
    <wsdl:part name="fault" element="schemas:update"/>
  </wsdl:message>
  <wsdl:message name="updateResponse">
    <wsdl:part name="fault" element="schemas:updateResponse"/>
  </wsdl:message>
  <wsdl:portType name="ManageResourceInstalledBase">
    <wsdl:operation name="update">
      <wsdl:input name="updateInput" message="interface:update"/>
      <wsdl:output name="updateOutput" message="interface:updateResponse"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding ...>
    ...
  </wsdl:binding>
  <wsdl:service ...>
    ...
  </wsdl:service>
</wsdl:definitions>

CXF 2.2.5 used to generate the following interface method for this operation:

    @ResponseWrapper(localName = "updateResponse", targetNamespace = "...", className = "....UpdateResponse")
    @RequestWrapper(localName = "update", targetNamespace = "...", className = "....Update")
    @WebResult(name = "installedResource", targetNamespace = "...")
    @WebMethod(action = "...")
    public InstalledResource update(
	  @WebParam(name = "installedResource", targetNamespace = "...")
	  InstalledResource installedResource
    );

CXF 2.2.10 now generates the following interface method instead:

    @ResponseWrapper(localName = "updateResponse", targetNamespace = "...", className = "....UpdateResponse")
    @RequestWrapper(localName = "update", targetNamespace = "...", className = "....Update")
    @WebMethod(action = "...")
    public void update(
        @WebParam(mode = WebParam.Mode.INOUT, name = "installedResource", targetNamespace = "...")
        javax.xml.ws.Holder<InstalledResource> installedResource
    );

According to the JAX-WS spec, the later code is the right one: input and output parameters both have a single 
child element, with the same name and type, and thus can be wrapped as an in/out parameter.
CXF 2.2.5 actualy had a bug, which was fixed with issue CXF-2582:
https://issues.apache.org/jira/browse/CXF-2582

But we have developed our code based on the former kind of interfaces, and we would like to keep that unchanged.
Hence the question: is there some way (with jaxws bindings for instance) to restore 2.2.5-style interfaces in such cases?
We would like to achieve this without modifying the WSDL, and without disabling wrapper style.

Thanks in advance for your help and ideas,
Thomas.

Re: wsdl2java: avoiding INOUT parameters in wrapper style

Posted by Daniel Kulp <dk...@apache.org>.
I'm really not seeing any way to generate the older (non-compliant) style 
interface.   If you want to take the changes made for CXF-2582 (see the 
subversion tab in jira) and turn them into a patch that are disabled with a 
new "-compat 2.2.5" flag, we could definitely accept that.

Dan


On Thursday 09 September 2010 11:51:57 am Thomas GL wrote:
> Hi,
> 
> We are using CXF 2.2.5 for a project, and we are trying to upgrade to
> current version (2.2.10). But it happens that, for many of our services,
> the Java interface generated by wsdl2java does change. Here is an example:
> 
> <wsdl:definitions ...>
>   <wsdl:types>
>     <xsd:schema ...>
>       <xsd:complexType name="Update">
>         <xsd:sequence>
>           <xsd:element name="installedResource" type="InstalledResource"/>
>         </xsd:sequence>
>       </xsd:complexType>
>       <xsd:complexType name="UpdateResponse">
>         <xsd:sequence>
>           <xsd:element name="installedResource" type="InstalledResource"/>
>         </xsd:sequence>
>       </xsd:complexType>
>     </xsd:schema>
>   </wsdl:types>
>   <wsdl:message name="update">
>     <wsdl:part name="fault" element="schemas:update"/>
>   </wsdl:message>
>   <wsdl:message name="updateResponse">
>     <wsdl:part name="fault" element="schemas:updateResponse"/>
>   </wsdl:message>
>   <wsdl:portType name="ManageResourceInstalledBase">
>     <wsdl:operation name="update">
>       <wsdl:input name="updateInput" message="interface:update"/>
>       <wsdl:output name="updateOutput" message="interface:updateResponse"/>
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:binding ...>
>     ...
>   </wsdl:binding>
>   <wsdl:service ...>
>     ...
>   </wsdl:service>
> </wsdl:definitions>
> 
> CXF 2.2.5 used to generate the following interface method for this
> operation:
> 
>     @ResponseWrapper(localName = "updateResponse", targetNamespace = "...",
> className = "....UpdateResponse") @RequestWrapper(localName = "update",
> targetNamespace = "...", className = "....Update") @WebResult(name =
> "installedResource", targetNamespace = "...") @WebMethod(action = "...")
>     public InstalledResource update(
> 	  @WebParam(name = "installedResource", targetNamespace = "...")
> 	  InstalledResource installedResource
>     );
> 
> CXF 2.2.10 now generates the following interface method instead:
> 
>     @ResponseWrapper(localName = "updateResponse", targetNamespace = "...",
> className = "....UpdateResponse") @RequestWrapper(localName = "update",
> targetNamespace = "...", className = "....Update") @WebMethod(action =
> "...")
>     public void update(
>         @WebParam(mode = WebParam.Mode.INOUT, name = "installedResource",
> targetNamespace = "...") javax.xml.ws.Holder<InstalledResource>
> installedResource
>     );
> 
> According to the JAX-WS spec, the later code is the right one: input and
> output parameters both have a single child element, with the same name and
> type, and thus can be wrapped as an in/out parameter. CXF 2.2.5 actualy
> had a bug, which was fixed with issue CXF-2582:
> https://issues.apache.org/jira/browse/CXF-2582
> 
> But we have developed our code based on the former kind of interfaces, and
> we would like to keep that unchanged. Hence the question: is there some
> way (with jaxws bindings for instance) to restore 2.2.5-style interfaces
> in such cases? We would like to achieve this without modifying the WSDL,
> and without disabling wrapper style.
> 
> Thanks in advance for your help and ideas,
> Thomas.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog