Question

Does anyone know of a good tool to generate the WSDL for a service contract written in C# (i.e. set of methods that are tagged as "[OperationContract]" using WCF)? All the tools I've found work the other way around: create code stubs from a WSDL. I don't want to have to hand-jam a WSDL file. I've found tools for php and J2EE, but not C#. Thanks!

Was it helpful?

Solution

Easiest thing to do is host the service with a base address setup, and then just hit it from a browser with "?wsdl" appended to the end.

Here's an example of a service configuration with a base address specified. Note this goes in the <configuration><services> element in your config:

  <service name="MyServiceName" behaviorConfiguration="MyServiceBehavior">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:9000/MyService"/>
      </baseAddresses>
    </host>
    <endpoint address="net.tcp://localhost:9001/MyService"
              binding="netTcpBinding"
              contract="IMyService"
              bindingConfiguration="MyServiceBinding"/>
  </service>

Once you get it hosted, just go to http://localhost:9000/MyService?wsdl to see the WSDL definition.

OTHER TIPS

svcutil or just host it quickly and hit the MEX point :)

Two ways:

a) Download wsdl file and do below steps:

i) Open visual studio command prompt as an administrator.

ii) Type below command:

wsdl.exe [path To Your WSDL File]

b) With endpoint:

i) Open Visual studio command prompt as an administrator.

ii) type below command: wsdl.exe http://localhost:9000/MyService

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top