File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Returning an array with different classes inside Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Returning an array with different classes inside" Watch "Returning an array with different classes inside" New topic

Returning an array with different classes inside

Peter Merker
Ranch Hand

Joined: Oct 18, 2003
Posts: 37

I have a method which is returning an array of type BaseClass. Inside are objects of different SubClasses. The SOAP message generated by Axis 1.3 treats the objects in the array as if they were all of type BaseClass, but I need the attributes from the SubClasses, which are really inside the array.
Is there a way to do this somehow, either with Axis 1.3, another version, or another Web Services Library?
If this is not implemented yet, is it possible to fix the Axis code? In this case, where could this be done?

Thanks in advance for your help.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12759
I think you are trying to push SOAP well beyond what it is designed for. You should try to come up with a way to transfer the information using standard SOAP concepts.

For example can you reduce the specialized class attributes to a Map?

It is sorta covered in the JavaRanch Style Guide.
subject: Returning an array with different classes inside
Similar Threads
My SCEA Part 1Study Notes
Which pattern is best suitable for this prob.
3 Features of Java for Internationalization
problem with inheritance / polymorphism