[jboss-user] [JBossWS] - Re: Collection in java -> wsdl for wstools

guurk do-not-reply at jboss.com
Wed Dec 27 23:46:11 EST 2006


Ok, I've gone through the Axis website which it appears the wstools is based on. Based on the documentation there, there is no 'proper' way to do collections, it's really up to the implementer..

>From http://ws.apache.org/axis/java/user-guide.html#HowYourJavaTypesMapToSOAPXMLTypes

anonymous wrote : 
  | Java Collections
  | Some of the Collection classes, such as Hashtable, do have serializers, but there is no formal interoperability with other SOAP implementations, and nothing in the SOAP specifications which covers complex objects. The most reliable way to send aggregate objects is to use arrays. In particular, .NET cannot handle them, though many Java SOAP implementations can marshall and unmarshall hash tables.
  | 

Thus, I changed my method signature, and instead of returning Collection I changed it to return News[]. An array.

This produced much better results in the generated WSDL.


  | <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>
  | - <complexType name="News.Array">
  | - <sequence>
  |   <element maxOccurs="unbounded" minOccurs="0" name="value" nillable="true" type="ns10:News" /> 
  |   </sequence>
  |   </complexType>
  | 

Very much in order with what I was looking for.

Bottom Line

Use arrays instead of gerisized Collections.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3996569#3996569

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3996569



More information about the jboss-user mailing list