Re: ArrayList in Webservices

2006-02-03 Thread Anne Thomas Manes
If you plan to support interoperability with any language other than
Java (or even any SOAP engine other then Axis), you should not expose
Java Collections through your WSDL interface. You should convert them
to arrays.

AnneOn 2/3/06, Nayana Hegde [EMAIL PROTECTED] wrote:
Hi,

The following is the class which I have exposed as a webservice.

public class Test {
public ArrayList getArrayList(){ArrayList list = new ArrayList();TestObject obj = new TestObject();obj.setName(First);list.add(obj);TestObject obj1 = new TestObject();

obj1.setName(Second);list.add(obj1);return list;}public HashMap getMap(){HashMap map = new HashMap();map.put(First,First);map.put(Second,First); 
return map;}}

Now when I access the method getArrayList in the client side it is
getting resolved as an Object array instead of an ArrayList but when I
access the getMap() it is getting resolved correctly. Can you let me
know the reason for the above? Is there any configuration changes that
have to be done for the above to work. 1.2beta3 1009 August 17 2004.

service name=Test provider=java:RPC parameter name=className value=com.db.cc.Test/ parameter name=allowedMethods value=*/ 
 parameter name=load-on-startup value=true/ parameter name=activateOnStartup value=true/  beanMapping languageSpecificType=java: 
com.db.cc.object.TestObject qname=ns4:TestObject xmlns:ns4=urn:object.cc.db.com/
 /service


Thanks and Regards,
Nayana




Re: ArrayList in Webservices

2006-02-03 Thread Nayana Hegde
Hi,

 Our application has to support only java. Can anyone let me know what are the criteria to be satisfied If I have to write a Serializerand Deserializer for ArrayList? Thanks for the same

On 2/3/06, Anne Thomas Manes [EMAIL PROTECTED] wrote:
If you plan to support interoperability with any language other than Java (or even any SOAP engine other then Axis), you should not expose Java Collections through your WSDL interface. You should convert them to arrays.
Anne 

On 2/3/06, Nayana Hegde [EMAIL PROTECTED]
 wrote: 

Hi,

The following is the class which I have exposed as a webservice.

public class Test {
public ArrayList getArrayList(){ArrayList list = new ArrayList();TestObject obj = new TestObject();obj.setName(First);list.add(obj);TestObject obj1 = new TestObject();
obj1.setName(Second);list.add(obj1);return list;}public HashMap getMap(){HashMap map = new HashMap();map.put(First,First);map.put(Second,First); 
return map;}}

Now when I access the method getArrayList in the client side it is getting resolved as an Object array instead of an ArrayList but when I access the getMap() it is getting resolved correctly. Can you let me know the reason for the above? Is there any configuration changes that have to be done for the above to work. 
1.2beta3 1009 August 17 2004.

service name=Test provider=java:RPC parameter name=className value=com.db.cc.Test/ parameter name=allowedMethods value=*/ 
 parameter name=load-on-startup value=true/ parameter name=activateOnStartup value=true/  beanMapping languageSpecificType=java: 
com.db.cc.object.TestObject qname=ns4:TestObject xmlns:ns4=urn:object.cc.db.com/ 
 /service


Thanks and Regards,
Nayana


RE: ArrayList in Webservices

2006-02-03 Thread Jay Glanville



If your server and clients are both java, soap may not be 
the best communication protocol for you. I'd actually recommend a binary 
based protocol like RMI or Hessian/Burlap for such situations. Binary 
protocols perform better then text based ones.

Generally, SOAP is great for interoperating between 
different platforms. If all the platforms are the same, then there's 
probably a better way.

Just my 2 cents.

JDG

  
  
  From: Nayana Hegde 
  [mailto:[EMAIL PROTECTED] Sent: Friday, February 03, 2006 
  8:35 AMTo: axis-user@ws.apache.orgSubject: Re: ArrayList 
  in Webservices
  
  Hi,
  
   Our application has to support only java. Can anyone let me know 
  what are the criteria to be satisfied If I have to write a 
  Serializerand Deserializer for ArrayList? Thanks for the same
  
  On 2/3/06, Anne Thomas 
  Manes [EMAIL PROTECTED] 
  wrote: 
  If 
you plan to support interoperability with any language other than Java (or 
even any SOAP engine other then Axis), you should not expose Java 
Collections through your WSDL interface. You should convert them to arrays. 
Anne 

On 2/3/06, Nayana 
Hegde [EMAIL PROTECTED] 
 wrote: 

  Hi,
  
  The following is the class which I have exposed as a 
webservice.
  
  public class Test {
  public ArrayList getArrayList(){ArrayList 
  list = new ArrayList();TestObject obj = new 
  TestObject();obj.setName("First");list.add(obj);TestObject 
  obj1 = new 
  TestObject();obj1.setName("Second");list.add(obj1);return 
  list;}public HashMap getMap(){HashMap 
  map = new 
  HashMap();map.put("First","First");map.put("Second","First"); 
  return map;}}
  
  Now when I access the method getArrayList in the client side it is 
  getting resolved as an Object array instead of an ArrayList but when I 
  access the getMap() it is getting resolved correctly. Can you let me know 
  the reason for the above? Is there any configuration changes that have to 
  be done for the above to work. 1.2beta3 1009 August 17 2004.
  
  service name="Test" provider="java:RPC" 
  parameter name="className" 
  value="com.db.cc.Test"/ parameter 
  name="allowedMethods" value="*"/  
  parameter name="load-on-startup" 
  value="true"/ parameter 
  name="activateOnStartup" value="true"/  
  beanMapping languageSpecificType="java: com.db.cc.object.TestObject" 
  qname="ns4:TestObject" xmlns:ns4="urn:object.cc.db.com"/ 
   /service
  
  
  Thanks and Regards,
  Nayana


Re: ArrayList in Webservices

2006-02-03 Thread Christian Kloner
Yes. Would say the same. But if you want to use Soap on every price so 
you dont know what times will come and you must be interoperable, I must 
say it is not possible to use ArrayLists! You can only use arrays and 
each element must be of the same type. because soap specifies this and 
java is using this specification. if it was not so, soap would have no 
sense! if the types in the array are no primitive datatypes but a 
dataype of your own, you need a deserializer rather serializer to 
register with the specified element namespace/name. So if the soap 
message is parsed it will use the specified deserializer to push the 
soap values into the java class values.


lg,
chris

Jay Glanville schrieb:
If your server and clients are both java, soap may not be the best 
communication protocol for you.  I'd actually recommend a binary based 
protocol like RMI or Hessian/Burlap for such situations.  Binary 
protocols perform better then text based ones.
 
Generally, SOAP is great for interoperating between different 
platforms.  If all the platforms are the same, then there's probably a 
better way.
 
Just my 2 cents.
 
JDG



*From:* Nayana Hegde [mailto:[EMAIL PROTECTED]
*Sent:* Friday, February 03, 2006 8:35 AM
*To:* axis-user@ws.apache.org
*Subject:* Re: ArrayList in Webservices

Hi,
 
  Our application has to support only java. Can anyone let me know

what are the criteria to be satisfied If I have  to write a
Serializer and Deserializer for ArrayList? Thanks for the same

 
On 2/3/06, *Anne Thomas Manes* [EMAIL PROTECTED]

mailto:[EMAIL PROTECTED] wrote:

If you plan to support interoperability with any language
other than Java (or even any SOAP engine other then Axis), you
should not expose Java Collections through your WSDL
interface. You should convert them to arrays.

Anne


On 2/3/06, *Nayana Hegde* [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:

Hi,
 
The following is the class which I have exposed as a

webservice.
 
public class Test {


 public ArrayList getArrayList(){
  ArrayList list = new ArrayList();
  TestObject obj = new TestObject();
  obj.setName(First);
  list.add(obj);
  TestObject obj1 = new TestObject();
  obj1.setName(Second);
  list.add(obj1);
  return list;
 }
 public HashMap getMap(){
  HashMap map = new HashMap();
  map.put(First,First);
  map.put(Second,First);
  return map;
 }
}
 
Now when I access the method getArrayList in the client

side it is getting resolved as an Object array instead of
an ArrayList but when I access the getMap() it is getting
resolved correctly. Can you let me know the reason for the
above? Is there any configuration changes that have to be
done for the above to work. 1.2beta3 1009 August 17 2004.
 
service name=Test provider=java:RPC

parameter name=className value=com.db.cc.Test/
parameter name=allowedMethods value=*/  
parameter name=load-on-startup value=true/
parameter name=activateOnStartup value=true/ 
beanMapping languageSpecificType=java:

com.db.cc.object.TestObject qname=ns4:TestObject
xmlns:ns4=urn:object.cc.db.com http://object.cc.db.com//
  /service
 
 
Thanks and Regards,

Nayana