Question Krishnaveni Kapu · Jul 25, 2024

Read an XML response

I receive response from Business Operation(HTTP GET) as below :

<response>
<message_code>202</message_code>
<message_string>Success/message_string>
</response>

I am not able to read the "message_code" as response.message_code ?
is it because of underscore ?
Is there a way to read it ?

Comments

Robert Cemper · Jul 25, 2024

edited and simpler

  • if this has an XMl header  <?xml version= ...
  • then ##class(%XML.Reader).OpenString(yourxmlstring) will deposit your input in the local aray %SAX()
0
Steven Hobbs · Jul 25, 2024

Assuming  that response.message_code is part of an ObjectScript expression then you want to evaluate response."message_code" because _ is an ObjectScript operator so you must quote "message_code" to change it into a method or property name.  Otherwise, _ is the string concatenation operator so the value of response.message will be concatenated with the value of code.

0
Enrico Parisi · Jul 26, 2024

You don't provide enough information to help you.

Can you please provide some more detail on how you are "reading" "message_code"?

What kind of object/class and how you load/populate  "response" when you mention "response.message_code"?

What product/version are you using?

0