Recently I was involved in a discussion around the concept of interoperability with WCF services. Half of our I.T. shop develops in the Java world and the other half in .NET, so as we were designing our next WCF service we asked ourselves the question, " Will this service ever need to be consumed by a Java client?" The answer to that question would make a difference in our design approach since we were told by our consultants friends that if we were to use custom data types in .NET, we were foregoing the opportunity for our Java teams from ever utilizing the service. We decided not worry about interoperability drawbacks and go ahead and design the service with custom .NET data types, generic lists, enums, etc.
This article is designed to show you how you CAN actually have pretty solid interoperability between JWS and WCF using custom data types, generic lists, and enums both ways; a JWS service consumed by a .NET client as well as a WCF service consumed by a Java client. We'll break it down into three postings:
- An overview of our design approach
- Create the WCF service consumed by a Java client
- Create the Java Web Service consumed by a .NET client
Both the WCF and the JWS services will have the same class structure. Below you will find a class diagram that demonstrates the class layout:
The services will return a list of "Teams" that contain some basic information for each including:
- Team Name
- Team Type
- This will be an enumeration value of either "Soccer" or "Football"
- This will be a generic list of "Player"(s) that contain a Name and Age
As you will see the code for both platforms is very similar and there are only a couple of caveats to getting the solutions to work "out of the box", which we will discuss later.
For the Java development, we will be using NetBeans IDE version 6.8 and for the .NET development, we will be using Visual Studio 2008.
This article is the first in a three part series demonstrating the interoperability between .NET WCF services and Java Web Services.