Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# client how to invoke wsdl file

My customer gave me a .wsdl file to access their webservices. Using VS2008 I can create a project, but I don't know how to use the .wsdl file in it.

like image 413
Gatspy Avatar asked May 25 '11 03:05

Gatspy


People also ask

What C is used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

Is C language easy?

C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.

What is the full name of C?

In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr. Stroustroupe.

Is C programming hard?

C is more difficult to learn than JavaScript, but it's a valuable skill to have because most programming languages are actually implemented in C. This is because C is a “machine-level” language. So learning it will teach you how a computer works and will actually make learning new languages in the future easier.


2 Answers

You don't invoke WSDL file, you add service reference from the file.

To add reference, right click on the project, select Add Service Reference. Paste path to your wsdl file and hit Go.

enter image description here

If you want to use legacy Web Service client, select Add Web Reference and paste path to the wsdl file from there.

I recommend to use WCF (Add Service Reference option).

To use the service reference add code like this:

var serviceClient = new ServiceReferenceName.MyClassClient();
serviceClient.DoSomething();

You also need to update config file with the server URL that you customer should provide you with:

<client>
  <endpoint address="http://UrlFromYourCustomerHere"
            binding="basicHttpBinding"
            bindingConfiguration="xxx"
            contract="MyServiceReference.xxx"
            name="xxx/>
</client>
like image 162
Alex Aza Avatar answered Oct 16 '22 09:10

Alex Aza


A Web reference enables a project to consume one or more XML Web services. Use the Add Web Reference Dialog Box to search for Web services locally, on a local area network, or on the Internet.

After adding a Web reference to your current project, you can call any methods exposed by the Web service.

To add a Web Reference

  1. On the Project menu, click Add Web Reference.
  2. In the URL box of the Add Web Reference dialog box, type the URL to obtain the service description of the Excel Web Services, such as http:////_vti_bin/excelservice.asmx or http:///_vti_bin/excelservice.asmx. Then click Go to retrieve information about the Web service. Note Note:

    You can also open the Add Web Reference dialog box in the Solution Explorer pane by right-clicking References and selecting Add Web Reference.

  3. In the Web reference name box, rename the Web reference to ExcelWebService.
  4. Click Add Reference to add a Web reference for the target Web service.
  5. Visual Studio downloads the service description and generates a proxy class to interface between your application and Excel Web Services.

Read

How to: Add and Remove Web References

like image 20
Shahin Avatar answered Oct 16 '22 10:10

Shahin