[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Fetching XML for exchange rates into HTTPAPI/EXAMPLE18



And just a followup. The web page appears to be a very poor way of getting
this information. Much parsing of data to find the information you need and
create the "session ID" they seem to be passing. And multiple "screens" to
work through to get there.

If you contact the bank, I'd bet they could give you a friendlier way to
retrieve this information. More like a web service or at least a one step
html==>xml page to get it.

I did try an experiment. Take the xml page url and try it from different IPs
to see if you get the same or different data.  My USD conversion looked like
this: http://www.bankofcanada.ca/databank/client_output/9822.xml  I had
someone else try it (to make sure it wasn't linked to my workstation) and it
seemed to work for them as well. Maybe the 9822.xml page is always the USD
conversion? If that is the case, find the URL of conversion you'd like to do
and look at example15 for how to parse the xml file. Before using it for
production, I'd verify with the bank that is how it works.

Mike  

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Monday, July 02, 2007 1:26 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: Fetching XML for exchange rates into HTTPAPI/EXAMPLE18

Hello Mo Khan,

> I know that the program LIBHTTP/EXAMPLE18 calls the currency exchange 
> rate web service provided by WebserviceX.net but rates does not seem 
> consistent with other financial websites.

With all due respect, this has nothing to do with HTTPAPI.  If you think
WebserviceX.net is posting incorrect exchange rates, then complain to 
WebserviceX.net.   HTTPAPI only retrieves them.

HTTPAPI only provides a communication mechanism.  It lets data on an HTTP
server be copied to your system.  It doesn't know or care what that data is.
It has no control over whether the data on that web site is right or wrong.

Consider an analogy:  I'm done working for the day, so I call my wife to ask
her what's for dinner.  She says "chicken."  I drive home, and it turns out,
she made meatloaf instead.  Is there a problem with my telephone?  Should I
complain to the phone company?  After all, my telephone told me we were
having chicken, and it turned out to be 
meatloaf!!   NO.  OF COURSE NOT.   It's not the phone that's wrong.  The 
phone did what it was supposed to -- it let me communicate with my wife. 
  It's my wife's fault that she said the wrong thing.

Same is true with the exchange rates.  HTTPAPI is just copying the data from
WebserviceX.net to your computer.  That's it's job.  It's not HTTPAPI's
fault if that data is wrong, it's WebserviceX.net's fault!


> I read the HTTP POST and GET, and also the XML but did not find any 
> link to any website e.g Forex.com or www.wallstreetjournal.com where 
> they actually post the rates. Where these rates are coming from in 
> program EXAMPLE18?

They're coming from WebserviceX.net.


> On [1]http://www.webservicex.net/WCF/ServiceDetails.aspx?SID=18,
> if a test for currency conversion is invoked (fill out 
> FromCurrency/ToCurrency and hit Invoke button), it gives out an XML 
> page (see
> [2]http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate>
e)
> 
> Even that does not show the actual source for exchange rates.

Again... you don't like the way webservicex.net provides exchange rates,
don't use them.  Use something else, or complain to webservicex.net.

>     3. I am working to get exchange rates from website
>        [3]http://www.bankofcanada.ca/en/rates/exchange-look.html

Okay... that's not a web service.  That's a regular web page.


>    I modified and successfully compiled the program EXAMPLE18 with this
>    new website but getting an error when calling the EXAMPLE18
> 
>    XML parse failed at line 6, col 309: not well-formed (invalid 
> token)

That's because the web site is returning HTML, and the parser is an XML
parser!

That site isn't a web service.  You can try to use HTTPAPI to get the data
if you like, but the program logic will be very different from what's in
EXAMPLE18.
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------