| | | | Browse by category |
Problem
When working with web services in LEIF or Hydra, one of the goals is interoperability with other platforms and vendors. A common user of web services are developers who use .NET clients to access web services implemented using LEIF or Hydra. In order to ensure that these clients will work correctly with these services, a developer will need to be able to create sample .NET clients to test the services.
Action
A sample .NET client can be easily created using the following steps with any of the Visual Studio .NET platforms. For this example, I will create a client for the HelloWorld example.
- Open a command prompt with the chosen .NET platform environment configured and navigate to the HelloWorld example directory.
- Generate a sample proxy from your wsdl with the following command:
- wsdl HelloWorld.wsdl
- The generated proxy will, by default, use the address of the service defined in the wsdl. If you need to contact localhost for testing you might have to edit the url in the class constructor. Note: The name of the file generated is taken from the service name defined in the wsdl. i.e., <service name="GreetingService">
- Compile the proxy into a dll with the following command.
- csc /t:library GreetingService.cs
- Create a HelloWorldClient.cs file with the following contents:
using System; public class HelloWorldClient //this must match the filename. |
6. Compile the client using the proxy dll we already compiled:
- csc HelloWorldClient.cs /r:GreetingService.dll
You now have a fully functioning HelloWorldClient.exe. Once you have the GreetingService implemented and deployed as described in the HelloWorld example, you can execute the HelloWorldClient to contact the service.