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

passing objects by reference in SOAP - How would it work?

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



Re: passing objects by reference in SOAP - How would it work?

Posted by Sergey Beryozkin <sb...@zandar.com>.
Hi,
I thought it was a different list :-), so my response was probably out of context, apologies ...
  ----- Original Message ----- 
  From: Sergey Beryozkin 
  To: axis-dev@ws.apache.org 
  Sent: Tuesday, June 17, 2003 1:04 PM
  Subject: Re: passing objects by reference in SOAP - How would it work?


  Hi,
  In most cases you don't want to do the same in SOAP. Often, a good approach is to create a simple wrapper application which will handle internally all the session-oriented staff. 
  With WSDL 1.2 you can GET a session first and then POST to it
  Cheers
  Sergey Beryozkin 
    ----- Original Message ----- 
    From: Agarwal, Naresh 
    To: axis-dev@ws.apache.org 
    Sent: Tuesday, June 17, 2003 12:56 PM
    Subject: passing objects by reference in SOAP - How would it work?


    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



Re: passing objects by reference in SOAP - How would it work?

Posted by Sergey Beryozkin <sb...@zandar.com>.
Hi,
In most cases you don't want to do the same in SOAP. Often, a good approach is to create a simple wrapper application which will handle internally all the session-oriented staff. 
With WSDL 1.2 you can GET a session first and then POST to it
Cheers
Sergey Beryozkin 
  ----- Original Message ----- 
  From: Agarwal, Naresh 
  To: axis-dev@ws.apache.org 
  Sent: Tuesday, June 17, 2003 12:56 PM
  Subject: passing objects by reference in SOAP - How would it work?


  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