Ouado
Ouado

Reputation: 19

Web Service Reference issue with Visual Studio

I'm having a hard time using Web Service reference with VS2010. I followed the following instructions: Instructions

I defined a simple function in my Web Service:

namespace WebService1
{
    public class Service1 : IService1
    {
        public string HelloWorld(string name)
        {
            return "Hello "+name;
        }

        public double myFunction(double a, double b)
        {
            return a + b;
        }
    }
}

It implements the following Interface:

namespace WebService1
{
    [ServiceContract]
    public interface IService1
    {

        [OperationContract]
        string HelloWorld(string name);

        [OperationContract]
        double myFunction(double a, double b);
    }
}

When I try to call it in my Console App:

using WebTest.MyReference;

namespace WebTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Service1 service = new Service1();
            Console.WriteLine(service.HelloWorld("Edouard")); //Works
            double price = service.myFunction(2,3); //Doesn't Work
        }
    }
}

VS2010 tells me that myFunction is defined this way:

void service1.myFunction(double a, bool aSpecified, double b, bool bSpecified, out double myFunctionResult, out bool myFunctionResultSpecified)

Which is clearly not the same use of my function! How can I be able to call my webservice function like I defined it?

Upvotes: 0

Views: 318

Answers (1)

Aaron
Aaron

Reputation: 1411

Check out this question, I think it is the same problem you are having.

WCF service method arguments, bool specified

Upvotes: 1

Related Questions