3

What do I need to call a web service over https in C#? Do I need to get the certificate form the site? How do I use this to call the web service?

4 Answers 4

4

There's nothing special or different for calling a web service over https than over http. You generate a client proxy from the WSDL using either svcutil.exe (or Add Service Reference in VS) or wsdl.exe and invoke the method. The lower level classes HttpWebRequest and HttpWebResponse will eventually take care of the actual call and certificates but it should be transparent for your code. Of course the server hosting the web service needs to provide a valid certificate.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi Darin. Can you please elaborate? I have a similar issue, i am calling a webmethod in SSIS package. Previously the webmethod was working fine with HTTP but now using HTTPS. Now i am unable to call the webmethod. Can you please guide me? I am using c# for devlopment. Many thanks.
1

I take that you are using Visual Studio to create your projects, if you are it is pretty easy to do. I take that you have the url for the web service that you would like to connect to and it starts with HTTPS.

In your project in the solution explorer (assuming you using Visual Studio), you should see a node saying "References" and another one saying "Web References". Right click on the "Web Reference" and then basically follow the wizard. It is pretty straight forward. You can spec your own Namespace. I usually use the format SomethingAPI. Then use the API as you would like any other object in your project. You will get the intellisense and all.

Comments

0

There might occur known problems with some certificates though. See http://support.microsoft.com/kb/823177/en-us

Comments

0

Do you have a client certificate that has been supplied by the provider of the web service?

If so, there are various different ways of doing this depending upon which version of .NET you are using. What version are you using, and are you limited in how you can generate your client proxy classes?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.