ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

REST and IWS - RPG parameters appearing on the retuned string

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

  • REST and IWS - RPG parameters appearing on the retuned string

    Hello all
    First of all this is the first time i'm dealing with webservices so i'm kinda little confused.

    Iv'e setup up a simple webservice linked to a rpg program with 2 parameters one for input and another for output that receives a xml string and then returns the result in xml as well.

    The thing is that the xml message is passing the output parameter as an element on the returned xml string when it's not supposed to.

    How can we surpess the output parameters on the xml returned message?


    this is the XML example send to the iseries server:
    <?xml version="1.0" encoding="utf-8"?><Document xmlns="urnxsd:PostTransactionRequest:001:001:001">
    <Message> blabla
    </Message>
    </Document>

    and the returned xml on the client:
    <?xml version="1.0" encoding="utf-8" standalone="yes">
    <GETRECRESULT>
    <ALLRESPONSE><Document xmlns="urnxsd:PostTransactionResponse:001:001:001"><MessageR esult>blablaba to you
    </MessageResult></Document></ALLRESPONSE>
    <HTTPSTATUS>0</HTTPSTATUS>
    </GETRECRESULT>

    the client is not expecting the tags in capitals, only the following string
    <Document xmlns="urn:testws:xsd:PostTransactionResponse:001: 001:001"><MessageResult>blablaba to you too
    </MessageResult></Document>


    the input parameters on the rpg program
    D GETREC PR ExtPgm('TESTREST')
    D AllRequest...
    D 5120a
    D AllResponse...
    D 5120a

    thanks in advance.

  • #2
    IWS will automatically convert your output parameters into XML. You are not supposed to do that in your program... thats why you use a tool like IWS, so that it can do the work for you.

    Comment


    • #3
      I'm not sure this is relevant here, but if you have the PGMINFO keyword in the H spec of your program, try adding the *DCLCASE parameter. That will cause RPG to generate the PCML with the same mixed-case names you use in your source. https://ibm.biz/rpgCafe_PCML_enhancements

      Code:
      H PGMINFO(*MODULE:*DCLCASE)

      Comment

      Working...
      X