axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sardar Hussain <salarzi_...@yahoo.com>
Subject [Axis2] Axis2 SOAP Request having array of integers
Date Sat, 12 Feb 2011 00:44:15 GMT
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



      
Mime
View raw message