tags:

views:

256

answers:

1

I created a REST service using WCF. It has 2 operations; one has [WebGet] applied on it and works fine both on localhost and on my production server.

But, the other operation that has the following attribute applied on it works only localhost not on production server. Can anybody tell me what could be wrong here ?

The attribute in question is ..

[WebInvoke(Method = "POST",
           BodyStyle = WebMessageBodyStyle.Wrapped,
           ResponseFormat = WebMessageFormat.Json,
           RequestFormat = WebMessageFormat.Json,
           UriTemplate = "CreateUser")]

The error that I am getting is bad request (400). The JSON request sent is the same for both localhost and prod server. It also has content type set to application/json.

Thanks, Ramki.

A: 

This looks very similar to this problem:

http://stackoverflow.com/questions/911859/wcf-rest-post-xml-the-remote-server-returned-an-error-400-bad-request

If it does not help post more details

Shiraz Bhaiji
The URL that you gave has a similar problem but the data exchange format is XML and that guy had a wrong namespace in the xml request that he was sending to the service. My service consumes JSON data and as such namespace fix suggested there won't work for me ... if you need any more details I'll be glad to give you ...
Ramki
Do you call it with content type "application/json"
Shiraz Bhaiji