Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using web references

So been a few days now learning about web references within my projects I have now came across a strange problem.

Using a simple console app I did this:

namespace Webservices09004961
{
    class Program
    {
        static void Main(string[] args)
        {

            {
                Convert.ConvertTemperatureSoapClient client =
                new Convert.ConvertTemperatureSoapClient();
                while (true)
                {
                    Console.Write("Enter temperature in Celsius: ");
                    double tempC = double.Parse(Console.ReadLine());
                    double tempF = client.ConvertTemp(tempC, Convert.TemperatureUnit.degreeCelsius, Convert.TemperatureUnit.degreeFahrenheit);
                    Console.WriteLine("That is " + tempF + " degrees Farenheit");
                }
            }
        }
    }
}

I have added in the service reference "Convert" related to this link: http://www.webservicex.net/ConvertTemperature.asmx?WSDL

However I get this error:

An endpoint configuration section for contract 'Convert.ConvertTemperatureSoap' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name.

Is this because you can only have one service reference allocated at any one time? The reason I ask is because my local service reference within the same project build still works fine? Yet this one doesnt? (It did when I first created it)

Or is this a seperate problem?

Also what are the limitations on SOAP?

like image 623
G Gr Avatar asked Mar 07 '12 17:03

G Gr


People also ask

What is a web reference?

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.

How do you cite a .org website in APA?

APA website citations usually include the author, the publication date, the title of the page or article, the website name, and the URL. If there is no author, start the citation with the title of the article. If the page is likely to change over time, add a retrieval date.

How do I reference a Web service in C#?

In the Project Type pane, select a Visual C# application. In the Templates pane, select a Windows Forms Application. Enter a project name such as CallingServiceExample, and browse to a storage location. In the Solution Explorer, right-click the project name and click Add Service Reference.


1 Answers

This errors are common when you try to remove a svc reference and add it again. Check your app/web.config file, you should have duplicate entries for Convert.ConvertTemperatureSoap. remove one of them and it will work fine.

like image 105
Davita Avatar answered Sep 28 '22 07:09

Davita