File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes passing array in Axis method call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "passing array in Axis method call" Watch "passing array in Axis method call" New topic

passing array in Axis method call

thomas wilson

Joined: Sep 21, 2004
Posts: 24
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

Joined: May 04, 2004
Posts: 4
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">
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>

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.
I agree. Here's the link:
subject: passing array in Axis method call
jQuery in Action, 3rd edition