Currently Axis does not support vectors (that may change when they support
JDK 1.5 which has generic-based vectors).

They do accept arrays of objects but the array has to be of a specific type.
Now you can in theory make a generic type (let's call it WSParam). Your
WSParam would have a getter/setter called ParamType which would be an int
value that gives you the type of parameter (int, String, etc.) that the
WSParam wraps.

Then you can have setters and getters for each of the possible parameter
types. Let's say your WSParam is wrapping a String. You'd create the WSParam
by saying

WSParam myParam=new WSParam(ParamType.STRING, strValue);

The WSParam constructor would look something like this

Public WSParam(int paramType, Object value)
{
   setParamType(paramType);
   switch (paramType)
   {
        case ParamType.STRING:
                setString(value);
                break;
        case ParamType.INTEGER:
                setInteger(value);
                break;
        //and so on for each type that it supports etc...

}

You can then create an array of WSParams and pass that to your call. This
setup would support complex types as well. And Axis will be able to
serialize/deserialize your parameters appropriately.

Hope this helps.

Michael

-----Original Message-----
From: Suresh Avadhanula [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 01, 2005 3:18 PM
To: [EMAIL PROTECTED]
Subject: How to serialize elements of Vector independently in Axis

Hi,

I am integrating axis to existing product where we can expose some
webservices and send/recieve SOAP messages. We have our own configuration
files instead of WSDL that would expose the services as Webservices. Hence I
cannot use WSDL2Java to generate stubs for axis.

We have generic methods

public Vector callOperation ( Vector params).

Any services that needs to be exposed as webservice implements this method.
The vector of params that is passed as argument can contain regular java
type params and/or attachments.

I am expecting the wire format of the SOAPBody would be

<calloperation>
   <Params>
       <vector param 1 ../>
       <vector attachment param2 .. />
       ...
   </Params>
</calloperation>

My question is , if I call

Call.invoke ( params ) // where params => vector of params

after setting all the necessary properties in Call object like operationName
etc, will Axis go through each object, find out if its a regurlar java
object or attachement and call serialization accordingly?
Should the vector contain objects of any specific type ( ala RPCParam
) for it  serialize each objects properly? In all the examples, I see that
each argument to the webservice method is set separately and passed as
Object[] to Call.invoke(), which goes through each objects, converts it to
RPCParam and serialize it finally. In my case, the only object that would be
passed to Call.invoke() would be a vector.

Any information ( or pointers to it ) as to how to serialize/deserialize
each object of the Vector will be very helpful.

Thanks

Reply via email to