[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

VB6 - Call WebService

Posted on 2014-03-18
5
Medium Priority
?
620 Views
Last Modified: 2014-03-24
Good Day Experts!

I am challenged today with 1) working in VB6 and 2) running a WebService

I have looked around on the net how to call a WebService but I am not sure what is needed since I have never done this before.  

The WebService takes in a start currency and a converted to currency.  

http://www.webservicex.net/CurrencyConvertor.asmx?op=ConversionRate

Can you help with references that may help me achieve this and give back the exchange rate?

Thanks,
jimbo99999
0
Comment
Question by:Jimbo99999
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 39939779
according to the above output, you don't need to do anything special, as you are allowed to do a plain http get version:
http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=USD&ToCurrency=EUR
which returns this (xml):
<double>0.7189</double>

which would be as simple as this:
Dim obj As MSXML2.ServerXMLHTTP
Set obj = New MSXML2.ServerXMLHTTP
obj.open "GET", "http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=USD&ToCurrency=EUR"
obj.send

If obj.Status >= 400 And obj.Status <= 599 Then
  Debug.Print "Error Occurred : " & obj.Status & " - " & obj.statusText
Else
  Debug.Print obj.ResponseText
End If 

Open in new window


the webservice methods are a bit more complex, but why if you have the simple version :)
0
 

Author Comment

by:Jimbo99999
ID: 39946205
Thanks you for the help.  There have been sooo many projects here.  I will get back to this one on Monday.

Much appreciated,
jimbo99999
0
 

Author Comment

by:Jimbo99999
ID: 39950512
Good Day!

When I try this, I am gertting an error message "Compile error: User-defined type not defined".  It appears to not like the line "Dim obj as MSXXML2.ServerXMLHTTP"

Do I need ot make a proprerty setting or add anything somewhere in the project?

Thanks,
jimbo99999
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39950541
you have to add the XML in the Project references... not sure any more how it was called, but someing like "MS XML 3.0" or "... 4.0" ...
0
 

Author Comment

by:Jimbo99999
ID: 39950565
I made a little adjustment and it is working now!

Set obj = CreateObject("MSXML2.ServerXMLHTTP")

This is great...now just have to parse out the answere from the Response.Text.

Thanks for the help,
jimbo9999
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question