[jboss-user] [JBossWS] - Collection in java -> wsdl for wstools
guurk
do-not-reply at jboss.com
Wed Dec 27 23:23:18 EST 2006
JSR-181 deploying a ejb3 stateless as a web service using JBossIDE.
JBoss 4.0.5.GA
JBossIDE 2.0.0 Beta 2
JDK 1.5.0_08
On a method:
| @javax.jws.WebMethod()
| public Collection<News> getNews() {
| }
|
where News is an ejb3 entity bean (complex type):
| @Entity
| @Table( name = "news", uniqueConstraints = {})
| public class News implements java.io.Serializable {
| // Fields
| private static final long serialVersionUID = 1L;
| private Long id;
| private String title;
| private String description;
| private String body;
| private String author;
| private Set< RssItem> rssItems = new HashSet< RssItem>( 0);
| ...
| ...
| ...
|
The WSDL generated does not contain a sequence with the complex type defined:
| <complexType name="Collection">
| <sequence>
| <element name="empty" type="boolean" />
| </sequence>
| </complexType>
| <complexType name="News">
| <sequence>
| <element name="author" nillable="true" type="string" />
| <element name="body" nillable="true" type="string" />
| <element name="description" nillable="true" type="string" />
| <element name="id" nillable="true" type="long" />
| <element name="title" nillable="true" type="string" />
| </sequence>
| </complexType>
| </schema>
|
| <message name="ResonusBE_getNewsResponse">
| <part name="result" type="tns:Collection" />
| </message>
|
| <message name="ResonusBE_getNews" />
|
| <operation name="getNews">
| <input message="tns:ResonusBE_getNews" />
| <output message="tns:ResonusBE_getNewsResponse" />
| </operation>
|
|
Notice that the collection specified for Collection is collection with a boolen... not even close to the right type.
The News complex type only shows up in the WSDL if I explicitly have another method that returns News. It won't show up if it's just with in the Collection generics.
For testing purposes I tried out the XFire java->wsdl libraries... it does a nice job:
| <xsd:complexType name="ArrayOfNews">
| <xsd:sequence>
| <xsd:element maxOccurs="unbounded" minOccurs="0" name="News" nillable="true" type="tns:News" />
| </xsd:sequence>
| </xsd:complexType>
| <xsd:complexType name="News">
| <xsd:sequence>
| <xsd:element minOccurs="0" name="author" nillable="true" type="xsd:string" />
| <xsd:element minOccurs="0" name="body" nillable="true" type="xsd:string" />
| <xsd:element minOccurs="0" name="description" nillable="true" type="xsd:string" />
| <xsd:element minOccurs="0" name="id" nillable="true" type="xsd:long" />
| <xsd:element minOccurs="0" name="title" nillable="true" type="xsd:string" />
| </xsd:sequence>
| </xsd:complexType>
|
Thoughts? Am I missing something?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3996567#3996567
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3996567
More information about the jboss-user
mailing list