Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem: returning an arrayList from *.jws file  RSS feed

 
Anna Madhusudhanan Natanagopalan
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using axis. I created a Page1.jws file. In that file i have a getValue method which returns me an ArrayList.
But i am getting object in the client side and in the wsdl file it shows me the return type is array.(soapenc:"array");
I did not write any *.wsdd file or *.wsdl file. I started the tomcat and then in the browser i accessed the file. http://localhost:8080/axis/Page1.jws?wsdl.
It gives me the wsdl file but the return type is not arraylist. In the wsdl file it shows me array is the return type and in client side i am getting object. not array or arrayList.
//but it is working for vector ......
<code> Page1.jws
public class Page1 {
public java.util.ArrayList getValue(){
ArrayList list = new ArayList();
list.add("WEBSERVICES");
return list;
}
}
For this problem what should i do. Please do the needful.
Thanks and regards
Anna Madhusudhanan
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the Axis User's Guide:

Java Collections
Some of the Collection classes, such as Hashtable, do have serializers, but there is no formal interoperability with other SOAP implementations, and nothing in the SOAP specifications which covers complex objects. The most reliable way to send aggregate objects is to use arrays. In particular, .NET cannot handle them, though many Java SOAP implementations can marshall and unmarshall hash tables.
Arbitrary Objects without Pre-Registration
You cannot send arbitrary Java objects over the wire and expect them to be understood at the far end. With RMI you can send and receive Serializable Java objects, but that is because you are running Java at both ends. Axis will only send objects for which there is a registered Axis serializer. This document shows below how to use the BeanSerializer to serialize any class that follows the JavaBean pattern of accessor and mutator. To serve up objects you must either register your classes with this BeanSerializer, or there must be serialization support built in to Axis. Remote References Remote references are neither part of the SOAP specification, nor the JAX-RPC specification. You cannot return some object reference and expect the caller to be able to use it as an endpoint for SOAP calls or as a parameter in other calls. Instead you must use some other reference mechanism, such as storing them in a HashMap with numeric or string keys that can be passed over the wire.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!