REST WCF 的 WSDL

发布于 2024-11-07 14:04:29 字数 1316 浏览 0 评论 0原文

我通过在 web.config 中指定 WebGET 和 WebHttpBinding 在 C# 中创建了 REST WCF。该服务通过 IE 运行良好。我的 wsdl 开始如下,它在 wsdl 中有肥皂。由于这是 REST,soap 不应该出现在 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">

在上面的 wsdl 中,既然这是 HTTP,为什么肥皂内容会出现在 REST 服务中?

谢谢, 维诺斯·卡纳

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情释 2024-11-14 14:04:29

WCF 无法描述 REST 服务。 REST 服务可以通过 WADL 或 WSDL 2.0 来描述,但 WCF 不支持任何这些描述语言。

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.

混浊又暗下来 2024-11-14 14:04:29

如上所述,REST 在 WCF 中没有 WSDL 的概念,只有 SOAP。如果 ?wsdl 的 URL 有效,那么您的配置中可能定义了一个“mex”(元数据交换)端点,这就是 WSDL 的服务。如果您通过 VisualStudio 向导添加 WCF 服务,则通常会默认添加此服务。如果它存在,并且您不打算使用 SOAP,则可以将其删除。它通常看起来像这样:

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

On a side note;可以让 WCF 提供与 SOAP 和 REST 相同的服务,详细信息如下:WCF 服务的 REST/SOAP 端点

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文