Bump

On 6 September 2011 19:13, David Mitchell <[email protected]> wrote:

> Hello all,
>
> I'm looking at using web2py to build a SOAP service to work as a test
> harness for an infrastructure upgrade we're planning.  Unfortunately, all
> the web2py SOAP info I've found has been trivial services such as adding 2
> numbers together - in my case, I need my SOAP server to be able to do
> something more complicated.
>
> The sort of complexity I need to build is something like
> http://www.webservicex.com/stockquote.asmx?WSDL
> When I query this service from suds, the code looks something like:
> >>> import suds
> >>> url = 'http://www.webservicex.com/stockquote.asmx?WSDL'
> >>> client = suds.client.Client(url)
> >>> print client
>
> Suds ( https://fedorahosted.org/suds/ )  version: 0.4 GA  build:
> R699-20100913
>
> Service ( StockQuote ) tns="http://www.webserviceX.NET/";
>    Prefixes (0)
>    Ports (2):
>       (StockQuoteSoap)
>          Methods (1):
>             GetQuote(xs:string symbol, )
>          Types (0):
>       (StockQuoteSoap12)
>          Methods (1):
>             GetQuote(xs:string symbol, )
>          Types (0):
>
>
> >>> client.service.GetQuote('IBM')
> <StockQuotes><Stock><Symbol>IBM</Symbol><Last>166.98</Last><Date>9/2/2011</Date><Time>4:00pm</Time><Change>0.00</Change><Open>N/A</Open><High>N/A</High><Low>N/A</Low><Volume>200</Volume><MktCap>199.4B</MktCap><PreviousClose>166.98</PreviousClose><PercentageChange>0.00%</PercentageChange><AnnRange>125.39
> - 185.63</AnnRange><Earns>12.315</Earns><P-E>13.56</P-E><Name>International
> Bus</Name></Stock></StockQuotes>
> >>>
>
>
> I figure my web2py controller code to do this would look something like:
>
> from gluon.tools import Service
> service = Service(globals())
>
> @service.soap('GetQuote', returns={SOMETHING_HERE}, args={'symbol':str})
> def stock_quote(stock):
>     "Return stock quote info - everything is hardcoded..."
>     symbol = "IBM"
>     last = 166.98
>     date = '9/2/2011'
>     quote_time = '4:00pm'
>     change = 0.00
>     #...
>     return SOMETHING_HERE
>
> def call():
>     return service()
>
>
> I'm trying to work out what the 2 SOMETHING_HERE pieces should look like in
> the above code.
>
> Could someone please point me in the right direction?
>
> Thanks in advance
>
> Dave M.
>

Reply via email to