Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Nov 23, 2017 9:08 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Web Services
PostPosted: Sat Feb 16, 2013 7:18 am 
Offline

Joined: Thu Dec 22, 2005 9:58 am
Posts: 68
I've been out of the networking game for a while. I would like to write a simple get stock quote RB program, but it seems SOAP is not used as much as before, and I can't find any stock quote web services. So without sounding to naive...do I use REST, JSON, or am I just not finding a proper SOAP service?

If I am to use JSON, is it available in the non PRO version of RB?

Any sample code would be great

And I am in Canada, so I would need to look up CDN mutual fund quotes.
I would also like to get Silver and Gold, as well as oil quotes.

It will be a custom app for me only

Thanks to all


Top
 Profile  
Reply with quote  
 Post subject: Re: Web Services
PostPosted: Sat Feb 16, 2013 10:20 am 
Offline

Joined: Tue Oct 04, 2005 10:55 am
Posts: 43
Location: Fort Myers, FL
JSON is probably the way to go; it's available in all versions (as far as I know).

I'd suggest checking out YQL:
http://developer.yahoo.com/yql/

If you can find reasonable data sources for what you need, YQL can help you turn them into data (JSON or another format) that you can consume.


Top
 Profile  
Reply with quote  
 Post subject: Re: Web Services
PostPosted: Mon Feb 18, 2013 2:33 pm 
Offline
User avatar

Joined: Sun Feb 20, 2011 1:05 pm
Posts: 6
Location: Boston, MA
I've been trying to learn about this as well. This stock quote service was working up until a few days ago then it broke:

http://www.webservicex.net/stockquote.asmx?op=GetQuote

Now it's erroring with a disk full error of some sort.

Instead I've been working with getting weather by zip code. Don't know if this will work in Canada?

http://wsf.cdyne.com/WeatherWS/Weather.asmx

Here's some code. Type a zip code into an edit field it will get the weather, parse the xml, and post the result to a list box.

dim vXML, answerString, newRow as string
dim hsock as new HTTPSocket

txtTextOutput.Visible=false
lbXMLOutput.Visible=true

vXML = "<?xml version=""1.0"" encoding=""utf-16""?>"
vXML = vXML + "<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">"
vXML = vXML + "<soap:Body>"
vXML = vXML + "<ns1:GetCityWeatherByZIP xmlns:ns1=""http://ws.cdyne.com/WeatherWS/"">"
vXML = vXML + "<ns1:ZIP>"+edfTextEntry.Text+"</ns1:ZIP>"
vXML = vXML + "</ns1:GetCityWeatherByZIP>"
vXML = vXML + "</soap:Body>"
vXML = vXML + "</soap:Envelope>"

// HTTPSocket version
hsock = new HTTPSocket
hsock.yield = false
hsock.SetRequestContent vXML, "text/xml"
answerString=hsock.post("http://wsf.cdyne.com/WeatherWS/Weather.asmx", 10)

Dim x As New XmlDocument(answerString)
// check first node of document:
Dim n As XmlNode = x.FirstChild
// and now walk over all sub nodes, just the data sub nodes which are deep
Dim childNode As XmlNode = n.FirstChild.FirstChild.FirstChild.FirstChild 'data is 4 nodes deep
lbXMLOutput.DeleteAllRows
While childNode <> Nil
If childNode.PreviousSibling <> Nil and childNode.PreviousSibling.Name="Pressure" then
exit
else
newRow = childNode.Name + ": " + childNode.FirstChild.Value
lbXMLOutput.addrow(newRow)
childNode = childNode.NextSibling
end if
Wend

_________________
Next Generation Solutions | http://www.nxgnsol.com | 617-539-6050


Top
 Profile  
Reply with quote  
 Post subject: Re: Web Services
PostPosted: Mon Feb 18, 2013 3:01 pm 
Offline

Joined: Thu Dec 22, 2005 9:58 am
Posts: 68
Ok, Duane, thanks for the code snippet. I will have a look at it. I've done simple app that uses SOAP for weather as well. You punch in the airport code

Thanks again


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group