3

I've created a REST WCF in C# by specifying WebGET and WebHttpBinding in web.config. The service works fine through IE. My wsdl starts as below and it has soap in wsdl. Since this is REST, should'nt the soap be present in wsdl.

WSDL :

  <?xml version="1.0" encoding="utf-8" ?> 
 <wsdl:definitions name="ServiceImp" targetNamespace="http://tempuri.org/"    
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
    xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" 
    xmlns:tns="http://tempuri.org/" 
    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
    xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" 
    xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" 
    xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" 
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
    xmlns:wsa10="http://www.w3.org/2005/08/addressing" 
    xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">

In the above wsdl, Since this is HTTP, why is the soap content coming in REST service?

Thanks, Vinoth Khanna.S

Nix
  • 57,072
  • 29
  • 149
  • 198
VKh
  • 151
  • 2
  • 10
  • 3
    REST doesn't **have** a WSDL ..... not entirely sure **what** you're looking at here...... also: a REST service doesn't have any **SOAP** content..... – marc_s May 17 '11 at 12:28
  • You've not posted your whole WSDL… – Donal Fellows May 17 '11 at 12:29
  • Yes i din't post my entire wsdl. Then how is it that when i give ?wsdl after my service its displaying the wsdl? – VKh May 17 '11 at 12:30
  • Hi...I jus created a REST service the way i created a WCF. Should i follow any other way of creating REST WCF in 3.5? – VKh May 17 '11 at 12:36

2 Answers2

3

WCF is not able to describe REST service. REST service can be described by WADL or WSDL 2.0 but WCF doesn't support any of these description languages.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670
0

As stated above, REST has no concept of a WSDL in WCF, only SOAP. If the URL for ?wsdl works, then you probably have a 'mex' (Metadata Exchange) endpoint defined in your configuration, which is what serves up the WSDL. This is usually added by default if you add a WCF service through the VisualStudio wizards. If it is there, it can be removed if you don't plan on using SOAP. It will usually look something like this:

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

On a side-note; it is possible to have WCF serve up the same services as both SOAP and REST, as detailed here: REST / SOAP endpoints for a WCF service

Community
  • 1
  • 1
CodingWithSpike
  • 42,906
  • 18
  • 101
  • 138