what is WSDL URI in WCF?

29,446

Solution 1

some good tutorials about WSDL:

If your Web service address is

http://services.aonaware.com/DictService/DictService.asmx

you can reach your wsdl file like this:

http://services.aonaware.com/DictService/DictService.asmx?WSDL

Solution 2

WSDL of WCF service is usually retrieved by adding ?wsdl to service's HTTP(S) URL. But you have to allow this WSDL retrieval in ServiceMetadataBehavior. WCF 4 allows this by default for all HTTP based services if you use WCF service application project template:

<behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

Also by typing HTTP(S) based URL of your service into browser you should receive help page with hyperlink to WSDL.

In WCF 3.x you have to allow it manually and use behavior configuration in service definition.

<behaviors>
  <serviceBehaviors>
    <behavior name="myConfig">
      <!-- requires HTTPS to be configured for your service -->
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> 
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service name="..." behaviorConfiguration="myConfig">
     ...
  </service>
</services>

Retrieving WSDL this way is only possible over HTTP(S) GET. You can also use WS-MetadataExchange protocol for retrieving service metadata from Metadata endpoint - it also supports different transport protocols. WSDL in WCF is only for SOAP services.

Share:
29,446
scatman
Author by

scatman

.

Updated on June 20, 2020

Comments

  • scatman
    scatman almost 4 years

    What is WSDL? i can't find a lot of references while googling...
    how can i know the WSDL URI of my WCF web service?