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<mailto: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<mailto: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

Reply via email to