我通过在 web.config 中指定 WebGET 和 WebHttpBinding 在 C# 中创建了一个 REST WCF。该服务通过 IE 运行良好。我的 wsdl 开始如下,它在 wsdl 中有 soap。因为这是 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,为什么 SOAP 内容会进入 REST 服务?
谢谢, Vinoth Khanna.S
最佳答案
WCF 无法描述 REST 服务。 REST 服务可以用 WADL 或 WSDL 2.0 描述,但 WCF 不支持任何这些描述语言。
关于wcf - 用于 REST WCF 的 WSDL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6030749/