GoDB Developer Network
Monday, December 12, 2005
  Using Web Services with GBasic (GoDB)
This article shall peep into invoking a webservice from the internet through GoDB. Iam using HTTPDNLD file and XML commands of GoDB.

The application takes the input of a host name and queries a WHOIS server through webservices and gets the detailed information.

For this, I am using http://www.webservicex.net . You can use other WHOIS server though.

Configuring the proxy:

for those having a proxy, you need to configure first before using the application. To go to Configuration screen (inbuilt with GoDB) press Function key 9 (F9). Fillin only the 'ProxyIP' field with your Proxy server. Leave other fields. Click 'save' and 'Go Home'



















Querying the web:


the httpdnld command sends a http request with a host name as the parameter to a webservice. The webservice inturn queries a whois server and sends the result back. The result is saved in a file called test.xml



path$=http://www.webservicex.net/whois.asmx/GetWhoIS?HostName=+trim$(#txtName$)
RET=HTTPDNLD(path$,"","TEST.XML",1)
if RET=-3 then
msgbox "unable to get file"
endif

Parsing the XML:

Now, having created a XML file, we need to parse and display the content in the application for view. Since, the parse is inbuilt in GoDB, my work is much reduced- precisely four lines.

h=XMLParseFile("TEST.XML",1)

if ret>0 then
ret= XMLGoToFirst(h)
while XMLFetch(h,"")=1
str$=str$+ xvalue$(h)
pprint xpath$(h) ; xvalue$(h)

wend
endif

ret=XMLClose(h)
#txtRes$=str$



Overall, if you see, I put up a simple form to enter the host name, a button to query the web and a text area to print the queried results. I stored the data in XML format, parsed it and and displayed in the text area. A variance can be, instead of saving it in XML format, we can also save the same in .txt format and display.



HTTPDOWNLOAD.ZIP
 
Comments:
Hi!
The webserive is not working at all with any of the hostname.
Insted of this We can use the webservice :
http://www.webservicex.net/RealTimeMarketData.asmx/Quote?Symbol=IBM
which returns the stock quote of IBM
--Lalit Kale.
 
If you are crazy about sony ericsson phones then please visit this page - p910i freeware
 
Great blog! More info about barcode - http://barcode.usbizsys.com/clei-barcode-generator.html
 
http://tramadol-best5.blogspot.com/
Good Luck!
 
NSU - 4efer, 5210 - rulez

 
very nice post
 
Post a Comment

Links to this post:

Create a Link



<< Home
Welcome to the unofficial GoDB Developer Network. This blog is completely dedicated to GoDB platform -- a multi platform Mobile RAD tool for developing handheld and wireless applications for Windows Mobile (Pocket PC,Win CE, Smartphones), Palm, Symbian, Embedded Linux, Linux, Win 32, etc. Fellow GoDB developers can find sample codes, contribute to the blog and Mobility related news for the benefit of the mobile development community as a whole.

ARCHIVES
2005-11-20 / 2005-11-27 / 2005-12-04 / 2005-12-11 / 2006-11-05 /


Powered by Blogger