ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

http_post_xml API

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • http_post_xml API

    Hello Everyone,
    I am using an external tool to generate an XML payload and send it to destination web service with help of http_post_xml API.
    Could see log file created with response as 200. However return code (rc) from API shows as 500 and so program marks it as an error.
    Not sure if I am missing something. Please advice.

    Thanks!

  • #2
    The only reason you'd get a return code of 500 would be if the HTTP server is sending that code.

    Can you show us the log? And tell us how you're getting 500 when it says 200?

    Comment


    • #3
      Hello Scott, As per your suggestion in Monthly Dinner meeting - did install the latest version of HTTP API & started using http_string. It works really great - Thank you!

      Got into a situation where field names are not matching between response XML and declared variable in program - Received RNX0353, Reason code 1 during execution of below xml-into statement.
      This response is sent by an external party.

      xml-into codeField %xml(resp: 'case=any +
      ns=remove path=s:Envelope/s:Body/+
      a:responseStatusField/a:errorField/+
      a:ResponseStatusError/a:codeField');

      XML field name is a:codeField, where as RPG does not allow : in field names. Could you please suggest how to proceed in this case.
      Also is there a possibility to remove prefixes, like namespaces - so instead of s:Envelope, we consider it to be Envelope?

      Comment


      • #4
        I was able to resolve the error by removing the prefixes as below:
        xml-into codeField %xml(resp: 'case=any +
        ns=remove path=Envelope/Body/+
        responseStatusField/errorField/+
        ResponseStatusError/codeField');

        Believe I am doing the right way.

        Comment

        Working...
        X