Tran Thien An
Tran Thien An

Reputation: 55

Create C# client consumes SOAP service without using built-in 'Add Service Reference...'

My company provides SOAP service over Https. I need to write a library that consumes that SOAP service using C#. I am using code generated by "Add Service Reference..." feature of Visual Studio 2008, but it creates a class for each function (there are many of them) exposed by service that i think overkill. My question is there another way to write a consumer without using "Add Service Reference..."?

Upvotes: 1

Views: 7545

Answers (2)

Ishtiaq
Ishtiaq

Reputation: 1058

You can use svcutil.exe command line utility to create the proxy class for your service.Add that proxy class with generated config file in your project.All the service methods will be available through that class. Here are the steps for Generating proxy clas.

  1. Open Visual Studio Command prompt.

  2. Go to the specific Folder where you want to place you generated class.e.g type "cd D:\\Services

  3. run the command "svcutil.exe YourSerivceURL"

This command will generate the class for your service in "D:\\Services" folder with output.config file. you have to copy the client configration section from the output.config file and add in you web.config file where you want to refer the service.

Upvotes: 2

toszo
toszo

Reputation: 76

You can do it by creating SOAP message and sending web request Like in this SOAP client web request

Upvotes: 3

Related Questions