• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

passing array in Axis method call

 
thomas wilson
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to pass an array in method call to web service? Is there such thing as XMLType.XSD_STRING []? In other words, if I want to pass a String array in Axis method call, can I do something like this?:

Service service = new Service();
Call call = (Call)service.createCall();
call.addParameter("StringParams", XMLType.XSD_STRING [], ParameterMode.IN);

Thank you
[ October 05, 2004: Message edited by: thomas wilson ]
 
Sri Prof
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Thomas,

You can pass a String array or object array in Webservices.
If you are using Apache Axis Java2WSDL and WSDL2Java you dont need to
worry about calling the method.

FYI: In WSDL you can see the String array as:
<complexType name="ArrayOf_xsd_string">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
</restriction>
</complexContent>
</complexType>

In soap Implementation:

public java.lang.String[] getStringArray() throws java.rmi.RemoteException {
String[] strArr = new String[10];
strArr[0] = "abc";
return strArr;
}


I am trying to pass Object arrays (ie customized object arrays like Account[], Contact[]) I am getting "InvocationTargetException". If I place the
class files in Web-Inf\classes\ this error is gone. But I couldn't understand what is the problem....Please let me know if you come across the solution for this.

Hope this helps you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic