Fast and easy WCF web service implementation given wsdl?

I am writing a client to access a SOAP web service that will be hosted by a third-party. I have WSDL and XSD that define the interface and data.

I had no problems creating a service link from WSDL, but I had a problem creating a simple web service that implements it, which I can use for testing. (The third-party service is not ready yet, but even if it works, I would still like to do my initial testing against my own test server, and not against them.)

I was browsing, and apparently I can use svcutil to create an interface for the service:

svcutil.exe thewsdl.wsdl thexsd.xsd /language:c# /out:ITestService.cs

This generates a file containing a service interface definition. But what now?

I decided that the easiest way is to create a self-service service, so I created a new console application, and in it I implemented a class obtained from the service interface definition and started it using ServiceHost.

It starts, and while it started, I managed to create a service link in my client application. But when I try to call it, from the client application I get an error message:

The provided URI scheme 'http' is invalid; expected 'https'.

What is the easiest way to get around this? Is there an easy way to just turn off authentication and authorization and just allow unlimited access?

EDITED:

I add generosity to this, since the original question does not seem to attract attention.

But back to the point. I am trying to write a client against a client SOAP service. As part of the development, I want to create my own test WCF service that implements the same WSDL.

, .wsdl .xsd, , , VS2010.

, IIS, . , , , , , , , , .

? WCF, svcutil.exe , , , app.config , .

+5
2

, , .

:

  • WCF
  • wsdl xsd
  • wsdl .
  • " ..."
  • wsdl, , go. , .
  • , ( - )
  • system.serviceModel. wsdl, node system.serviceModel node node. , node :
 <system.serviceModel>
    <services>
      <service name="YourService">
        <endpoint address=""
               binding="basicHttpBinding" bindingConfiguration="WeatherSoap"
               contract="ServiceReference1.WeatherSoap" name="WeatherSoap" />      
      </service>
  • node
  • , , , . , . , .
  • , wsdl, , - , wsHttpbinding, netTCPbinding ..
+5

Moq, . ( svcutil) , , , .

:

var mock = new Mock<IFoo>();
mock.Setup(foo => foo.DoSomething("ping")).Returns(true);

,

var myObject = new IFoo;
var resp = myObject.DoSomething("whateverwillbeoverriddenbyping");

resp .

, Moq. . , , .

+1

All Articles