"exposing functions returning complex objects" as Web Service

"Agarwal, Naresh" <[email protected]> Wed, 4 Jun 2003 21:31:43 -0700
Newsgroups gmane.comp.windows.devel.soap.general
Message-ID <07EC20A3290A504EA73D914B4C08A48602720B97@usmail14.informatica.com>
Hi 

Z, A, B, C, D and E are java 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 program 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, which return other objects (like b)

Thus AFAIK, we have 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