Asked by:
Client found response content type of ‘text/html’, but expected ‘text/xml’

Question
-
I am getting this error Client found response content type of 'text/html', but expected 'text/xml'.I am adding web reference for live search. When i build the project its Successful. But after that once i enter some text in textbox & enter search button it gives this error. I am Using my local machine & Using .net 2.0 with C#.
In my web project i am adding live search reference i.e http://soap.search.msn.com/webservices.asmx?wsdl.....& in cs file on Searchbutton click event i am using this code
MSNSearchService s = new MSNSearchService();
SearchRequest searchRequest = new SearchRequest();
int arraySize = 1;
SourceRequest[] sr = new SourceRequest[arraySize];
sr[0] = new SourceRequest();
sr[0].Source = SourceType.Web;
searchRequest.Query = TextBox1.Text;
searchRequest.Requests = sr;
searchRequest.AppID = "APP ID you generated from http://search.msn.com/developer";///Here I am Putting my App code Id
searchRequest.CultureInfo = "en-US";
SearchResponse searchResponse;
searchResponse = s.Search(searchRequest); //Error comes on This line
foreach (SourceResponse sourceResponse in searchResponse.Responses)
{
Result[] sourceResults = sourceResponse.Results;
if (sourceResponse.Total > 0)
{
Label1.Text = sourceResponse.Source.ToString() + " - Total Results: " + sourceResponse.Total.ToString();
}
GridView1.DataSource = sourceResults;
GridView1.DataBind();
}
Plz help me... Thanks In Advance..Thursday, January 29, 2009 10:01 AM
All replies
-
I have downloaded CSharp Live Search Samples from http://www.microsoft.com/downloads
and put the above code there but it is giving the same error. Is this error is coming due to some proxy settings or IIS settings.
Plz guide me if any one have any clue...
Thanks.Thursday, January 29, 2009 11:53 AM -
You are hitting an issue in the Akamai edge that we have been trying to identify for a while but has always been very elusive.
It would help us immensely if you could send us some more information (preferrably in private - you can email it to me at (my forum alias without - MSFT at microsoft dot com).
What we would need the most is a full HTTP trace of a failing request (you can capture that with tools like Fiddler or Netmon - the former can be downloaded at http://www.fiddlertool.com )
Thank you in advance
--Alessandro
Thursday, January 29, 2009 5:14 PM -
Thanks Alessandro...I dont find your email Id so i am giving the relevant data here only for failing item after checking it in Fiddler....
The failing URL is http://soap.search.live.com/webservices.asmx and
session is
POST /webservices.asmx HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.42)
VsDebuggerCausalityData: uIDPoyZkAPufYSdMn1HUvNBbIJ8AAAAAHyrV9wKwwUS9PBXv3XtLtWYLJXhC/MtCh6Yd8JPvdRgACAAA
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://schemas.microsoft.com/MSNSearch/2005/09/fex/Search"
Host: soap.search.live.com
Content-Length: 655
Expect: 100-continue
Proxy-Connection: Keep-Alive
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlnsoap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><Search xmlns="http://schemas.microsoft.com/MSNSearch/2005/09/fex"><Request><AppID>---------I have remove the App Id from here----------------------</AppID><Query>asp</Query><CultureInfo>en-US</CultureInfo><SafeSearch>Moderate</SafeSearch><Flags>None</Flags><Requests><SourceRequest><Source>Web</Source><Offset>0</Offset><Count>10</Count><ResultFields>Title Description Url</ResultFields></SourceRequest></Requests></Request></Search></soap:Body></soap:Envelope>
Plz send me your EmailId & more Details that u want .........
Thanks,
Sanjay.Friday, January 30, 2009 5:11 AM -
Hi,
We need the HTTP request as well as the response dump for the failing request. Can you provide that to us please?
What is provided above is the request dump only. You can email the information to me at roopalik at microsoft dot com.
Thank you very much for your help!
RoopaliWednesday, February 18, 2009 7:53 PM