URL url = new URL("http://mindstrm.com:8004/glue/urn:CorpDataServices");
SOAPMappingRegistry smr = new SOAPMappingRegistry();
BeanSerializer beanSer = new BeanSerializer();
smr.mapTypes(Constants.NS_URI_SOAP_ENC,
new QName("http://www.themindelectric.com/package/javasoap.book.ch9.services/",
"Quote"),
RemoteQuote.class, beanSer, beanSer);
Call call = new Call();
call.setSOAPMappingRegistry(smr);
call.setTargetObjectURI("XYZ");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
String stock = symbol;
Vector params = new Vector();
params.addElement(new Parameter("stock", String.class,
stock, null));
call.setParams(params);
call.setMethodName("getQuote");
Response resp = call.invoke(url, "");
ProxyQuote quote = new ProxyQuote();
if (resp.generatedFault()) {
throw new Exception("Service Call Failed");
}
else {
Parameter ret = resp.getReturnValue();
RemoteQuote value = (RemoteQuote)ret.getValue();
quote.setStockSymbol(value.get_symbol());
quote.setLast(value.get_lastPrice());
quote.setDiff(value.get_change());
quote.setTime(value.get_timeStamp());
quote.setVol(value.get_volume());
}
return quote;