HI,
I have created a wcf service api which return json format. But when i call this api in simple html page and when i click on submit button then api show "HTTP/1.1 400 Bad Request" Error.
ApI show
The server encountered an error processing the request. See server logs for more details.
My Serivce Interface like this
[ServiceContract]
public interface IImageProcessing
{
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "/SaveSKU", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
ImageResponse SaveSKU(string sku);
}
In .SVC Files i write a code
ImageResponse _imageResponse;
public ImageResponse SaveSKU(string sku)
{
_imageResponse=new ImageResponse();
_imageResponse.Result=true;
return _imageResponse;
}
This service when i call in dot.net it working but when i call in html page is give error.
My HTML Page Simple calling API
<form accept="application/json" action="http://localhost:61132/ImageProcessing.svc/SaveSKU" method="post">
<input type="text" id="sku" name="sku" />
<input type="text" id="message" name="message" />
<input type="text" id="status" name="status" />
<input type="submit" value="submit" id="btnsubmit" />
</form>
When i calling my service in html page it give HTTP/1.1 400 Bad Request I have checked using fiddler.
Please help me about this problem What I am missing to call in my WCF Service
Thanks in advance