You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mirae-user@ws.apache.org by Changshin Lee <ia...@gmail.com> on 2006/03/27 07:45:11 UTC
RE: Using the same request/response classes on client & server
Hi Blake,
---
Hi all,
In my application, I'm trying to share the same request/response classes
between my client and server. I've read a lot of docs and FAQs, but I
haven't been able to find documentation on how to do this.
In case this isn't clear, let me explain what I'm trying to do with a
concrete example. Let's say I have a PolygonService which returns a
com.pelago.Polygon. The Polygon class not only describes a Polygon but
also provides some utility methods (such as computeArea()). This is all
fine and dandy on the server side, but when I auto-generate a client
from WSDL, the code generator doesn't know that the Polygon structure
described by the WSDL maps onto the com.pelago.Polygon class and it
generates its own separate Polygon class. This works for moving data
around, but then I need to write adapter code to translate the
auto-generated Polygon object into a com.pelago.Polygon that has the
methods I need.
---
If you use the JSR 172 JAX-RPC subset on client side and JAX-RPC
(1.1) on server side, then overriding your own value types on both
sides should work fine because the two technologies use the same XML-
Java mapping rules. In other words, even though your WSDL2Java tools
insist generating value types, you can overwrite them with your own
extension code. One thing you need to make sure in this process is
that your custom value types are also compliant with JAX-RPC. You
could easily achieve that by adding your own code to generated code.
---
This is of course inefficient both from a runtime and development
perspective. I'd like the generated client to just marshal and
unmarshall directly to/from the same classes I'm using on the
server-side.
---
Your approach looks nice, and I'd like to recommend being careful of
creating your own value types particularly noting that the value
types should run on CLDC or CDC which are subsets of Java SE and EE.
Cheers,
Ias
---------------------------------------------------------------------
To unsubscribe, e-mail: mirae-user-unsubscribe@ws.apache.org
For additional commands, e-mail: mirae-user-help@ws.apache.org