开发者

Can i send multiple values into this web service request

here is the WSDL http://www.webservicex.net/stockquote.asmx?WSDL

I'm trying to get more than 1 stock in response. Is it possible in this web service?

The web service requires 1 parameter, which is Symbol. So my code for inserting 1 symbol is

$wsdl = "http://www.webservicex.net/stockquote.asmx?WSDL"; // the wsdl

$client = new S开发者_如何转开发oapClient($wsdl);

$quote = $client->GetQuote((object)array('symbol'=>'SPY'));

var_dump($quote);

echo $quote->GetQuoteResult . "<br />";

I get the following response which is correct

<StockQuotes><Stock><Symbol>SPY</Symbol><Last>133.51</Last><Date>5/27/2011</Date><Time>4:00pm</Time><Change>+0.51</Change><Open>133.37</Open><High>133.87</High><Low>132.9588</Low><Volume>120921856</Volume><MktCap>N/A</MktCap><PreviousClose>133.00</PreviousClose><PercentageChange>+0.38%</PercentageChange><AnnRange>101.13 - 137.18</AnnRange><Earns>0.00</Earns><P-E>N/A</P-E><Name>SPDR S&P 500</Name></Stock></StockQuotes><br />

How could i get for example the info of 3 tickers in a single request? For example the tickers are SPY, ^NZ50 and QQQ? I have tried different solutions, for example $quote = $client->GetQuote((object)array('symbol'=>'^NZ50', 'symbol'=>'QQQ', 'symbol'=>'SPY')); I get same XML with last element - SPY ticker info.

With this one $quote = $client->GetQuote((object)array('symbol'=>'^NZ50','QQQ','SPY')); i get only first ticker NZ50.

Is it even possible in this web service get response with more than 1 tickers info? How should i forge the input?

Here is the GetQuoteSoapIn element

<s:element name="GetQuote">

<s:complexType> <s:sequence>

<s:element minOccurs="0" maxOccurs="1" name="symbol" type="s:string"/>

</s:sequence>

</s:complexType>

</s:element>

And GetQuoteHttpGetIn

<wsdl:message name="GetQuoteHttpGetIn">

<wsdl:partname="symbol" type="s:string"/>

</wsdl:message>


Try doing this:

array('symbol'=>'^NZ50, QQQ, SPY')

Based on the usage here if you enter ^NZ50, QQQ, SPY (separated by commas with spaces - not ^NZ50,QQQ,SPY) it returns an XML response with the <symbol> data for the 3.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜