Solved

Calling WEB Services from VB

Posted on 2004-08-31
8
384 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

690 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