Thank you Sagara and Raghu (again), your reply's helped me to know all i wanted about axis handling of soap array's.
Best regards On Wed, Jan 4, 2012 at 5:36 AM, Sagara Gunathunga < sagara.gunathu...@gmail.com> wrote: > Axis2 does not support for SOAP encoding hence you can't use arrayType > attribute. As previous post mentioned you have to edit WSDL and use > XMLSchema to specify your array constrains. > > Thanks ! > > On Wed, Jan 4, 2012 at 12:32 AM, Raghu Upadhyayula < > rupadhyay...@responsys.com> wrote: > >> I guess for that you have to modify your WSDL as follows and regenerate >> the code from wsdl.**** >> >> ** ** >> >> <xs:element name="getArray">**** >> >> <xs:complexType>**** >> >> <xs:sequence>**** >> >> <xs:element *maxOccurs="4"* minOccurs="0" name="result" >> nillable="true" type="xs:string" /> **** >> >> </xs:sequence>**** >> >> </xs:complexType>**** >> >> </xs:element>**** >> >> ** ** >> >> ** ** >> >> Thanks**** >> >> Raghu**** >> >> [image: Description: >> cid:B80A849F-8953-4496-BB5B-34FFFD4B2394]<http://www.responsys.com/> >> **** >> >> ** ** >> >> *From:* Rui Oliveira [mailto:racoqs...@gmail.com] >> *Sent:* Tuesday, January 03, 2012 10:44 AM >> *To:* java-user@axis.apache.org >> *Subject:* Re: Array String parameter on SOAP Web Service**** >> >> ** ** >> >> Raghu >> >> Thanks! That worked it returned me 4 (the length of the array with all >> the elements). >> >> However, this only addresses part of the problem. >> >> I would like to reserve a array with a fixed size like what was done with >> my previous request example with: >> >> arrayType="xsd:string[4]" >> >> >> For instance, i want the array to reserve 4 elements for the array and >> not more. >> >> How i can do that? >> >> Best regards >> >> **** >> >> On Tue, Jan 3, 2012 at 6:26 PM, Raghu Upadhyayula < >> rupadhyay...@responsys.com> wrote:**** >> >> Hi Rui,**** >> >> **** >> >> Try this and see ….**** >> >> **** >> >> <soapenv:Envelope xmlns:soapenv= >> "http://schemas.xmlsoap.org/soap/envelope/"<http://schemas.xmlsoap.org/soap/envelope/>xmlns:myw= >> "http://MyWebService.dei.uc.pt" <http://mywebservice.dei.uc.pt/>> >> <soapenv:Header/> >> <soapenv:Body> >> <myw:getArray> **** >> >> <myw:result>Egypt</myw:result> >> <myw:result>Amsterdam</myw:result> >> <myw:result>Lisbon</myw:result> >> <myw:result>Paris</myw:result> **** >> >> </myw:getArray> >> </soapenv:Body> >> </soapenv:Envelope> >> >> **** >> >> **** >> >> **** >> >> Thanks**** >> >> Raghu**** >> >> **** >> >> **** >> >> *From:* Rui Oliveira [mailto:racoqs...@gmail.com] >> *Sent:* Tuesday, January 03, 2012 9:46 AM >> *To:* java-user@axis.apache.org**** >> >> >> *Subject:* Array String parameter on SOAP Web Service**** >> >> **** >> >> Sorry about bumping this thread but i really need a solution, or at least >> the confirmation that i'm doing things right and this is a limitation of >> Apache Axis2.**** >> >> ---------- Forwarded message ---------- >> From: *Rui Oliveira* <racoqs...@gmail.com> >> Date: Thu, Dec 29, 2011 at 4:05 PM >> Subject: Array String parameter on SOAP Web Service >> To: java-user@axis.apache.org >> >> >> Hi >> >> I'm new to Axis2, and i've developed a soap web service using Eclipse >> Helios integration with Axis2 and tomcat. I've tried searching the mailing >> list but no solution seemed to address my problem. This is why i send this >> email since i don't know what to do anymore! :( >> >> I'm trying to pass a string of array to the following web service >> function: >> >> package pt.uc.dei.MyWebService; >> >> public class MyWebService { >> //other functions ignored >> (...) >> >> public int getArray(String[]result) { >> return (result.length); >> } >> } >> >> The WSDL generated is attached with this email (it has definitions of >> other operations but getArray is the one with the problem) >> >> >> However when i use SOAPUI to generate a client. The default request that >> SoapUI generate is: >> >> <soapenv:Envelope xmlns:soapenv= >> "http://schemas.xmlsoap.org/soap/envelope/"<http://schemas.xmlsoap.org/soap/envelope/>xmlns:myw= >> "http://MyWebService.dei.uc.pt" <http://mywebservice.dei.uc.pt/>> >> <soapenv:Header/> >> <soapenv:Body> >> <myw:getArray> >> <myw:result>?</myw:result> >> </myw:getArray> >> </soapenv:Body> >> </soapenv:Envelope> >> >> >> I've edited the soap envelop tag, and the request content inside result >> tag it in order to support an array like this: >> >> <soapenv:Envelope xmlns:soapenv= >> "http://schemas.xmlsoap.org/soap/envelope/"<http://schemas.xmlsoap.org/soap/envelope/> >> xmlns:xsd="http://www.w3.org/2001/XMLSchema"<http://www.w3.org/2001/XMLSchema>xmlns:xsi= >> "http://www.w3.org/2001/XMLSchema-instance"<http://www.w3.org/2001/XMLSchema-instance>xmlns:SOAP-ENC= >> "http://schemas.xmlsoap.org/soap/encoding/"<http://schemas.xmlsoap.org/soap/encoding/>xmlns:myw= >> "http://MyWebService.dei.uc.pt" <http://mywebservice.dei.uc.pt/>> >> <soapenv:Header/> >> <soapenv:Body> >> <myw:getArray> >> <myw:result> >> <param SOAP-ENC:arrayType="xsd:string[4]" > >> <item xsi:type="xsd:string">Egypt</item> >> <item xsi:type="xsd:string">Amsterdam</item> >> <item xsi:type="xsd:string">Lisbon</item> >> <item xsi:type="xsd:string">Paris</item> >> </param> >> </myw:result> >> </myw:getArray> >> </soapenv:Body> >> </soapenv:Envelope> >> >> However the response i get from the getArray operation is : >> >> <soapenv:Envelope xmlns:soapenv= >> "http://schemas.xmlsoap.org/soap/envelope/"<http://schemas.xmlsoap.org/soap/envelope/>> >> >> <soapenv:Body> >> <ns:getArrayResponse >> xmlns:ns="http://MyWebService.dei.uc.pt"<http://mywebservice.dei.uc.pt/>> >> >> <ns:return>1</ns:return> >> </ns:getArrayResponse> >> </soapenv:Body> >> </soapenv:Envelope> >> >> >> It seems like the array of strings is being converted to one dimensional >> empty Array, and i'm not receiving the strings inside the soap array from >> the request. >> >> Can anyone provide me what is causing this and if my request is being >> built correctly? >> >> Best Regards**** >> >> **** >> >> ** ** >> > > > > -- > Sagara Gunathunga > > Blog - http://ssagara.blogspot.com > Web - http://people.apache.org/~sagara/ > LinkedIn - http://www.linkedin.com/in/ssagara >
<<image001.png>>