Community Tip - You can change your system assigned username to something more personal in your community settings. X
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
You may want to try parsing it into a datatable as described in the following article: https://www.ptc.com/en/support/article?n=CS218242
Hi @posipova,
Thanks for your reply. I had followed the article you had shared. The first part of the article is to get the XML content and then we'll proceed to the steps where we'll show it in a infotable format. I'm having trouble in the first step itself.
It seems that the service GetXML is failing for only the URL "https://sapes5.sapdevcenter.com/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/ProductSet" i had given. Its working with other common URL's like "https://www.w3schools.com/xml/simple.xml"
But i'm curious how the same URL which was not working for GetXML is working properly for GetJSON.
If there is an issue with the URL or the parameters then both the services shouldn't be working. Is this issue related to SAP or Thingworx?
Regards,
Saran
This looks like it might be a SAP issue. I've looked through our knowledgebase and seems like people have experienced similar situations, where it was determined to be a SAP problem.
Hi @posipova,
Thanks for your reply.
I'm currently using a SAP Gateway - Demo System (ES5) for testing. I'm new to SAP so if you could elaborate on the SAP issue it would be useful.
Regards,
Saran
This is the only documentation/references we have available on SAP integration:
https://community.ptc.com/t5/IoT-Tech-Tips/SAPODataConnector-hands-on-8-0/m-p/534382?sr=stream
https://community.ptc.com/t5/ThingWorx-Developers/SAP-Integration-with-ThingWorx/m-p/503446