2011-05-17 86 views
3

我已经通过在web.config中指定WebGET和WebHttpBinding在C#中创建了REST WCF。该服务通过IE工作正常。我的wsdl从下面开始,它在wsdl中有soap。由于这是REST,因此不应该在wsdl中存在肥皂。WSDL for REST WCF

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"> 

在上面的WSDL,因为这是HTTP,为什么皂含量在REST服务来吗?

感谢, Vinoth Khanna.S

+3

REST不**具有** WSDL .....不完全确定**什么**您'再看看这里......另外:REST服务没有任何** SOAP **内容..... – 2011-05-17 12:28:52

+0

你还没有发布你的整个WSDL ... – 2011-05-17 12:29:23

+0

是的,我没有发布我的整个wsdl。那么当我给我的wsdl服务后显示wsdl时,它是怎么样的? – 2011-05-17 12:30:54

回答

3

WCF是不能够描述REST服务。 REST服务可以用WADL或WSDL 2.0来描述,但WCF不支持任何这些描述语言。

0

如上所述,REST没有WCF中的WSDL概念,只有SOAP。如果?wsdl的URL有效,那么您可能在您的配置中定义了一个'mex'(元数据交换)端点,这是WSDL的服务内容。如果您通过VisualStudio向导添加WCF服务,通常会默认添加此项。如果它在那里,如果你不打算使用SOAP,它可以被删除。它通常会是这个样子:

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

在一个侧面说明;有可能让WCF提供与SOAP和REST相同的服务,详情如下:REST/SOAP endpoints for a WCF service