简体   繁体   中英

Calling webservice in C# returns Client found response content type of '', but expected 'text/xml'

I am currently calling a ColdFusion web service in C#. The web service is just a simple query used to search for users. I can search just fine and it returns the users I search for unless I try searching for 'Johnson' then it returns:

Client found response content type of '', but expected 'text/xml'.
The request failed with the error message:
--

--.

I don't know why it doesn't work when searching for that specific string. I thought it might be timing out but the error pops up immediately after sending the request. Any ideas???

may be output is corrupt. try network analyzer WireShark to see what's going on behind the scene.

I'd start by calling the service manually, and seeing what the raw return value is. Is it throuwing an error? Returning null? Some third option?

I found the problem, turns out there was an invalid character being returned in one of the rows in the query that couldn't be put in the xml. Removed the invalid character and it works fine now.

Just a guess. Can it be that this specific query has no matches found, so web-service returns the non-XML result (empty sting in your case)? Does this happen when you ask any other non-existing name (some "blah-blah-blah")? If this is correct, it's definitely a logical bug in service code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM