Solved

Calling WEB Services from VB

Posted on 2004-08-31
8
378 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
  • 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 Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now