J'ai un RESTFul service WCF ainsi déclaré:WCF RESTful POST
[ServiceContract]
public interface IGasPriceService
{
[OperationContract]
[WebGet
(ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "/GetGasPrice/For/ZipCode/{zipCode}"
)]
GasPriceData GetPriceData(string zipCode);
[OperationContract]
[WebGet
(RequestFormat = WebMessageFormat.Xml,
ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "/GetGasPrice/For/City/{city}"
)]
GasPriceData GetPriceDataForCity(string city);
[OperationContract]
[WebInvoke
(Method = "POST",
RequestFormat = WebMessageFormat.Xml,
UriTemplate = "/SetGasPrice/For/ZipCode/{zipCode}/Price/{price}"
)]
void SetPriceDataForZipCode(string zipCode, string price);
}
Les méthodes de travail GetPriceData et GetPriceDataforCity, mais le SetPriceDataForZipCode ne fonctionne pas. Quelqu'un peut-il me dire pourquoi cette dows ne fonctionne pas.
Quand j'émettre une demande comme:
http://localhost:7002/SetGasPrice/For/ZipCode/45678/7.80
le message que je reçois est:
EndPoint Not Found
Toutes les idées comment résoudre ce problème?
je l'ai changé pour
http://localhost:7002/SetGasPrice/For/ZipCode/54568/5.788
et
[OperationContract]
[WebInvoke
(Method = "POST",
RequestFormat = WebMessageFormat.Xml,
UriTemplate = "/SetGasPrice/For/ZipCode/{zipCode}/{price}"
)]
void SetPriceDataForZipCode(string zipCode, string price);
Cela me donne le message:
Méthode non autorisée.
Des idées pour résoudre ce problème?