Using arrays in complex types turns out to be fairly simple.  You simple need to add an additional setter and an additional getter, so that Axis can set and get individual elements in the array.
 
The two should look like:
 

public PhoneInfo getPhoneItem(int i)

{

return phoneItem[i];

}

and

public void setPhoneItem(int i, PhoneInfo value)

{

phoneItem[i] = value;

}

 

By simply adding those two methods I was able to pass arrays inside of complex types.

I did not have to add special type mappings in the wsdd for the array (as I've seen suggested quite a number of times).  If the array is a complex type, then it needs to be mapped like any other complex type.

If anyone wants a more complete example, just let me know.

 

Bill

 

 

-----Original Message-----
From: Heitzeg, Bill
Sent: Tuesday, February 10, 2004 1:24 PM
To: [EMAIL PROTECTED]
Subject: RE: Simple arrays in complex types

Thanks so much!
-----Original Message-----
From: Tony Blair [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 10, 2004 12:40 PM
To: [EMAIL PROTECTED]
Subject: RE: Simple arrays in complex types

Hi Bill,
 
I use ArrayList. I wrapp the ArrayList inside a Complex type called Request. I pass the Request as an input to my remote operation. I originally couldn't do this but thanks to Vanketesh I figured out. Attached are my client code and the wsdl.
 
Let me know if you need anything else.
 
Cheers,
Tony.
 


"Heitzeg, Bill" <[EMAIL PROTECTED]> wrote:
It does, thanks Tony!
 
    I think from my research that this is either a bug in Axis or no one has figured out how to do it correctly.  It's strange because Arrays work great as a top level parameter and also nested in the response.  The only thing that doesn't work is nesting in the request.  I've read several times where people have given up on arrays and decided to use something else.  Has this caused any interop problems for you?  I would probably use an ArrayList, is that what you used?  Would you mind sending me a code snippet and a snippet of your wsdd?  I just want to get this right, it's really slowing me down and I need to move on.
 
thanks for you time, I really appreciate it.
 
Bill
-----Original Message-----
From: Tony Blair [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 10, 2004 12:01 PM
To: [EMAIL PROTECTED]
Subject: Re: Simple arrays in complex types

Bill,
 
I have a similar code where I pass in a Collection (as oppose to an array) of beans inside a complex type as a method parameter to an operation. It works fine but I had to provide a QName and register the type mapping with the Call object inside my Client code.
 
Hope this helps,
Tony.

"Heitzeg, Bill" <[EMAIL PROTECTED]> wrote:
Hello everyone, well at least Monday is over,

I'm having a problem when I place a String array inside of a complex type. If I just want to send a String Array as a method parameter, it works fine. As soon as I place the array inside of complex type I get a NullPointerException. This is happening before my code is called. Also, if I don't populate the array with any values (xsi:nil="true"), it works fine. Has anyone else had this problem? Any advice you might have would be great. The WSDL is at the bottom of this email, it's auto generated by Axis.

thanks,

Bill Heitzeg


Request Message:


xmlns:impl="http://localhost:8080/BillWebService_axis/services/BillWebService"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns1="urn:prototype:webservices:cruise:sabre:com"
xmlns:tns3="http://prototype.webservices.cruise.sabre.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">



Bill Heitzeg

995-9125
995-9131






Response Message:




soapenv:Server.userException
java.lang.NullPointerException





WSDL

























































































































































Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online


Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online

Reply via email to