Amit Pal
Amit Pal

Reputation: 11062

Getting 405-Method not allowed in self hosted web service

I created a WCF self hosted web service. Here are my serviceContract and OperationContract in Instace class:

[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"
}

I am accessing the endpoint of this web service from JsonP written in GWT

String url = "https://somedomain.com:8083/getstatus";
JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
jsonp.setTimeout(600);
jsonp.setCallbackParam("callback");
jsonp.send(url);

I create a setup project and installed it on different-different machine. Whenever i am making a request to web service endpoints from JsonP It is showing an strange behavior. In some machine i am getting an expected response where as in some other machine it continuously showing an error i.e. 405-method are not allowed.

I searched it for and make change according to them but nothing works for me. Please suggest me a solutoin

Upvotes: 0

Views: 779

Answers (1)

Harry
Harry

Reputation: 71

May be: I believe it had something to do with your jquery ajax call using jsonp. If you are going to change it to just json the post will work..

Upvotes: 1

Related Questions