Thursday, 29 May 2014

Creating and consuming Web Service using Delphi 7 -- 2

Part 2 : Hosting Web Service ISAPI on IIS

Part 1 of this article was dedicated to creating a Web Service DLL using Delphi 7.In this part we will be exploring  how to host this DLL or ISAPI on IIS.


Step 1 : Open IIS.
Step 2 : Add new Application. 




Give an Alias name of your Web Service and Physical Path where your ISAPI dll is residing. Here i am using C:\inetpub\wwwroot\WebServiceDemo.

Do not forget to create a folder "WebServiceDemo" under C:\inetpub\wwwroot.

Do one more thing..open your WebService DLL project and set Output directory as C:\inetpub\wwwroot\WebServiceDemo and Compile -Build the project. Now this path will be having your ISAPI having name as your Project name.


Step 3 : Now select WebServiceDemo Application and double click on Directory Browsing and enable it.








Step 4: Now Browse your application.





Step 6 : Click on Project1.dll. Your web service is ready..:)

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.