Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Calling WEB Services from VB

Posted on 2004-08-31
8
Medium Priority
?
389 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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

647 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