You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Ryan Norris (JIRA)" <ji...@apache.org> on 2008/02/04 05:31:08 UTC

[jira] Commented: (CXF-1340) wsdl2java overwrites objectFactory methods if multiple service classes are in the same package, causes value type inheritance problems

    [ https://issues.apache.org/jira/browse/CXF-1340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565261#action_12565261 ] 

Ryan Norris commented on CXF-1340:
----------------------------------

I'm experiencing the same issue when a single WSDL file is used that contains multiple service definitions.  The last service in the WSDL is always the one that is reflected in ObjectFactory.

As Incognito points out, the lackluster workaround for this would be to namespace things at a very fine grain, which has various drawbacks.

> wsdl2java overwrites objectFactory methods if multiple service classes are in the same package, causes value type inheritance problems
> --------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-1340
>                 URL: https://issues.apache.org/jira/browse/CXF-1340
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 2.0.3, 2.1
>         Environment: Windows XP, eclipse
>            Reporter: Incognito
>         Attachments: cxf-issue-objectFactory.zip
>
>
> If you have two wsdl-based services, who's wsdl2java output is in the same package, the outputted objectFactory retains only the most recent service's methods. 
> For example:
> Given two wsdl files, CarService.wsdl and UserService.wsdl; if one executes the wsdl2java binary with both services; with CarService first and UserService second, and with both service classes being output in package org.example.api, then only one objectFactory.java class will be created. First, objectFactory will be created with the objects for CarService.wsdl, and then it will be overwritten with UserService.wsdl's objects. 
> It just so happens that in this scenario, if the former service contains an object that is abstract, that is, that it contains types that inherit via wsdl's extension keyword, AND methods for creating instances of CarService.wsdl's outputted java are NOT present in objectFactory.java, then CXF does not include type information in the SOAP messages. 
> For example: 
> given an alternate CarService.wsdl with the following types:
>   <complexType name="Car" abstract="true">
>     ...
>   </complexType>
>   <complexType name="Jeep">
>     <extension base="Car">
>      ...
>     </extension>
>   </complexType>
> If CarService.wsdl also had a method called getCarById, and wsdl2java output 2 java classes: getCarById.java and getCarByIdResponse.java, AND wsdl2java on UserService.wsdl was executed AFTER it was executed on CarService (resulting in an objectFactory without create methods for getCar*), then CXF will send SOAP messages like the following
> <soap>
>   <getCarByIdResponse> <!-- type information here would mistakenly be missing --> 
>    ...
>   </getCarByIdResposne>
> </soap>
> The ultimate result is that if a project has more than 1 service being output in the same package AND if more than 1 type in those two services use type extension, then CXF will have problems marshalling those classes because it will end up leaving out the type information for all classes not included in the ObjectFactory. One alternative would be to have the wsdl2java classes be output to multiple packages. If the different services shared types, this would result in duplicated code in each service.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.