Home arrow Delphi-Kylix arrow Page 4 - Creating a Web Service Client with Delphi
DELPHI-KYLIX

Creating a Web Service Client with Delphi


In this article, the second of three parts covering web services, we will build a web service client and discuss the various components and methods needed to make an application work.

Author Info:
By: Leidago
Rating: 5 stars5 stars5 stars5 stars5 stars / 31
October 30, 2006
TABLE OF CONTENTS:
  1. · Creating a Web Service Client with Delphi
  2. · Code Listing
  3. · The application
  4. · Behind the scenes

print this article
SEARCH DEVARTICLES

Creating a Web Service Client with Delphi - Behind the scenes
(Page 4 of 4 )

So what is happening behind the scenes when you execute the code? Well, the HTTPRIO component creates a SOAP envelop and sends this off to the web service server, which in turn processes the message and returns an appropriate response. The messages, both outgoing and incoming, are in XML  format:

Outgoing message:

<?xml version="1.0"?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=http://www.w3.org/2001/XMLSchema
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-
ENV:Body>
<GetWeatherByPlaceName xmlns="http://www.webservicex.net">
<PlaceName>london</PlaceName>
</GetWeatherByPlaceName>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

You can clearly see the place name parameter that we entered. In this case it is London. Below is the response message we get from the web service server:

Incoming message:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetWeatherByPlaceNameResponse xmlns="http://www.webservicex.net">
<GetWeatherByPlaceNameResult><Latitude>30.6171017</Latitude>
<Longitude>99.62553</Longitude>
<AllocationFactor>2.7E-05</AllocationFactor>
<FipsCode>48</FipsCode>
<PlaceName>LONDON</PlaceName>
<StateCode>TX</StateCode>
<Details><WeatherData>
<Day>Sunday, August 13, 2006</Day>
<WeatherImage>http://www.nws.noaa.gov/weather/images/fcicons/
nscttsra10.jpg
</WeatherImage>
.
</soap:Body>
</soap:Envelope>

The Delphi SOAP framework does all the hard work of putting together the SOAP envelope and sending it off to the server; then it reads the response and converts the XML into a human readable form.

Conclusion

In this article we went through the process of building a web service client and also discussed the various components and methods needed to make an application work. In the next article we are going to create a web service from scratch and also create a client that will enable us to use the service.


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus
DELPHI-KYLIX ARTICLES

- Loading an XML Document into the DOM
- Delphi Wrapper Classes and XML
- Delphi and the DOM
- Delphi and XML
- Internet Access: Client Service
- Finishing the Client for an Internet Access ...
- The Client for an Internet Access Control Ap...
- User Management for an Internet Access Contr...
- Important Procedures for an Internet Access ...
- Server Code for an Internet Access Control A...
- Constructing the Interface for an Internet A...
- Building a Server Application for an Interne...
- Building an Internet Access Control Applicat...
- Client Dataset: Working with Data Packets an...
- Using the Client Dataset in an N-Tiered Appl...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials