|
Hi, Sorry all, I am really at my wits end… look thru
everywhere but just can’t seems to find my
answers… I am trying to get a SOAP response that
have more than 1 type. Instead of a normal <getQuoteReturn
xsi:type="xsd:float">49.3</getQuoteReturn>, I want to get <getQuoteReturn
xsi:type=”xsd:state”><ID>123</ID><Value>0</Value></getQuoteReturn> I quote the example getStockQuote. This is the request:-> ======================================================================== <?xml
version="1.0" encoding="utf-8"?> <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <ns1:getQuote
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="urn:xmltoday-delayed-quotes"> <symbol xsi:type="xsd:string">c</symbol>
</ns1:getQuote> </soapenv:Body> </soapenv:Envelope> ======================================================================== This is the response:-> ======================================================================== <?xml
version="1.0" encoding="UTF-8"?> <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body>
<ns1:getQuoteResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="urn:xmltoday-delayed-quotes"> <getQuoteReturn xsi:type="xsd:float">49.3</getQuoteReturn>
</ns1:getQuoteResponse> </soapenv:Body> </soapenv:Envelope> ======================================================================== the code to
retrieve the returntype ‘float’ is below:
call.setTargetEndpointAddress( url );
call.setOperationName( new QName("urn:xmltoday-delayed-quotes", "getQuote") );
call.addParameter( "symbol", XMLType.XSD_STRING,
ParameterMode.IN );
call.setReturnType( XMLType.XSD_FLOAT );
// TESTING HACK BY ROBJ
if (symbol.equals("XXX_noaction")) {
symbol = "XXX";
}
call.setUsername( user );
call.setPassword( passwd );
Object ret = call.invoke( new Object[] {symbol} ); To retrieve the ‘state’ as what is required,
how to I set the setReturnType? Do I do this:- QName stateQN = new QName(
"WSG-interface", "State" ); call.setTargetEndpointAddress( url ); call.setOperationName( new QName("WSG-interface",
"ReadBalanceRequest") ); call.addParameter( "MSN", XMLType.XSD_STRING,
ParameterMode.IN ); call.addParameter( "State", stateQN, ParameterMode.OUT ); call.setReturnType( stateQN ); Object
ret = call.invoke( new Object[] {MSN} ); if (ret instanceof String) { System.out.println("Received problem response from server: "+ret); throw new AxisFault("",
(String)ret, null, null); } //stateQN = (QName) ret; state = (State) ret; status = state.getID(); appreciate whatever
help provided. thanks, Jeff. |
- Return Type Jeffrey Ng
- Re: Return Type Davanum Srinivas
- RE: Return Type Jeffrey Ng
- Re: Return Type Anne Thomas Manes
