[英]svc file and restful web service
I have a restful service living on our company server IIS 7.5. 我的公司服务器IIS 7.5上有一个宁静的服务。 The url is http://11.52.36.251/MessagingServices/IData.svc
. 网址为http://11.52.36.251/MessagingServices/IData.svc
。 I used Restsharp/Restclient to test it from client side. 我使用Restsharp / Restclient从客户端进行测试。
When I put the url in the browser and hit "ENTER", the wsdl link was generated. 当我将URL放入浏览器并单击“ ENTER”时,生成了wsdl链接。
But I heard that restful service didn't have a wsdl, but why I saw it? 但是我听说宁静的服务没有wsdl,但是为什么看到它呢?
I checked the code inside the service, there are 我检查了服务中的代码,有
public interface IData
{
[OperationContract]
[WebGet(BodyStyle=WebMessageBodyStyle.Bare,
ResponseFormat=WebMessageFormat.Json,
UriTemplate="/api")]
void GetApi();
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Bare,
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "/GetIData?iId={iId}&facilityId={internalId}")]
IDTO GetIData(string iId, string internalId);
}
Is it a fake restful service or other reason? 是假的宁静服务还是其他原因?
A restful service should be able to document itself strictly through its API, or simple readable HTML document. 宁静的服务应该能够通过其API或简单易读的HTML文档严格地对其自身进行文档化。 However, any service developed in WCF will have a WSDL by default, so just because a service has a WSDL doesn't mean its not RESTful. 但是,默认情况下,在WCF中开发的任何服务都将具有WSDL,仅因为服务具有WSDL并不意味着它不是RESTful的。 If it truly is RESTful, the service developer should disable the mex endpoint to keep its WSDL from being published, thus assuring clients are using the service in the intended way. 如果确实是RESTful,则服务开发人员应禁用mex端点,以使其WSDL不被发布,从而确保客户端按预期方式使用该服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.