aspose file tools*
The moose likes Java in General and the fly likes currency conversion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "currency conversion" Watch "currency conversion" New topic
Author

currency conversion

Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Currently, we have an operator that goes to a currency conversion web page every morning to type in the days conversion rate ( U.S. --> Canadian dollars ). There has to be way to automate this by posting to the government web site or some other site for the conversion rate. How does everyone else update their conversion rates?
Java would be preferred, but all ideas are welcome.
Jamie
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I did a quick Google on "currency exchange rates xml" and found lots o hits. The first one:
http://www.oanda.com/channels/business/FXML.shtml
is a commercial service. Ya gotta pay. Looks like FXML is the standard, Google on that again for more.
This may quickly lead to your next question if you haven't done it before - how to consume XML web services!
[ May 16, 2003: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Originally posted by Stan James:
...This may quickly lead to your next question if you haven't done it before - how to consume XML web services!
Right on the money! Actually, if XML services are the only option, then I have no problem buying a book and learning. I'm more partial to a free service, but will pay if there are no reliable alternatives. I also don't limit myself to java, if anyone has any other java or non-java alternatives.
Jamie
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
You can find a WebService that provides this accurately and use it to check automatically. I found a couple, I don't know how accurate they are but, it quick and easy to test them:
http://www.xmethods.com/ve2/ViewListing.po%3Bjsessionid%3DBgbEY7AOqfXKPATnAxqbS-T0%28QCcd0CRM%29?serviceid=5
http://www.webservicex.net/WS/WSDetails.aspx?CATID=2&WSID=10
This one is actually a subsciption service so...
http://glkev.webs.innerhost.com/wswebclient/wsclients.aspx


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
Consuming a WebService from java is simple. I recommend Axis for this. See the docs on Cunsuming WebService. You can have these running in minutes!
http://cvs.apache.org/viewcvs.cgi/~checkout~/xml-axis/java/docs/user-guide.html
Actually the Reference guide might make it easier
http://cvs.apache.org/viewcvs.cgi/~checkout~/xml-axis/java/docs/reference.html
[ May 16, 2003: Message edited by: Carl Trusiak ]
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

OK, here's the skinny. This is supposed to be a small task. I think that learning SOAP, XML, AXIS, Web Services for this piddly little task might be overkill not to mention that we don't have a webserver, or any of that web jazz. The environment I work in only utilizes core Java, and some fringe network stuff like LDAP, and security, but nothing fancy.
I still believe that somewhere, someplace there is a core java URL/URLConnection that can do this.
Thanks for the suggestions, if I get time to pursue the above suggestions and technologies, I'll pick up a book and learn it. But at this point, I'd rather just leave the Operators to go to the website and manually enter this into the database.
Jamie
Jamie
[ May 16, 2003: Message edited by: Jamie Robertson ]
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1821

I would see if any of the services provide XML data streams. You could open up a java.net.URLConnection to the provider and obtain the XML data stream , parsing it with the javax.xml package.
I did just this to obtain real-time airline information for a limousine company who needed to see if thier clients' flights were delayed. (And thus could dispatch the drivers at a later time, so the drivers wern't waiting time waiting at the airport for a delayed flight...)


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Originally posted by Joel McNary:
I would see if any of the services provide XML data streams. You could open up a java.net.URLConnection to the provider and obtain the XML data stream , parsing it with the javax.xml package.
I did just this to obtain real-time airline information for a limousine company who needed to see if thier clients' flights were delayed. (And thus could dispatch the drivers at a later time, so the drivers wern't waiting time waiting at the airport for a delayed flight...)

This is what I was looking for. Just needed to know if it was possible. I'll have to contact some companies to see if this is possible. If anyone else has any leads or has done this before let me know of a service provider or such.
Anyone that wants to post the fully commented production worthy code do so right this instant because this is urgent, Urgent URGENTTTTTT! Just kidding, this can wait for awhile but the above is always welcome. Thanks again to all replies ( past and future )
Jamie
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
Originally posted by Jamie Robertson:
OK, here's the skinny. This is supposed to be a small task. I think that learning SOAP, XML, AXIS, Web Services for this piddly little task might be overkill not to mention that we don't have a webserver, or any of that web jazz. The environment I work in only utilizes core Java, and some fringe network stuff like LDAP, and security, but nothing fancy.

I really can't express how easy this is with Axis. The learning curve you will have to get a simple client up and running is small. You needn't worry about all the details at first. I could sit down tonight and have an operating interface to all of these in no more than 15 minutes! At that point, it's a matter of running each and testing against the values the clerk looks up to see which service provides the accuracy you need. The only thing you need to leatn first is wsdl2java. It will create the client side code for you, you simply instanciate it and make the method call.
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Frank, this is the problem:
From the Axis Docs -->
"See the Axis Installation Guide for instructions on installing Axis as a web application on your J2EE server." I don't have a J2EE server to work with, only a DBServer with internet access. I was thinking of running a batch job once every night, posting to a web site and parsing the result. From there I'd update the database.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: currency conversion