简体   繁体   中英

svc file and restful web service

I have a restful service living on our company server IIS 7.5. The url is http://11.52.36.251/MessagingServices/IData.svc . I used Restsharp/Restclient to test it from client side.

When I put the url in the browser and hit "ENTER", the wsdl link was generated.

But I heard that restful service didn't have a wsdl, but why I saw it?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM