Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

de/serializers for ArrayLists

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a scenario ..if someone
could help me here...
Following is the class method I'm using which returns an ArrayList which I want to receive in my .Net setup.
public class AddFunction1 {
public AddFunction1(){}
public ArrayList searchUsers(String lastName, String firstName)
{
ArrayList myList = new ArrayList();
if(lastName.equals("last") && firstName.equals("first"))
myList.add(0, "mg1");
else
myList.add(0, "mg2");
return myList;
}
}
This is how my deploy.wsdd looks like which deploys the webservice okay in my AxisRc2 (in which some fixes have been done for the ArrayLists)
<deployment xmlns="http://xml.apache.org/axis/wsdd/";
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">;
<service name="AddFunction1Service" provider="java:RPC">
<parameter name="className" value="AddFunction1"/>
<parameter name="allowedMethods" value="*"/>
<beanMapping qname="myNS:ArrayList" xmlns:myNS="urn:BeanService"
languageSpecificType="java:java.util.ArrayList"/>
</service>
<transport name="http">
<requestFlow>
<handler type="URLMapper"/>
<handler type="java rg.apache.axis.handlers.http.HTTPAuthHandler"/>
</requestFlow>
</transport>
<transport name="local">
<responseFlow>
<handler type="java rg.apache.axis.transport.local.LocalResponder"/>
</responseFlow>
</transport>
</deployment>
But I've not been able to get this inside my .Net client(Web Service Toolkit).Althogh I can see the proxy stubs and skeletons generated in .Net
and also the ArrayList object which is not null but still it doesn't show the correct data within it..
Has someone encountered such problem?
thanks
Sam.
 
Author
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Sam Bom:
I have a scenario ..if someone
could help me here...
Following is the class method I'm using which returns an ArrayList which I want to receive in my .Net setup.
public class AddFunction1 {
public AddFunction1(){}
public ArrayList searchUsers(String lastName, String firstName)
{
ArrayList myList = new ArrayList();
if(lastName.equals("last") && firstName.equals("first"))
myList.add(0, "mg1");
else
myList.add(0, "mg2");
return myList;
}
}
This is how my deploy.wsdd looks like which deploys the webservice okay in my AxisRc2 (in which some fixes have been done for the ArrayLists)
<deployment xmlns="http://xml.apache.org/axis/wsdd/";
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">;
<service name="AddFunction1Service" provider="java:RPC">
<parameter name="className" value="AddFunction1"/>
<parameter name="allowedMethods" value="*"/>
<beanMapping qname="myNS:ArrayList" xmlns:myNS="urn:BeanService"
languageSpecificType="java:java.util.ArrayList"/>
</service>
<transport name="http">
<requestFlow>
<handler type="URLMapper"/>
<handler type="java rg.apache.axis.handlers.http.HTTPAuthHandler"/>
</requestFlow>
</transport>
<transport name="local">
<responseFlow>
<handler type="java rg.apache.axis.transport.local.LocalResponder"/>
</responseFlow>
</transport>
</deployment>
But I've not been able to get this inside my .Net client(Web Service Toolkit).Althogh I can see the proxy stubs and skeletons generated in .Net
and also the ArrayList object which is not null but still it doesn't show the correct data within it..
Has someone encountered such problem?
thanks
Sam.


It would be easy to identify, if you put the WSDL !
 
Sam Bom
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ramesh This is my generated wsdl
<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/"; xmlns:apachesoap="http://xml.apache.org/xml-soap"; xmlns:impl="http://workstation-12:8080/axis/services/AddFunction1Service"; xmlns:intf="http://workstation-12:8080/axis/services/AddFunction1Service"; xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:tns1="urn:BeanService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; targetNamespace="http://workstation-12:8080/axis/services/AddFunction1Service">;
<wsdl:types>
<schema targetNamespace="urn:BeanService" xmlns="http://www.w3.org/2001/XMLSchema">;
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>;
<complexType name="ArrayList">
<sequence>
<complexContent>
<extension base="soapenc:Array">
</extension>
</complexContent>
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="searchUsersResponse">
<wsdl:part name="searchUsersReturn" type="tns1:ArrayList"/>
</wsdl:message>
<wsdl:message name="searchUsersRequest">
<wsdl:part name="in0" type="xsd:string"/>
<wsdl:part name="in1" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="AddFunction1">
<wsdl:operation name="searchUsers" parameterOrder="in0 in1">
<wsdl:input name="searchUsersRequest" message="impl:searchUsersRequest"/>
<wsdl:output name="searchUsersResponse" message="impl:searchUsersResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AddFunction1ServiceSoapBinding" type="impl:AddFunction1">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>;
<wsdl:operation name="searchUsers">
<wsdlsoap:operation/>
<wsdl:input>
<wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="http://DefaultNamespace"/>;
</wsdl:input>
<wsdl:output>
<wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="http://workstation-12:8080/axis/services/AddFunction1Service"/>;
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AddFunction1Service">
<wsdl:port name="AddFunction1Service" binding="impl:AddFunction1ServiceSoapBinding">
<wsdlsoap:address location="http://workstation-12:8080/axis/services/AddFunction1Service"/>;
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Presumably the problem is that .NET does not know about ArrayList since it is a Java collection. Why not just send an array of String?
The collections API has these great methods for conversion to and from arrays, so I really don't see any reason to get tangled up in Java specific classes.
String[] ret = new String[ myList.size() ];
return myList.toArray( ret );
should work.
 
Sam Bom
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya Coneverting to Arrays is a good option,but I'm dealing with an existing application and the client is reluctant to change the method signatures snd definitions.
 
pie. tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic