I searched the previous questions about this problem but I could not get the solution about it. My problem is I'm requested Bing Maps' REST services from my asmx web service and I want to return Json from my method. Also I published my web service to Azure and when I call it, it returned like this. How can I fix this problem?
<string xmlns="http://tempuri.org/">
<?xml version="1.0" encoding="utf-8"?> <string xmlns="http://tempuri.org/">Json elements in here</string>
</string>
Also here is my asmx service code:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string GetBingRoute(string sourcelat, string sourcelong, string deslat, string deslong, string type)
{
//type should be Walking or Driving
string address = "http://dev.virtualearth.net/REST/V1/Routes/" + type + "/?o=json&wp.0=" + sourcelat + "," + sourcelong + "&wp.1=" + deslat + "," + deslong + "&timeWithTraffic&key=_MYKEY_";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(address);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream resStream = response.GetResponseStream();
StreamReader sr = new StreamReader(resStream);
return sr.ReadToEnd();
}