512 CHAPTER 20 WEB SERVICES Executing the (Web site optimization)
512 CHAPTER 20 WEB SERVICES getQuote(”Ali”); ?> Executing the client produces the following output: I am the greatest. (1962) Using a C# Client with a PHP Web Service Although Linux is in widespread use as a server platform, it s apparent that the Microsoft Windows operating system will continue to dominate the desktop for some time to come. That said, quite a bit of interest has been generated regarding using Web Services as the tool of choice to enable Windows-based desktop applications to seamlessly integrate with Linux-based server applications. This section offers a brief yet effective example that demonstrates just how easy it is to do this. Specifically, we ll create a simple console-based C# application that talks to the PHP-based boxing Web Service built using the NuSOAP extension (refer to Listing 20-8). Although it s simplistic, this example should provide you with enough information to get the ball rolling on more complex applications. In this final example, a C# application and our PHP Web Service will be coerced into playing nice with each other. This example is particularly compelling because it demonstrates just how easy it is to integrate a Windows desktop application and an open-source server. Because not everybody has a copy of Visual Studio .NET at their disposal, this example uses the freely downloadable .NET Framework SDK, which contains all the tools you need to successfully carry out this experiment. If you re running Visual Studio .NET, the general process is the same, although considerably more streamlined. For demonstration purposes, we ll use the PHP-based boxing Web Service discussed throughout this chapter. The finished C# client simply invokes the getRandQuote() function, outputting a random quotation to a console window. Example output is provided in Figure 20-5. Figure 20-5. Retrieving a random quote via a C# client If you don t already have it installed, you need to download and install the .NET Framework SDK to follow along with the example. Because the URL is quite long, execute a search on the Microsoft site (http://search.microsoft.com/) for the package. In addition, you need to download the .NET Framework Redistributable Package, which is also readily available from the Microsoft Web site. If you re unfortunate enough to be using a dial-up connection, consider ordering both on CD, because the SDK weighs in at over 100MB, while the redistributable package tops out at over 24MB.
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.