-
1. Re: JavaBeans with java.util.Collection properties as parame
james.clover Mar 24, 2004 2:20 PM (in response to ottoberg)Java Collection classes aren't recommended for SOAP interfaces, mostly for interop reasons. If all you're needing is a list of objects without duplicates, then your interface can just be an array of objects. You can treat is as a Set from either side of the interface.
-
2. Re: JavaBeans with java.util.Collection properties as parame
ottoberg Mar 24, 2004 2:44 PM (in response to ottoberg)Thanks for your prompt answer, James.
"james.clover" wrote:
Java Collection classes aren't recommended for SOAP interfaces, mostly for interop reasons. If all you're needing is a list of objects without duplicates, then your interface can just be an array of objects. You can treat is as a Set from either side of the interface.
I am afraid I cannot change my domain objects to always use arrays instead of Sets. I am using Hibernate as my persistence layer, and Hibernate demands that properties mapped as arrays or Lists strictly obey the list semantics, i.e. be indexed. What's more, it requires a table column holding the index of each array element, and changing the table layout is simply no option.
On the other hand, I am operating in a homogenous java environment, so interop concerns are a non-issue. So do I have other options?
Cheers,
Olaf -
3. Re: JavaBeans with java.util.Collection properties as parame
james.clover Mar 24, 2004 2:52 PM (in response to ottoberg)Sounds like you may want to go talk to the Axis people. The fact that some instances of your Set are being mapped to AnyType (which would be correct) and some are mapped to others seems like a problem in the Axis code generators.
-
4. Re: JavaBeans with java.util.Collection properties as parame
rmcdonough Jul 5, 2004 9:29 AM (in response to ottoberg)Hi Olaf,
Dunno if you've solved your problem or not, but I was faced with a similar problem as I too am using Hibernate for my project. Rather than rearchitect the whole thing, I ended up refactoring my domain object so they each had an interface that could work better in a web service enviroment. This allowed me to have the application work as is, but when I have a webservice call, Jboss.NET will serialize the POJO's interface as opposed to the concrete class. You should know that Hibernate is not aware of any interfaces with my application, only the Web Services deal with those. I hope this is helpful.
Ryan- -
5. Re: JavaBeans with java.util.Collection properties as parame
cbrettin Jul 5, 2004 8:37 PM (in response to ottoberg)SOAP has no standard support for any collection apart from arrays.
As prevoius posters have said breaking the SOAP compatibility is generally a bad idea (surely compatibility, not hype, is the reason you are using WS)
The varying set serialisation is a bit of a worry, but understandable since (I hope) the first priority for axis is SOAP interop.
There are two ways you could bypass the set serialisation problem (or some combinaiton of the two):
1) Define a net set of types that use arrays instead of collections, and add methods to your existing types that convert between the two.
2) Add custom serialisers & deserialisers to you endpoints - this way you can use arrays "on the wire" but in you code deal only with you collection types
3) I know I said two, but that becuase this one is a bad idea - use java's built in XML bean serialiser and add the XML inline or as a soap attachment.