Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it possible to return an array of objects from a web service?

 
Huw Morgan
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been trying to do this for a while now, and I have come to the conclusion that it may be impossible. To demonstate what I want to do I enclose a simple java file [1]. I have deployed this with Axis 2 and I enclose the responce [2], it is obciously not wat I want.

Is it porrible to do this? If so, how?

Thanks for any help,

[1]


[2]
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem could be the object SampleElement is not mapped to Axis2.

Instead of you generating the skeleton, aar, wsdl... Try to use axis2 supplied tools like Java2WSDL or WSDL2Java to generate the serverside and stub code for you. This will helps you get the all the return and input types mapped properly.

Regards
Balaji
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the axis2 tools link http://ws.apache.org/axis2/tools/index.html
 
Peer Reynders
Bartender
Posts: 2934
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are correct you cannot return a pure, naked array - the array must always be "contained". In XML sequences are only permitted inside another complexType - you cannot have a "free-floating" sequence.

Depending on the databinding that you are using another layer of containment may also be required if you need to distinguish between an empty array and a null array.

Web services programming tips and tricks: Array gotcha -- null array vs. empty array.

Basically it is a good idea to create web service interfaces contract first - that way the web service contract isn't influenced by the choice of the service implementation language (in this case Java).
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic