?
Solved

Calling WEB Services from VB

Posted on 2004-08-31
8
Medium Priority
?
386 Views
Last Modified: 2008-02-01
We have a VB 6  application running against 8.1.7.4 database and
PL/SQL stored procedures.  We'd like to call out to a web service from a VB form,
passing data to the web service and receiving data back based on the
input.
The web service provides a variety of geographic data (locality,
state,congressional district, etc.) based on the latitude and longitude
provided.
Given our environment,  how to accomplish this?  
0
Comment
Question by:kit992
[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
8 Comments
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 11949326
Yes you can do it, Web Services can be accessed from virtually any programing language. There's a standard way of doing it using SOAP Toolkit, search the net/msdn you'll get enough of it.

Another simple way of doing it through vb6 is something which I like this method might not be very versatile but if it solves your purpose...

well a web service returns information formatted in xml so all we need is a way to process this xml and a way to call the service and in VB6 MSXML does this for you.

Add a Reference to Microsoft MSXML then

Dim oDom as MSXML2.DOMDocument
Dim oHTTP as MSXML2.ServerXMLHTTP

Set oDom = New MSXML2.DOMDocument
Set oHTTP = New MSXML2.ServerXMLHTTP

Dim URL as String
URL="http://yoursite.com/yourwebservice.asmx?YourFunction?FristArgName=value&SecondArgName=value"

oHTTP.SetTimeouts 5000,5000,15000,15000
oHTTP.Open "GET", URL, False

oDOM.LoadXML oHTTP.ResponseText

'Now we have the DOM get the return values from it and process it as you like

'This method requires that you know in advance the function/argument names etc. also that you analyze the returned xml and devise a method to get the return values from it

0
 

Author Comment

by:kit992
ID: 11955887
The problem is our client PC don't have SOAP toolkit installed. Can we install SOAP toolkit with our application or can we create the "exe" file with SOAP toolkit libraries, so client doesn't need to install toolkit separately.
We don't have administrative privileges on our client's PC. Thanks for the reply.
0
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 11960242
well you can do that, you need not have anything to do with the client machine, your installable will do it all.

Also why don't you try the MSXML option that's also good...

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:kit992
ID: 11964857
What software do you use to install all components on the client machine(my application+SOAP toolkit)?
Can you give an example how to do it in MSXML? I think that you need SOAP toolkit to contact WebServices, so we have to use it.
  What do you mean by use MSXML? Is that so we get the results back from WebServer as an XML message, and we strip out all XML tags to get the information we need? Is that why you refer MSXML?
The problem we are having is that we cannot install SOAP toolkit on the client machine, since it requires administration privilegies. Other problem we have is that we don't know how to package SOAP toolkit and our application together as a stand-alone install package.
Thanks.
0
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 11970212
You are right by referring to MSXML I mean that since we get the results back from the web server in xml we can strip as you said the xml tags and get the results, I had posted an example earlier I am re-pasting it here


Add a Reference to Microsoft MSXML then


Dim oDom as MSXML2.DOMDocument
Dim oHTTP as MSXML2.ServerXMLHTTP

Set oDom = New MSXML2.DOMDocument
Set oHTTP = New MSXML2.ServerXMLHTTP

Dim URL as String
URL="http://yoursite.com/yourwebservice.asmx?YourFunction?FristArgName=value&SecondArgName=value"

'Here you can pass function arguments in form of QueryStrings

oHTTP.SetTimeouts 5000,5000,15000,15000
oHTTP.Open "GET", URL, False

oDOM.LoadXML oHTTP.ResponseText

'Now This oDOM variable contains the returned xml in a DOM object
'you can move to the required node and extract the results.

0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12561052
PAQed with no points refunded (of 125) %%STAMP%%

Computer101
EE Admin
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

762 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