You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Agarwal, Naresh" <na...@informatica.com> on 2003/06/18 09:36:51 UTC

passing objects by reference in SOAP!

Hi

A typical SDK is object-oriented and involves passing objects/data by
references (pointers). This will work as long as the client using the SDK is
in the same address space of the SDK. However, if client and SDK (i.e., the
service which provides SDK functions) are in different address spaces, then
this will not work "AS IS", and we need some kind of
marshalling/demarshalling mechanism used in DCOM and CORBA etc.

How does such a thing will work in SOAP given the fact that SOAP does NOT
support passing objects by reference?

Consider the example of a typical SDK given below:

Z, A, B, C, D and E are some classes. a, b, c, d and e are instances of A,
B, C, D, E respectively. Classes Z, A, B, C, D and E have various functions,
which could be used for various purposes. consider the code below, which
shows how to use a function "getE" of class E.

----------

A a = Z.getA(some parameters - p1) // getA is static function

B b = a.getB(some parameters - p2)

C c = b.getC(some parameters - p3)

D d = c.getD(some parameters - p4)

E e = d.getE(some parameters - p5)

---------

Now if I wish to expose such a SDK as a WebService, then I cann't do this
"as is" because SOAP does not support passing objects by references. Thus, I
cannot expose "getA" function as WebService, as it returns instance of class
A, which inturn has functions (executed at service side), which return other
objects (like b)

Thus AFAIK, the only way out is to expose a single function "getE", which in
turn will do all the stuff, i.e.,

getE(p1, p2, p3, p4, p5) {

A a = Z.getA(p1) // getA is static function

B b = a.getB(p2)

C c = b.getC( p3)

D d = c.getD(p4)

E e = d.getE(p5)

return e;

}

Is there a better way out? Or this is the only way to expose such existing
SDKs as Web Services?

thanks & regards,

Naresh Agarwal