You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "warren crossing (JIRA)" <ji...@apache.org> on 2009/09/24 13:17:16 UTC

[jira] Created: (CXF-2446) generate java.util.List collections for XMLElementWrappers

generate java.util.List collections for XMLElementWrappers
----------------------------------------------------------

                 Key: CXF-2446
                 URL: https://issues.apache.org/jira/browse/CXF-2446
             Project: CXF
          Issue Type: New Feature
          Components: Tooling
            Reporter: warren crossing


when generating code with the xew plugin you have to turn off 
   <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>

otherwise the cxf proxy will fail at runtime with a class cast exception.

could some extension be added to generate XMLElementWrappers with one and only one collection as java.util.List?

<plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>${cxfVersion}</version>
                <executions>
                    <execution>
                        <id>cxf-shipment</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                        <configuration>
                            <sourceRoot>${project.build.directory}/generated-sources/main</sourceRoot>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>${basedir}/src/main/resources/ShipmentService.wsdl</wsdl>
                                    <bindingFiles>
                                        <bindingFile>${basedir}/src/main/resources/bindings-global.xml</bindingFile>
                                    </bindingFiles>
                                    <extraargs>
                                        <arg>-xjc-Xxew</arg>
                                    </extraargs>
                                </wsdlOption>
                            </wsdlOptions>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <defaultOptions>
                        <autoNameResolution>true</autoNameResolution>
                    </defaultOptions>
                    <verbose>true</verbose>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>dk.conspicio</groupId>
                        <artifactId>xew</artifactId>
                        <version>1.0.0</version>
                        <scope>runtime</scope>
                    </dependency>
                </dependencies>
            </plugin>


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


[jira] Commented: (CXF-2446) generate java.util.List collections for XMLElementWrappers

Posted by "warren crossing (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761996#action_12761996 ] 

warren crossing commented on CXF-2446:
--------------------------------------

Sorry about that. I foolishly tried to save time and money by using the Local Transports without appreciating the implications therein. 

I have updated and tidied the example, The specific point I wanted to clarify is visible in 

example-client/target/generated-sources/main/org/example/mybookmarks/BookmarksService.java:30

public example.BookmarkTypeArray suggestABookmark

Can this not be generated as 

public List<example.BookmarkType> suggestABookmark

This may seem trivial here however when using xew on a semi-complicated model and ws interface its becomes very time consuming, writing a lot a template type code

eg

new BookmarkTypeArray();
new Section()
section.setBookmarks(bookmarkTypeArray)
section.getBookmarks().getList(),add(element)

instead it could be a simple as

new Section()
section.getBookmarks(),add(element)


Ps I also noticed portName is being ignored on the example-server wsdl generation in the pom.  If I put @PortName in the BookmarkService interface it generates correctly. however I cannot run the web service as it violates something else.

Caused by: javax.xml.ws.WebServiceException: Attributes portName, serviceName and endpointInterface are not allowed in the @WebService annotation of an SEI.

If this is a new issue/bug then please raise it as such.  With many regards

> generate java.util.List collections for XMLElementWrappers
> ----------------------------------------------------------
>
>                 Key: CXF-2446
>                 URL: https://issues.apache.org/jira/browse/CXF-2446
>             Project: CXF
>          Issue Type: New Feature
>          Components: Tooling
>            Reporter: warren crossing
>
> when generating code with the xew plugin you have to turn off 
>    <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
> otherwise the cxf proxy will fail at runtime with a class cast exception.
> could some extension be added to generate XMLElementWrappers with one and only one collection as java.util.List?
> <plugin>
>                 <groupId>org.apache.cxf</groupId>
>                 <artifactId>cxf-codegen-plugin</artifactId>
>                 <version>${cxfVersion}</version>
>                 <executions>
>                     <execution>
>                         <id>cxf-shipment</id>
>                         <phase>generate-sources</phase>
>                         <goals>
>                             <goal>wsdl2java</goal>
>                         </goals>
>                         <configuration>
>                             <sourceRoot>${project.build.directory}/generated-sources/main</sourceRoot>
>                             <wsdlOptions>
>                                 <wsdlOption>
>                                     <wsdl>${basedir}/src/main/resources/ShipmentService.wsdl</wsdl>
>                                     <bindingFiles>
>                                         <bindingFile>${basedir}/src/main/resources/bindings-global.xml</bindingFile>
>                                     </bindingFiles>
>                                     <extraargs>
>                                         <arg>-xjc-Xxew</arg>
>                                     </extraargs>
>                                 </wsdlOption>
>                             </wsdlOptions>
>                         </configuration>
>                     </execution>
>                 </executions>
>                 <configuration>
>                     <defaultOptions>
>                         <autoNameResolution>true</autoNameResolution>
>                     </defaultOptions>
>                     <verbose>true</verbose>
>                 </configuration>
>                 <dependencies>
>                     <dependency>
>                         <groupId>dk.conspicio</groupId>
>                         <artifactId>xew</artifactId>
>                         <version>1.0.0</version>
>                         <scope>runtime</scope>
>                     </dependency>
>                 </dependencies>
>             </plugin>

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


[jira] Commented: (CXF-2446) generate java.util.List collections for XMLElementWrappers

Posted by "Warren Crossing (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12760863#action_12760863 ] 

Warren Crossing commented on CXF-2446:
--------------------------------------

Hello Daniel

I have encapsulated the problem in the following example, how ever it 
seems to get stuck at the point before that.  Could you please look at 
it anyway.

It does clearly show how array, collection generation for wsdl to java 
is a bit broken.

The first module creates the wsdl. For completeness.
The second module creates the java.

http://www.pointdefence.net/example.tar

I'm unsure on the general procedure for uploading largish files so I 
created a link.





> generate java.util.List collections for XMLElementWrappers
> ----------------------------------------------------------
>
>                 Key: CXF-2446
>                 URL: https://issues.apache.org/jira/browse/CXF-2446
>             Project: CXF
>          Issue Type: New Feature
>          Components: Tooling
>            Reporter: warren crossing
>
> when generating code with the xew plugin you have to turn off 
>    <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
> otherwise the cxf proxy will fail at runtime with a class cast exception.
> could some extension be added to generate XMLElementWrappers with one and only one collection as java.util.List?
> <plugin>
>                 <groupId>org.apache.cxf</groupId>
>                 <artifactId>cxf-codegen-plugin</artifactId>
>                 <version>${cxfVersion}</version>
>                 <executions>
>                     <execution>
>                         <id>cxf-shipment</id>
>                         <phase>generate-sources</phase>
>                         <goals>
>                             <goal>wsdl2java</goal>
>                         </goals>
>                         <configuration>
>                             <sourceRoot>${project.build.directory}/generated-sources/main</sourceRoot>
>                             <wsdlOptions>
>                                 <wsdlOption>
>                                     <wsdl>${basedir}/src/main/resources/ShipmentService.wsdl</wsdl>
>                                     <bindingFiles>
>                                         <bindingFile>${basedir}/src/main/resources/bindings-global.xml</bindingFile>
>                                     </bindingFiles>
>                                     <extraargs>
>                                         <arg>-xjc-Xxew</arg>
>                                     </extraargs>
>                                 </wsdlOption>
>                             </wsdlOptions>
>                         </configuration>
>                     </execution>
>                 </executions>
>                 <configuration>
>                     <defaultOptions>
>                         <autoNameResolution>true</autoNameResolution>
>                     </defaultOptions>
>                     <verbose>true</verbose>
>                 </configuration>
>                 <dependencies>
>                     <dependency>
>                         <groupId>dk.conspicio</groupId>
>                         <artifactId>xew</artifactId>
>                         <version>1.0.0</version>
>                         <scope>runtime</scope>
>                     </dependency>
>                 </dependencies>
>             </plugin>

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


[jira] Commented: (CXF-2446) generate java.util.List collections for XMLElementWrappers

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12759347#action_12759347 ] 

Daniel Kulp commented on CXF-2446:
----------------------------------


Is the xew plugin available in a maven repo someplace?   Could you post the stack trace?  Maybe even a simple hello world style test case.

> generate java.util.List collections for XMLElementWrappers
> ----------------------------------------------------------
>
>                 Key: CXF-2446
>                 URL: https://issues.apache.org/jira/browse/CXF-2446
>             Project: CXF
>          Issue Type: New Feature
>          Components: Tooling
>            Reporter: warren crossing
>
> when generating code with the xew plugin you have to turn off 
>    <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
> otherwise the cxf proxy will fail at runtime with a class cast exception.
> could some extension be added to generate XMLElementWrappers with one and only one collection as java.util.List?
> <plugin>
>                 <groupId>org.apache.cxf</groupId>
>                 <artifactId>cxf-codegen-plugin</artifactId>
>                 <version>${cxfVersion}</version>
>                 <executions>
>                     <execution>
>                         <id>cxf-shipment</id>
>                         <phase>generate-sources</phase>
>                         <goals>
>                             <goal>wsdl2java</goal>
>                         </goals>
>                         <configuration>
>                             <sourceRoot>${project.build.directory}/generated-sources/main</sourceRoot>
>                             <wsdlOptions>
>                                 <wsdlOption>
>                                     <wsdl>${basedir}/src/main/resources/ShipmentService.wsdl</wsdl>
>                                     <bindingFiles>
>                                         <bindingFile>${basedir}/src/main/resources/bindings-global.xml</bindingFile>
>                                     </bindingFiles>
>                                     <extraargs>
>                                         <arg>-xjc-Xxew</arg>
>                                     </extraargs>
>                                 </wsdlOption>
>                             </wsdlOptions>
>                         </configuration>
>                     </execution>
>                 </executions>
>                 <configuration>
>                     <defaultOptions>
>                         <autoNameResolution>true</autoNameResolution>
>                     </defaultOptions>
>                     <verbose>true</verbose>
>                 </configuration>
>                 <dependencies>
>                     <dependency>
>                         <groupId>dk.conspicio</groupId>
>                         <artifactId>xew</artifactId>
>                         <version>1.0.0</version>
>                         <scope>runtime</scope>
>                     </dependency>
>                 </dependencies>
>             </plugin>

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


[jira] Commented: (CXF-2446) generate java.util.List collections for XMLElementWrappers

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12762646#action_12762646 ] 

Daniel Kulp commented on CXF-2446:
----------------------------------


There are two answers:

1) No, there isn't a way to generate List<...> for that return unless JAXB has a way to generate that for a top level element type, which I don't think it does.  We just call off to xjc to have it generate the schemas and then ask it the type for each top level element that we need.   Whatever it returns is what we need to use.

2) HOWEVER, if you change your original service from BARE mode to the default WRAPPED mode, then the wsdl would be different (and WSI-BP compliant as well, it currently isn't) but the resulting wsdl WOULD allow the List<...> thing to be generated as the return.   In that case, the generated types for the top level parts would be the structs, but you would never use them.  We would use them internally and you would just deal with the individual params which xjc/Xnew would map to List.

> generate java.util.List collections for XMLElementWrappers
> ----------------------------------------------------------
>
>                 Key: CXF-2446
>                 URL: https://issues.apache.org/jira/browse/CXF-2446
>             Project: CXF
>          Issue Type: New Feature
>          Components: Tooling
>            Reporter: warren crossing
>
> when generating code with the xew plugin you have to turn off 
>    <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
> otherwise the cxf proxy will fail at runtime with a class cast exception.
> could some extension be added to generate XMLElementWrappers with one and only one collection as java.util.List?
> <plugin>
>                 <groupId>org.apache.cxf</groupId>
>                 <artifactId>cxf-codegen-plugin</artifactId>
>                 <version>${cxfVersion}</version>
>                 <executions>
>                     <execution>
>                         <id>cxf-shipment</id>
>                         <phase>generate-sources</phase>
>                         <goals>
>                             <goal>wsdl2java</goal>
>                         </goals>
>                         <configuration>
>                             <sourceRoot>${project.build.directory}/generated-sources/main</sourceRoot>
>                             <wsdlOptions>
>                                 <wsdlOption>
>                                     <wsdl>${basedir}/src/main/resources/ShipmentService.wsdl</wsdl>
>                                     <bindingFiles>
>                                         <bindingFile>${basedir}/src/main/resources/bindings-global.xml</bindingFile>
>                                     </bindingFiles>
>                                     <extraargs>
>                                         <arg>-xjc-Xxew</arg>
>                                     </extraargs>
>                                 </wsdlOption>
>                             </wsdlOptions>
>                         </configuration>
>                     </execution>
>                 </executions>
>                 <configuration>
>                     <defaultOptions>
>                         <autoNameResolution>true</autoNameResolution>
>                     </defaultOptions>
>                     <verbose>true</verbose>
>                 </configuration>
>                 <dependencies>
>                     <dependency>
>                         <groupId>dk.conspicio</groupId>
>                         <artifactId>xew</artifactId>
>                         <version>1.0.0</version>
>                         <scope>runtime</scope>
>                     </dependency>
>                 </dependencies>
>             </plugin>

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


[jira] Commented: (CXF-2446) generate java.util.List collections for XMLElementWrappers

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761719#action_12761719 ] 

Daniel Kulp commented on CXF-2446:
----------------------------------



I think this example would be considered "invalid" and I'm tempted to close this off as such.

You have two schemas generating into the same package (examples) and thus end up with two different ObjectFactory objects  and resulting confusion in the context setups.   You are using the service interface from the first one (in example), but it ends up with the jaxb objects and such from the second one (examples-cxf) which then causes a bunch of wierd things to happen.



> generate java.util.List collections for XMLElementWrappers
> ----------------------------------------------------------
>
>                 Key: CXF-2446
>                 URL: https://issues.apache.org/jira/browse/CXF-2446
>             Project: CXF
>          Issue Type: New Feature
>          Components: Tooling
>            Reporter: warren crossing
>
> when generating code with the xew plugin you have to turn off 
>    <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
> otherwise the cxf proxy will fail at runtime with a class cast exception.
> could some extension be added to generate XMLElementWrappers with one and only one collection as java.util.List?
> <plugin>
>                 <groupId>org.apache.cxf</groupId>
>                 <artifactId>cxf-codegen-plugin</artifactId>
>                 <version>${cxfVersion}</version>
>                 <executions>
>                     <execution>
>                         <id>cxf-shipment</id>
>                         <phase>generate-sources</phase>
>                         <goals>
>                             <goal>wsdl2java</goal>
>                         </goals>
>                         <configuration>
>                             <sourceRoot>${project.build.directory}/generated-sources/main</sourceRoot>
>                             <wsdlOptions>
>                                 <wsdlOption>
>                                     <wsdl>${basedir}/src/main/resources/ShipmentService.wsdl</wsdl>
>                                     <bindingFiles>
>                                         <bindingFile>${basedir}/src/main/resources/bindings-global.xml</bindingFile>
>                                     </bindingFiles>
>                                     <extraargs>
>                                         <arg>-xjc-Xxew</arg>
>                                     </extraargs>
>                                 </wsdlOption>
>                             </wsdlOptions>
>                         </configuration>
>                     </execution>
>                 </executions>
>                 <configuration>
>                     <defaultOptions>
>                         <autoNameResolution>true</autoNameResolution>
>                     </defaultOptions>
>                     <verbose>true</verbose>
>                 </configuration>
>                 <dependencies>
>                     <dependency>
>                         <groupId>dk.conspicio</groupId>
>                         <artifactId>xew</artifactId>
>                         <version>1.0.0</version>
>                         <scope>runtime</scope>
>                     </dependency>
>                 </dependencies>
>             </plugin>

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


[jira] Resolved: (CXF-2446) generate java.util.List collections for XMLElementWrappers

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-2446.
------------------------------

       Resolution: Won't Fix
    Fix Version/s: Invalid


More of a jaxb/xjc issue for which we have no control and no response for a couple weeks.

> generate java.util.List collections for XMLElementWrappers
> ----------------------------------------------------------
>
>                 Key: CXF-2446
>                 URL: https://issues.apache.org/jira/browse/CXF-2446
>             Project: CXF
>          Issue Type: New Feature
>          Components: Tooling
>            Reporter: warren crossing
>             Fix For: Invalid
>
>
> when generating code with the xew plugin you have to turn off 
>    <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
> otherwise the cxf proxy will fail at runtime with a class cast exception.
> could some extension be added to generate XMLElementWrappers with one and only one collection as java.util.List?
> <plugin>
>                 <groupId>org.apache.cxf</groupId>
>                 <artifactId>cxf-codegen-plugin</artifactId>
>                 <version>${cxfVersion}</version>
>                 <executions>
>                     <execution>
>                         <id>cxf-shipment</id>
>                         <phase>generate-sources</phase>
>                         <goals>
>                             <goal>wsdl2java</goal>
>                         </goals>
>                         <configuration>
>                             <sourceRoot>${project.build.directory}/generated-sources/main</sourceRoot>
>                             <wsdlOptions>
>                                 <wsdlOption>
>                                     <wsdl>${basedir}/src/main/resources/ShipmentService.wsdl</wsdl>
>                                     <bindingFiles>
>                                         <bindingFile>${basedir}/src/main/resources/bindings-global.xml</bindingFile>
>                                     </bindingFiles>
>                                     <extraargs>
>                                         <arg>-xjc-Xxew</arg>
>                                     </extraargs>
>                                 </wsdlOption>
>                             </wsdlOptions>
>                         </configuration>
>                     </execution>
>                 </executions>
>                 <configuration>
>                     <defaultOptions>
>                         <autoNameResolution>true</autoNameResolution>
>                     </defaultOptions>
>                     <verbose>true</verbose>
>                 </configuration>
>                 <dependencies>
>                     <dependency>
>                         <groupId>dk.conspicio</groupId>
>                         <artifactId>xew</artifactId>
>                         <version>1.0.0</version>
>                         <scope>runtime</scope>
>                     </dependency>
>                 </dependencies>
>             </plugin>

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