Shiv Kumar
 Hobbyist Filmmaker / Editor

Building WebService Clients By Hand

555551votes
January 22, 2008 10:45 AM  Views: 2564   Favorited: 0 Favorite It Comments: 6
Filed Under:  Programming
Tags:  Delphi, SOAP, WebServices
 
This tutorial is for Delphi 5 (Pro and Enterprise) as well as Delphi 6 (Pro and Enterprise) users. This Tutorial does not use, or show you how to build WebService clients using the Delphi 6 SOAP framework. Instead, this tutorial is intended for those wanting to have a firmer understanding of SOAP/WebServices as well as show Delphi 5 and Delphi 6 Pro users, how they can build WebService Clients using the tools they've got.

Having a framework to do all the grunt work for you is great. It saves you a lot of time, hides things from you that you don't need or want to know and brings the fun back into programming. But if you're like me, then you want to do the grunt work initially, so you can get your hands dirty and begin to understand the underpinnings of a certain technology.

Actually doing the work gives you a far better understanding and also surfaces the "facts" and "half-truths" about a certain technology. Further, having actually done it by hand, gives you a better insight into the technology in question. So rub your hands together and get ready for the fun that lies ahead.

The WebService client that we are about to build is a generic SOAP Client. Currently, it can handle WebServices that have one method and expect none or one parameter. Examples of such WebServices are:

  1. WhoIS
  2. Shakespearean Insult Generator
  3. Kazoo Training Classes
  4. WordFind
  5. FedEx Tracker
  6. Delayed Stock Quote
  7. Domain Name Checker
These are just some that I have tested. The "result" can be seen in the SOAP Response Page. Generally, the <result> element contains the result.

What will you need to build this project

  1. Delphi 5 Pro/Enterprise or Delphi 6 Pro/Enterprise
  2. Microsoft SOAP toolkit 2.0 Gold Release
  3. Indy version 8.0

What will you have learnt by the end

Yes, that's a good question. I mean, what's the point in all the work you're about to do right?
  1. You'll learn how to use the Microsoft DOM Parser, to build and parse XML Documents
  2. You'll learn how to use the Indy TIdHTTP component
  3. You'll learn about WSDL Files and how to "read" them
  4. You'll learn about the SOAP protocol
  5. You'll learn how to use the I.E. ActiveX Browser control
This tutorial, does not expect you to use the Microsoft SOAP toolkit, but rather only use the DOM Parser. If you are familiar with another XML parser, then feel free to use this parser instead. You'll have to make the necessary changes to your code however.

Importing the MSXML type library

After you've downloaded the Microsoft SOAP Toolkit, you need to import the type library using the Delphi IDE.
Step 1 Step 2 - Select the Library and Click Create Unit Step 3 - You should see the file in the Editor - Save it

Let the games begin

This tutorial is not yet complete, but the project source files are available for download at the end of this article.


Image1 - The First Step - Get the URL to a WSDL File


Image2 - Enter the URL for the WSDL File


Image3 - Clicking on the Get WSDL Button retrieves the WSDL File, Parses it and populates the fields


Image4 - If the WebService Method Requires a Parameter, then Enter a Valid Value


Image5 - Clicking on the Make SOAP Request Button Executes the SOAP method


Image6 - The SOAP Request that was sent to the WebService


Image7 - The SOAP Response that came back from the WebService

Comments have been Disabled for this post





Leave A Comment

Shiv Kumar
Gainesville, Virginia,
United States
Member Bio Member Skills/Specialization

Bio

close

Specializations

close
Photographer
Landscape
Nature
Portrait
Videographer/Cinematographer
Interview
Landscape
Nature
Portrait
 
Privacy Policy | Terms Of Service | Contact Us | Support | Help/FAQ | News