Find the answer to your question
Advanced Search
Published: January 30 2017, 4:35:00 PMUpdated: July 29 2022, 9:16:09 AM
Product
Why is the .NET SDK throwing exception "Client found response content type of 'text/html; charset=iso-8859-1', but expected 'text/xml'"?
Summary
If the SDK encounters an response whose type is not text/xml, then it throws that exception. The best way to find out what is causing the error is to turn on logging and see what is actually sent and received.
Detailed Description
Consider the following request and response logged by the .NET SDK in the log file:
[8/22/2006 12:34:09 PM, Informational]https://api.ebay.com/ws/api.dll?callname=GeteBayOfficialTime&siteid=0&client=netsoap&appid=AppID
[8/22/2006 12:34:10 PM, Informational]
<?xml version="1.0" encoding="utf8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<RequesterCredentials xmlns="urn:ebay:apis:eBLBaseComponents">
<eBayAuthToken>******</eBayAuthToken>
<Credentials>
<AppId>AppID</AppId>
<DevId>DevID</DevId>
<AuthCert>******</AuthCert>
</Credentials>
</RequesterCredentials>
</soap:Header>
<soap:Body>
<GeteBayOfficialTimeRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<MessageID>51f92eae62054bf3abb3c79f505f2a8a</MessageID>
<Version>967</Version>
</GeteBayOfficialTimeRequest>
</soap:Body>
</soap:Envelope>
<!DOCTYPE HTML PUBLIC "//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD><BODY>
<H1>Not Found</H1>
The requested URL /apiv3intl.html was not found on this server.<P>
</BODY></HTML>
[8/22/2006 12:34:10 PM, Error]
Client found response content type of 'text/html; charset=iso88591', but expected 'text/xml'.
From the response, you will see that you have received a html 404 error. This gives us the hint that something is wrong in our url to which we are making the request. Examining the first line of our request:
[8/22/2006 12:34:09 PM, Informational]https://api.ebay.com/ws/api.dll?callname=GeteBayOfficialTime&siteid=0&client=netsoap&appid=AppID
it becomes obvious that the url is incorrect. To send a SOAP / SDK request, we need to use https://api.ebay.com/wsapi instead of https://api.ebay.com/ws/api.dll
If you are already using the correct URL, and you are still seeing this problem, please refer to the guidelines set forth in this knowledge base article:
Version Info
The code example above was based on the versions specified below:
API Schema Version | 967 |
.NET SDK Version | .NET SDK v549.0 full release |
Additional Resources