Wednesday, 7 May 2008

Generating C# Web Service Skeleton from wsdl

I need to create a C#.NET web service which adheres to a specific wsdl provided by a third party. Instead of browsing the wsdl content and creating the service manually I decided to look for a tool that provides a similar functionality to wsdl2java tool. What I found is wsdl.exe.

In order to generate a C# Interface for my web service I run this tool with options:
wsdl /language:CS /serverInterface wsdl_location
The command above generates the file "<wsdl _file_name>Interfaces.cs" in default location. Copy generated file to your web service project and create a new class implementing interface from generated file.

Let's assume we used the wsdl tool and have the generated interface for our service. The interface name is IMyServiceHttpBinding and contains the signatures of 2 methods: void foo(string text) and string goo(). Sample implementation may look as follows:

[WebService(Namespace = "")]
public class MyService : IMyServiceHttpBinding
public void foo(string someText) {(...)}

public string goo() {(...)}

Enabling SSL in IIS 5

Currently I'm using Windows XP Pro and have IIS 5.1 installed. I tried to enable SSL for my IIS. Most of the instructions were quite complex, describing the manual generation and signing of certificates. However, I found much simpler solution which allows to enable SSL in few simple steps.

Basically, all you need to do is install IIS 6.0 Resource Kit and run the SelfSSL tool. That's it! The generated certificate is 'self-signed' so it may be suggested as untrusted by client's browser but it's completely enough for developers who need to test connections to their IIS using SSL.

I found this solution here.