how to handle chinese in ETM API
When post requests to ETM API to create test cases or test scripts, the request body contains Chinese error reports.
"The element type "ns2:steps" must be terminated by the matching end-tag "</ns2:steps>", After encoding Chinese in utf-8, the same error occurs. How to include Chinese in the request body and display it normally in the system
One answer
Your POST request has a
Content-Type
header of application/rdf+xml
but the body is not valid RDF/XML. You can use online RDF validation/conversion tools such as https://www.easyrdf.org/converter to check.
Comments
Hi, David Honey
Still the same error after converting to rdf+xml
Your XML is not well formed. If I copy what you provided into https://codebeautify.org/xml-parser-online I see it has errors. For example,
<ns2:testscript xmlns:ns2="http://jazz.net/xmlns/alm/qm/v0.1/"
is missing the closing
>
. The validator reports:
I suggest you use online validators to make make sure that your POST body content is well-formed.
Comments
David Honey
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jul 10 '23, 4:09 a.m.As with all questions about REST APIs, please provide details of the request URI, request headers, request body (if applicable), and the response body and headers you got.
zjx zjx
Jul 10 '23, 4:26 a.m.request url:https://localhost/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project>/testscript
zjx zjx
Jul 10 '23, 4:32 a.m.reponse header:{'Date': 'Mon, 10 Jul 2023 08:27:41 GMT', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains; preload, max-age=31536000', 'X-Powered-By': 'Servlet/3.1', 'x-com-ibm-team-scenario': '192.168.22.1', 'Connection': 'close', 'Transfer-Encoding': 'chunked', 'Content-Type': 'application/xml', 'Content-Language': 'en-US'}