Hi Krishantha,

Thank for your email but the given link does not help. It just give the 
interface details of the soapenvelope and its various methods however I didnot 
find how to make my soap message that could invoke a web service method that 
has array as input parameter.

Regards,

Sardar Hussain

--- On Sun, 13/2/11, Krishantha Manjula Rathnayaka <krishantha...@gmail.com> 
wrote:

From: Krishantha Manjula Rathnayaka <krishantha...@gmail.com>
Subject: Re: [Axis2] Axis2 SOAP Request having array of integers
To: salarzi_...@yahoo.com
Cc: java-dev@axis.apache.org
Date: Sunday, 13 February, 2011, 19:26

Dear salarzi,
 
This link will help you.

http://ws.apache.org/axis/java/apiDocs/org/apache/axis/message/SOAPEnvelope.html

Kindly Regards,
 
Krishantha Manjula
 
 
On Sat, Feb 12, 2011 at 6:14 AM, Sardar Hussain <salarzi_...@yahoo.com> wrote:





Hi,

I have an array of integers in an Axis2 web service method, and I am using 
operationclient to send my soap request.
My web service method is as follows
public int calculateMean(int [] array) {


int sum=0;
for (int i=0;i<array.length;i++)
           sum+=array[i];
return sum/array.length;
}

My SOAPEnvelop is as follows, however it throws error.


SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();

        SOAPEnvelope envelope = fac.getDefaultEnvelope();
        
        OMNamespace omNs = fac.createOMNamespace(
                getNameSpace(wsdl), "ns");
        OMNamespace argNM=fac.createOMNamespace("", "");

        
       OMElement method = fac.createOMElement("calculateMean", omNs);
        
        OMElement arg1 = fac.createOMElement("a", argNM);
        
        arg1 =  getBinaryOfArray();

        
        method.addChild(arg1);
        
        envelope.getBody().addChild(method);
}
public OMElement getBinaryOfArray(){
        
        int[] a= new int[9];
        a[0]=9;
        a[1]=8;

        a[2]=6;
        XMLStreamReader arrayRead = BeanUtil.getPullParser(a);
        StreamWrapper parser = new StreamWrapper(arrayRead);
        StAXOMBuilder omBuilder =    
OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(), 
parser);

        OMElement arrayElement = omBuilder.getDocumentElement();
        
        return arrayElement;
}

However the above code doesnot invoke the required method. 

Can anybody help how to create a SOAPEnvelope for a client to call this service 
method.

Regards,

Sardar








 




      

Reply via email to