David,

The first thing you need to understand is that SOAP is not an
especially good protocol for transferring language-specific
collections. If your goal is to implement a Java-to-Java client/server
application, perhaps you should consider using a different protocol --
one that supports the Java type system. SOAP used the XML Schema type
system. For best results using SOAP, your service interface should use
types that map reasonably well to the XML Schema type system. (i.e.,
don't try to use Vector or List to generate your interface -- use
simple arrays instead)

The next thing you need to understand is that there is a layer of
indirection between the data/object model used by the server and
data/object model used by the client. Just because you use
language-specific collections on the server to generate your WSDL
interface, those collections are not apparent to the client. The
client only sees the schema representation of the objects. If you want
your client to convert that schema into the same Java object types
that you use on the server, then you need to specify the data binding
mapping rather than using a tool like wsdl2java to generate it.

Anne

On 12/16/06, Vanfleet, David <[EMAIL PROTECTED]> wrote:




Hi,

I'm new to both Axis2 and web services and I'm having a hard time grasping
all the various types of databinding that can be created (POJO, AXIOM, ADB,
XMLBeans and JiBX). I have a couple of general questions about Axis2 and web
services.



I need to create a service that can pass complex objects between the client
and the server. Something like my modified weather example below.



My questions about this are as follows:



1) In the testing I've done I noticed that it fails when there are any
java.util.Vector or java.util.List objects within the object being
transferred. I have seen several other posts about this but with no
responses. Does anyone know why this is the case? How can I get around this?



  I read that using an ArrayList object will work which I did verify, but I
need to be able to user List and Vectors.



2) In the following modified Weather class where I have an ArrayList called
children with its set and get methods (this is from the
sample.pojo.rpcclient package distributed with Axis2). When I send this
weather class on a round trip to the WeatherService service calling the
setWeather then the getWeather methods, then I take the returned weather
class and call it's getChildren method I end up with an ArrayList of
OMEElement objects rather than Weather objects as I wanted. I understand
that everything is converted to XML during transport, but how do I get these
elements mapped back into the Weather class?



  package sample.pojo.data;

  import java.util.ArrayList;



  public class Weather{

    float temperature;

    String forecast;

    boolean rain;

    float howMuchRain;

    ArrayList<Weather> children=null;



    public Weather() {

      children=new ArrayList<Weather>();

    }



    public Weather(String forecast) {

      children=new ArrayList<Weather>();

      this.forecast=forecast;

    }

    .

    .

    .



    public void setChildren(ArrayList<Weather> c) {

      children=c;

    }



    public void addChild(Weather w) {

      children.add(w);

    }



    public ArrayList<Weather> getChildren() {

      return children;

    }

  }



3) Based on needing to transfer this kind of object what type of databinding
would be best for me to use. Are there some that would work better than
others, In my testing I'm using this POJO sample? But I'm thinking that I
should use ADB or XMLBean. Any suggestions?



4) The client that will be accessing this service will be running within
both a standalone application and a Java applet. For the sake of the Java
applet I would like the client footprint to be as small as possible. Based
on this requirement are there some databindings that have a smaller
footprint than others?



I realized that I'm not grasping all the concepts that I need to understand
here, I'm not even sure I'm asking the right questions? I have been looking
at the documentation and samples that come with Axis2. Are there any other
good resources that I can look at that might help me out here, such as some
good tutorials or FAQ's. Some more good code samples would be helpful tool.
Any comments offered would be greatly appreciated.



Thanks,

David



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to