Question
GetXML is giving error for SAP odata URL
Hi Developers,
I'm trying to fetch xml content from this SAP odata ProductSet URL. I had used "GetXML" content loader function
for this and got the below error:
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" headers="accept=application/xml"><code>005056A509B11ED19BEB6513AA349DA5</code><message xml:lang="en">The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request</message></error>
The service code is as follows:
var headers = {
"accept": "application/xml"
}
var params = {
proxyScheme: undefined /* STRING */,
headers: headers /* JSON */,
ignoreSSLErrors: "true" /* BOOLEAN */,
useNTLM: undefined /* BOOLEAN */,
workstation: undefined /* STRING */,
useProxy: undefined /* BOOLEAN */,
withCookies: undefined /* BOOLEAN */,
proxyHost: undefined /* STRING */,
url: "https://sapes5.sapdevcenter.com/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/ProductSet" /* STRING */,
timeout: undefined /* NUMBER */,
proxyPort: undefined /* INTEGER */,
password: <SAP Password> /* STRING */,
domain: undefined /* STRING */,
username: <SAP ES5 Demo System Username> /* STRING */
};
// result: XML
var result = Resources["ContentLoaderFunctions"].GetXML(params);
In the browser the above mentioned URL returns the XML content, so i don't suspect any firewall issue.
I tried the "GetJSON" function for the same URL but with this "?$format=json"string appended to it and the json is returned as expected.
The service code for the GetJSON is as follows:
var headers = {
"accept": "application/xml"
}
var params = {
proxyScheme: undefined /* STRING */,
headers: headers /* JSON */,
ignoreSSLErrors: true /* BOOLEAN */,
useNTLM: undefined /* BOOLEAN */,
workstation: undefined /* STRING */,
useProxy: undefined /* BOOLEAN */,
withCookies: undefined /* BOOLEAN */,
proxyHost: undefined /* STRING */,
url: "https://sapes5.sapdevcenter.com/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/ProductSet?$format=json" /* STRING */,
timeout: undefined /* NUMBER */,
proxyPort: undefined /* INTEGER */,
password: <SAP Password> /* STRING */,
domain: undefined /* STRING */,
username:<SAP Username> /* STRING */
};
// result: JSON
var result = Resources["ContentLoaderFunctions"].GetJSON(params);
Is the params not properly used for GetXML?
Regards,
Saran

