Problem solve Get help with specific problems with your technologies, process and projects.

Java collection classes and interoperability

I am a JAX-RPC user with interoperability concerns. The JAX-RPC implementations I've come across make it convenient to build and use a Web service whose interface makes use of Java collection classes such as Map, List and Set. My question is this: By incorporating these classes into the signatures of methods of my service interface, am I breaking my chances of interoperability with clients that use other platforms, specifically .NET? What does the WS-I Basic profile say about this? Should I steer away from using anything other than arrays as far as collections are concerned?

WS-I has not yet tackled the collections/containers problem (and I'm not sure they will). Most Java implementations provide serialization frameworks that automatically map a Java collection to an XML container. Likewise .NET provides automatic serialization frameworks that map .NET collections to XML containers. An interoperability issue can arise if the Java-generated containers aren't compatible with the .NET-generated containers. In particular, the Apache containers (used by Apache Axis and Sun's JAX-RPC RI) aren't compatible with the .NET containers. You can readily resolve this issue by using custom serialization routines, but then you lose the advantages of using the automatic serialization frameworks, and you also need to configure your clients and services to use special serializers.

Quite a few Java implementations, such as GLUE, WASP, and XMLBus provide serialization frameworks that can generate containers that are compatible with either Apache or .NET containers. (You have to choose which one you want -- unfortunately you can't generate a container that is compatible with both.) If you use these implementations with the .NET-compatible containers, you shouldn't have interoperability problems with .NET, and you won't need to create custom serializers.

Your other choice is avoid the whole situation by simply using arrays rather than collections.

Dig Deeper on Topics Archive

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.