简体   繁体   中英

what is WSDL URI in WCF?

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?

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

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.

WSDL URI in the WCF is used for creating the Proxy class that can be used for communicating with the client.

WSDL URI gets/call the metadata . For the client to build the proxy class they needs to know about the service contracts,operation contracts,method used in WCF and the parameters in the method of the WCF, with out these information client will not be able to generate the proxy class while hosting the WCF service in the application so metadata is actually responsible for generating all these informations in the app config file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM