SOAPTypeMappingRegistry.XSD_STRING);
sd.addOutputParam("Result",
SOAPTypeMappingRegistry.XSD_STRING);
sd.addOutputParam("return",
SOAPTypeMappingRegistry.XSD_STRING);
ServiceClient call = new ServiceClient(new HTTPTransport());
call.set(HTTPTransport.URL, serverURL);
call.set(HTTPTransport.ACTION, "http://www.soapinterop.org/Buy");
// register the PurchaseOrder class
QName poqn = new QName("http://www.soapinterop.org/Bid",
"PurchaseOrder");
Class cls = PurchaseOrder.class;
call.addSerializer(cls, poqn, new BeanSerializer(cls));
call.addDeserializerFactory(poqn, cls, BeanSerializer.getFactory());
// register the Address class
QName aqn = new QName("http://www.soapinterop.org/Bid", "Address");
cls = Address.class;
call.addSerializer(cls, aqn, new BeanSerializer(cls));
call.addDeserializerFactory(aqn, cls, BeanSerializer.getFactory());
// register the LineItem class
QName liqn = new QName("http://www.soapinterop.org/Bid", "LineItem");
cls = LineItem.class;
call.addSerializer(cls, liqn, new BeanSerializer(cls));
call.addDeserializerFactory(liqn, cls, BeanSerializer.getFactory());
LineItem[] lineItems = new LineItem[numItems];
for ( i = 0 ; i < numItems ; i++ )
lineItems[i] = new LineItem("Widget"+i,quantity,new BigDecimal(price));
PurchaseOrder po = new PurchaseOrder( "PO1",
new Date(),
new Address("Mr Big",
"40 Wildwood Lane",
"Weston",
"CT",
"06883"),
new Address("Mr Big's Dad",
"40 Wildwood Lane",
"Weston",
"CT",
"06883"),
lineItems );
RPCElement body = new RPCElement( "http://www.soapinterop.org/Bid",
"Buy",
new RPCParam[]{
new RPCParam("PO",
po)} );
String res = (String) call.invoke( body );
return( res );
}
catch( Exception e ) {
e.printStackTrace();
throw e ;