![](/img/trans.png)
[英]Consume WCF Restful Service in Android through HttpUrlConnection, Getting error 405-Method Not Allowed
[英]Getting 405-Method not allowed in self hosted web service
我创建了WCF self hosted
Web服务。 这是我在Instace
类中的serviceContract and OperationContract
:
[ServiceContract]
public interface ISwiperWS
{
[OperationContract, WebInvoke(Method = "GET", UriTemplate = "/getstatus?callback={Callback}", ResponseFormat = WebMessageFormat.Json)]
String getStatus(String Callback);
}
TestWS.cs
public String getStatus()
{
return "true"
}
我正在用GWT
编写的JsonP
访问此Web服务的端点
String url = "https://somedomain.com:8083/getstatus";
JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
jsonp.setTimeout(600);
jsonp.setCallbackParam("callback");
jsonp.send(url);
我创建一个安装项目,并将其安装在不同的计算机上。 每当我从JsonP
向Web服务端点发出请求时, JsonP
表现出奇怪的行为。 在某些机器上,我得到了预期的响应,而在其他机器上,它却不断显示错误,即405-method are not allowed
。
我搜索了它,并根据它们进行了更改,但对我而言没有任何用处。 请给我建议一个soltotoin
可能是:我相信这与使用jsonp的jquery ajax调用有关。 如果您要将其更改为仅json,则该帖子将起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.