axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bu...@us.ibm.com
Subject Re: Sending more than just beans (Best Practice?)
Date Wed, 07 Aug 2002 12:36:37 GMT
You asked:  "Is there any way I can force .NET to generate a Stub for
Person as detailed as it was generated for MyService?"

The answer is, "no".  That would be passing a parameter by reference, which
isn't part of the web services model.  One of the mantras of web services
is loose coupling.  Just passing data around.  Passing references around
like this rather tightly couples the client and server.

(You could argue that we've already tightly coupled client and server by
mapping all the XML types to language constructs.  If we truly left the
connection loosely coupled, then all you'd get back is some object
representing the raw XML.  This would make the client code rather more
complicated, but loose coupling is something web services has touted.  Web
services fanatics would tell you that If you want tight coupling, use
CORBA, or DCOM, or RMI, or one of the many flavors of RPC.)

Russell Butek
butek@us.ibm.com


Andreas Leitner <nozone@sbox.tugraz.at>@leitner.dhs.org> on 08/07/2002 06:
35:50 AM

Please respond to axis-user@xml.apache.org

Sent by:    Andreas Leitner <al@leitner.dhs.org>


To:    axis-user@xml.apache.org
cc:
Subject:    Re: Sending more than just beans (Best Practice?)



On Wed, Aug 07, 2002 at 12:27:57PM +0100, Simon Hargreaves wrote:
> Andreas Leitner wrote:
>
> >Hi again,
> >
> >now that I have sessions working correctly I am now trying to implement
a
> >simple Client/Server combo.
> >
> >I understand from the docs that references cannot be transmitted via
soap.
> >So that in the following scenario (server side):
> >
> >class MyService
> >{
> >   Person getPersonByName (String name)
> >   {
> >         ... lookup person in db and return reference to it...
> >   }
> >
> >}
> >class Person
> >{
> >   private String name;
> >   private String tel;
> >   public String getName () {return name}
> >   public String getTel () {return tel}
> >   public void setName (String name) {this.name = name;}
> >   public void setTel (String tel) {this.tel = tel;}
> >}
> >--
> >
> >I would get on the client side:
> >--
> >class MyService
> >{
> >   Person getPersonByName (String name)
> >   { ... do proxy stuff ...}
> >}
> >--
> >which is ok, but class Person would carry only public data and no
> >operations.
> >--
> >class Person
> >{
> >   public String name;
> >   public String tel;
> >}
> >--
> >
> >
> Since the client needs to know the class to instantiate it, then the
> methods are there anyway, they're not transmitted but the methods are
> common knowledge.
>
> Beans need all the properties to be set using getXXX setXXX methods
> otherwise it's not a bean. Internal state can be read if it's public,
> and if you don't want to use a bean you can write your own Serializer
> for that class.


Correct in case Server=Axis and Client=Axis. I am sorry I was a bit
unclear.
In case of Server=Axis and Client=.NET the connection is defined via a WSDL
file.

I am using the autogenerated WSDL file (the one that I get by appending a
'?WSDL' to the services URL).
In that WSDL file (taken from the above scenario) all information I get
about Person is a simple schema, which lists all attributes of Person as a
'sequence'. There is of course no way for .NET to make anything more out of
that information than a simple class with only attributes.

Is there any way I can force .NET to generate a Stub for Person as detailed
as it was generated for MyService?

tia,
Andreas


Mime
View raw message