The central idea behind Java Web Services (JWS) is the serialization of java classes into XML schemas and the deserialization of XML schemas into java classes. This is really cool…theoretically. The issue (I’m reserving the word “problem” at this point for later) I’m encountering is that the class going in is often different than the class coming out. It’s like some funky Willy Wonka version of serialization. Sure it’s really cool that Wonka can teleport a chocolate bar, but how practical is it that the chocolate bar is about a 1/4 ton to begin with and is only 3 ounces coming out?! The deserialized version of the java class is indeed wonky (weird method name morphs, Lists that turn into arrays, or just a bunch of errors)…at least the way I’m doing it. Of course, if I knew what the hell I was doing I wouldn’t be having to actually LEARN this crap! At least when Mike Teevee got all stretched back out, he was looking at a brilliant career in the NBA!
The first hint in SOA Using Java Web Services (Mark D. Hansen) that Willy Wonka may have actually been on the JWS team is when he writes:
“One interesting point to make here is that only the [SOAP request/response] is specified by the WSDL. The Java method invocations at either end are completely arbitrary from a Web Services perspective. In fact, you have one Java method signature on the client side and a completely different method signature on the server side. In most cases, the method signatures are different…”
[WARNING: This portion of the blog you are reading is starting to resemble a rant]
I realize that in many cases, the client may be written in a different programming language than the service, but if they’re both written in Java shouldn’t they have the same method signatures?!! WTF?!!! He goes on to point out that if “both sides were working with the same Java class libraries, this invocation could occur via Java RMI”. Ummm…true, but what if one client is java and another is not? What if one java client doesn’t have the class libraries? Am I going to write handling for RMI and Web Services for the same business resources just because I can? I thought the whole point of this mess is so that I don’t have to distribute my class libraries! If I’m following the bean pattern and doing my annotations correctly, I expect the same tasty morsel to be delivered at my client’s doorstep, not a half-digested piece of crap! I want the serialization system to work like Pizza Hut delivery, not my lower intestine!