[JBossWS] - Re: Collection in java -> wsdl for wstools
by guurk
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#HowYourJavaTypesMapToSOAPX...
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
18 years, 2 months
[JBossWS] - Collection in java -> wsdl for wstools
by guurk
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
18 years, 2 months
[JBossWS] - new to jbossws
by santhoshitha
I am new to jbossws and web services in general. I have been able to follow the userguide and get my server side artifacts generated properly(usng wstools) and my deployment in the server is also fine. i am able to obtain the wsdl once the service is deployed successfully on the server, and now, i am trying to connect via a client.
I intend to use a static java process client and not a j2ee client(although j2ee is recommended in the user guide). I do not know how to configure the service reference and consume the service from my static java client. I am however able to accomplish the same using DII. I would like to know if there is any API for this purpose, and whether it is only possible to use DII if not.
If there are any links to source codes and samples, with illustrations in detail, it will be a big help.
Thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3996439#3996439
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3996439
18 years, 2 months