Vb6 soap web



Keywords: vb6 soap web
Description: This article shows you how to create a client that calls a web service from Visual Basic 6 using SOAP 3.0. If you are still using VB 6.0 or C++ and don’t plan to move into VB.NET, you will

This article shows you how to create a client that calls a web service from Visual Basic 6 using SOAP 3.0. If you are still using VB 6.0 or C++ and don’t plan to move into VB.NET, you will find this method very useful.

In an earlier article the method of calling a web service from a client created using Microsoft Visual Studio 2003 IDE was described. The IDE offers an excellent method to get a reference to the necessary proxy by way of the WSDL utility. This is carried out by adding a web reference to the client application.

This article shows how you may create a client that calls the web service from Visual Basic 6 using Soap 3.0. By providing Soap 3.0, Microsoft provides VB programmers with the ability to tap web services. This is most useful to those who are still using VB 6.0 or C++ and are not contemplating a move into VB.NET.

This tutorial assumes that web services have been created using any of the programming languages and that a wsdl web reference is available. In particular it creates clients for the web services created using the ColdFusion service with just one method, and another web service using VB.NET with two methods. Examples of early binding and late binding are also shown for the web service created with ColdFusion.

SOAP, which stands for Simple Object Access Protocol, is a vendor- and platform-agnostic protocol which uses XML and HTTP (SOAP Specification 1.0) to access resources (servers, services and objects) through firewalls in a distributed environment. Later SOAP specifications do not mandate the use of HTTP, and other protocols such as SMTP and FTP can also be used. Please review SOAP and other related protocols at the W3C website and numerous other links at that site.

The following are the web services for which client applications call the services using VB 6.0 code. Herein two of the services considered in earlier tutorials will be used.

The first service to be called is a web service created using ColdFusion. The details of this service are described in a tutorial that will appear in the future in DevArticles.com with the title Creating a Web Service with ColdFusion: the Basics. In brief, a registered CFC (ColdFusion Component) which is based on a ColdFusion function shown below is implemented as the web service:

In the above service the web service method name is WelcomeMsg(). It just takes one argument, which is a string. The service will return a html fragment after processing and adding some tags.

The first thing to do is create a standard EXE project. In this case a generic client is declared, and this is set using the CreateObject() function with the object Id being the MSSoapClient.

Add a text box and a command button to your form. To the click event of the command button add the following code. This is the case of late binding, as no type library is referenced. You may check that in the object browser.

It is assumed that you have the service hosted on the localhost at the designated directory. Make sure that your web reference is showing a valid WSDL. The question is, how does one know that the client has a method called WelcomeMsg()? This is where the WSDL can be used to advantage as it will show both the request sent and the responses expected, as well as the methods called. Please review earlier tutorials.

In this example the same web service is called, but with the New construct. In order to use SOAP 3.0 with this method, you should access the Microsoft SOAP Type Library 3.0. which adds the MSSOAP30.dll (the version used in this tutorial is 3.0.1325.0). You can access this by going to Project–>References from the main menu. If you do not see this, then you will have to download it from the Microsoft website. It is also installed with Office 2003 (Office 11). Sometimes you may have to browse if it is located in another path with the Browse… button.

With the type library added you can access the various objects, methods and events in the object browser as shown. It has many classes as shown here, of which the class of interest at present is the SoapClient30 .

If you forgot to add this reference and tried to run the code, you would get a compiler error message as follows:

To form1 of a new project, add a button and a text box after adding the reference. Now review the code for calling the service shown below, added to the click event.

Because you have established a reference you get the advantage of intellisense, and as you type in the code you get the cue to the appropriate property, method, or event to choose. Now if you execute the above code, you get the same kind of reply as before, since nothing else has changed.

The second web service considered is a service that has two defined methods. The service takes a string and returns its encoded value as the first method (Enc() ) and the second method (denc() ) takes a given value and returns its de-encoded value. Please review this tutorial regarding this service. The web service code is created using VB.NET and summarized in the following code listing:

Create a project and a command button to the default form. To the click event of the button add the code shown here. The client once declared can be used for all the methods the service provides.

If you run the above code, you will first get an encoded value, and in the second message your original is recovered as shown.

SOAP 3.0 will be used by those who cannot afford, or do not want to implement, the .NET framework as the programming backbone. It is also quite useful to those developers who want to use their VB 6 skills. The method does not have the excellent support of the built-in web service discovery tool in VS 2003, but necessary information may be obtained from the web reference (WSDL). It is possible to use either of the CreateObject() or NEW instantiation schemes.






Photogallery Vb6 soap web:


Programming web services with soap


Programming web services with soap


Programming web services with soap


Using the Office Web Components to create dynamic charts


visual-basic-2005-database- ...


Visual basic 2005 database programming 2006


La presentacin ".NET para Programadores Java Angel Java Lopez ...


Colabora.NET: Cmo comunicar sistemas basados en .NET y otras ...


Prezentacja "VB.NET Maria DEMS. 2 Podstawy Visual Basic.NET Visual ...


Msdn forums - Visual Basic Language


Visual basic 2005 database programming 2006


JBoss SOAP Web Services User Guide


SSW Rules to Better VB6 Migration to .NET


JBoss SOAP Web Services User Guide


JBoss SOAP Web Services User Guide


Buy Now - Order VB 6,Visual Studio .Net Sonic ActiveX Products


VB6 Migration


26.PNG


Visual basic 2005 database programming 2006