Hello my wcf code is below:
Interface:
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "/SaveURLTable")]
Int64 SaveURLTable(string URL, string UniqueID);
Method:
public Int64 SaveURLTable(String URL, String UniqueID)
{
}
now i m able to call this by making httprequest call from IE10, FF, Chrome like modern web browser but when i call this from IE8 then its giving me following error:
<p>The server encountered an error processing the request. The exception message is 'The incoming message has an unexpected message format 'Raw'. The expected message formats for the operation are 'Xml', 'Json'. This can be because a WebContentTypeMapper has not been configured on the binding. See the documentation of WebContentTypeMapper for more details.'. See server logs for more details. The exception stack trace is: </p>
<p> at System.ServiceModel.Dispatcher.DemultiplexingDispatchMessageFormatter.DeserializeRequest(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</p>
Found in fiddler.
my json code for modern browser is below:
$.ajax({
type: "POST",
crossDomain: true,
url: query,
data: '{"URL": "' + dbString + '","UniqueID": ""}',
contentType: "application/json; charset=utf-8",
dataType: "XML",
processdata: true,
success: function (data1) {
if (data1 != null) {
var data = data1;
alert(data);
}
},
error: function (response, textStatus, errorThrown) {
alert(response.responseText);
}
});
and my IE8 XDR code is below:
var postdata = '{"URL": "' + dbString + '","UniqueID": ""}';
if (window.XDomainRequest) {
var xdr = new XDomainRequest();
if (xdr) {
xdr.onload = function () {
data = xdr.responseText;
alert(data);
}
xdr.onerror = function () { }
xdr.open('POST', query);
xdr.send(JSON.stringify(postdata));
}
}
My httprequest code is working correct but XDR code is not working and giving me above error. please help me to solve this guys...
I want to make post request with data from IE8, please help me.