Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Webservice Client Problem with vectors / deserialization
Webservice Client Problem with vectors / deserialization [message #169696] Fri, 19 May 2006 17:03 Go to next message
Eclipse UserFriend
Originally posted by: steffen.frech.objective-partner.de

Hello!

I'm generating a Java Proxy JSP-Client with Eclipse WTP.
The Client works fine with normal datatypes and own Beans. But when the return type is a Collection with own beans an exception is thrown:

exception: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.

So whats wrong?

In teh Webservice Explorer everything seems to be fine, my vector is serialized in item-tags:

- <getAktionenResponse xmlns="http://commonservice">
- <getAktionenReturn>
- <item xmlns="">
<aktn_nr>a12345</aktn_nr>
<claim>222</claim>
<geschaeftsjahr>2005</geschaeftsjahr>
<son>333</son>
<special_operation_code>soc12345</special_operation_code>
<status>ready</status>
<vin>t123</vin>
</item>
- <item xmlns="">
<aktn_nr>a6789</aktn_nr>
<claim>567</claim>
<geschaeftsjahr>2006</geschaeftsjahr>
<son>555</son>
<special_operation_code>soc6789</special_operation_code>
<status>false</status>
<vin>t123</vin>
</item>
</getAktionenReturn>
</getAktionenResponse>
...

how can i solve this problem?
the background is that I return a vector with Java Objects. I thought apache axis deserielizes automatically the vector and the bean inside??

Please help, I'm pretty new to Webservices!
Thanks!
Re: Webservice Client Problem with vectors / deserialization [message #171861 is a reply to message #169696] Wed, 21 June 2006 15:35 Go to previous message
Chris Brealey is currently offline Chris BrealeyFriend
Messages: 104
Registered: July 2009
Senior Member
Steffen,
the quickest way to get collections to work with Web services is to avoid them and use arrays instead...

The problem is that the Axis code emitters as driven by WTP's wizards have no idea what concrete types to expect in the collection because of its opaque
nature, and therefore cannot generate the necessary serializers/deserializers for those concrete types. The native Axis Java2WSDL emitter provides an
option, -e or --extraClasses, to expicitly notify Axis of the presence of classes you intend to use "on the wire" and that are not explicitly called out
anywhere else in your service endpoint interface or implementation class. Unfortunately, WTP does not expose this option.

This is something we could consider adding (you're welcome to open an RFE), however, we do not recommend the use of collections for the more basic reason
that they get mapped to WSDL and serialized within the SOAP message in a manner that can easily damage interoperability (mostly with other vendor Web
service platforms).

We strongly recommend using Java arrays instead of collections on your service endpoint interfaces. Unlike collections, they are strongly typed and are
fully supported by JAX-RPC 1.1, the pivotal specification for Java Web services: http://www.jcp.org/en/jsr/detail?id=101

Cheers - CB.

Steffen Frech wrote:

> Hello!
>
> I'm generating a Java Proxy JSP-Client with Eclipse WTP.
> The Client works fine with normal datatypes and own Beans. But when the return type is a Collection with own beans an exception is thrown:
>
> exception: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
>
> So whats wrong?
>
> In teh Webservice Explorer everything seems to be fine, my vector is serialized in item-tags:
>
> - <getAktionenResponse xmlns="http://commonservice">
> - <getAktionenReturn>
> - <item xmlns="">
> <aktn_nr>a12345</aktn_nr>
> <claim>222</claim>
> <geschaeftsjahr>2005</geschaeftsjahr>
> <son>333</son>
> <special_operation_code>soc12345</special_operation_code>
> <status>ready</status>
> <vin>t123</vin>
> </item>
> - <item xmlns="">
> <aktn_nr>a6789</aktn_nr>
> <claim>567</claim>
> <geschaeftsjahr>2006</geschaeftsjahr>
> <son>555</son>
> <special_operation_code>soc6789</special_operation_code>
> <status>false</status>
> <vin>t123</vin>
> </item>
> </getAktionenReturn>
> </getAktionenResponse>
> ..
>
> how can i solve this problem?
> the background is that I return a vector with Java Objects. I thought apache axis deserielizes automatically the vector and the bean inside??
>
> Please help, I'm pretty new to Webservices!
> Thanks!
Previous Topic:Asynchronous Web Service
Next Topic:How to get right hostname instead of "localhost" in a generated WSDL?
Goto Forum:
  


Current Time: Wed Apr 24 13:46:48 GMT 2024

Powered by FUDForum. Page generated in 0.03244 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top