Tuesday, 7 January 2014

Creating and consuming Web Service using Delphi 7 -- 1

Creating and consuming Web Service using Delphi 7 


Part 1 : Creating Web Service

What is Web Service 

web services are application block that can be published over the internet and can be make available to the rest of the world worldwide. Consider an example of an application which need stocks quotes,than we can make a web service to provide real time data for stocks quotes and all other application can use this web Service.

Web Services do not depend on any Platform or Language and they are self described and self dependent. 

Web services depend on XML (Extensible Markup Language) to code and decode your data and SOAP (Simple Object Access Protocol) to transport it. The Description Language (WSDL) is XML-based and it describes the web service and how to access it. The Universal Description, Discovery and Integration (UDDI) is a directory service that allows businesses to register and locate published web services. These primary layers form the building blocks that make up a web service.

First we will see how to create web service using delphi IDE and later we will write a client  to consume that web service.


Step 1 : Open Delphi IDE and select File -> New - > Others -> Web Service tab -> SOAP Server Application. Click On OK.


             



























Step 2 :  SelectISAPI/NSAPI Dynamic Link Library radio button and Click on OK.difference between ISAPI and  CGI ISAPI and CGI


Step 3 : Click on Yes when this dialog appears
  
Step 4 :Give a service name and press OK.






Step 5 : After this Save project. Compile and Build the project.a DLL file will be crated into destination folder.

Step 6 :

Open TestServiceIntf unit and two method in it which will be called by Client application.

 Note : do not miss stdcall. Learn more about calling convention  Calling Convention


step 7 :                                                  
Open TestServiceImpl unit and above two method in this unit and define these methods.


Now compile and build the project.

Your dll for Web Service is ready.in next session we will be exploring how to host this dll on IIS server.