You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Hardik Sanghvi <ha...@www.com> on 2001/04/26 20:39:25 UTC
How to read an array?
I have passed an array from the client. And it gives and error when I try to process it on the server
Here is the client code ...
Vector params = new Vector();
int [] ar = {1,2};
params.addElement( new Parameter( "pages", int[].class, ar , null ) );
params.addElement( new Parameter( "color", boolean.class,new Boolean(true), null ) );
call.setParams( params );
Here is the corresponding SOAP envelope ...
<SOAP-ENV:Body><ns1:getRate xmlns:ns1="urn:eCopy" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><pages xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Array" ns2:arrayType="xsd:int[2]"><item xsi:type="xsd:int">1</item><item xsi:type="xsd:int">2</item></pages><color xsi:type="xsd:boolean">true</color></ns1:getRate></SOAP-ENV:Body>
And here is the service code ...
public float getRate( int [] pages, boolean color )
{
if (color) {
System.out.println("Here");
return new Float(pages[0]*0.50).floatValue();
} else {
System.out.println("tHere");
return new Float(pages[1]*0.78).floatValue();
}
}
Please help,
Thanks,
Hardik
------------------------------------------------------------
WWW.COM - Where the Web Begins! http://www.www.com
- - - - - - - - - - - - - - - - - - - - - - - - - - advertisement - - - - - -
Limited Time Offer: FREE Products! Pay only shipping and handling.
Get FREE Software, CDR's, Cellular Accessories, Videos, DVD's, Music,
Injet Refills and much more.
Only when you click here now - - > http://www.free-irewards.com/cgi-bin/bmb2