How to convert web service request and response into XML and save it into DB?

I have one requirement where i have to convert web service request and response into XML and save it into DB.
I have tried toxml(pv!requestCDT) function but got the below error,
ERROR:An error occurred while evaluating expression: cdtAusCheckRequest.response:toxml(pv!lodgeApplicationResponse) (Expression evaluation error at function 'toxml': Error evaluating function 'toxml' : Cannot convert internal value to XML (target element qname: {AG.AusCheck.IssuingBody/}LodgeApplicationResponse$anonymous). Internal value: TypedValue[it=3552,v={{Failed,,{{{Error,Missing Right To Work Document Travel Document Number},{Error,Missing Right To Work Visa Number},{Error,One of Vessel Name or Flight Number must be provided}}},0,None}}]) (Data Outputs)

Is there any way to convert into xml? Please share your thoughts on this.

OriginalPostID-228346

OriginalPostID-228346

  Discussion posts and replies are publicly visible

Parents
  • The same concept should work with nested structures, but two separate expression rules would be needed. So given two CDTs parentCDT and nestedCDT where parentCDT.childCDT = nestedCDT it might look something like this:

    convertToNestedXML:

    "<nestedCDT>
    <field1>" & ri!nestedCDT.field1& "</field1>
    <field2>" & ri!nestedCDT.field2 & "</field2>
    </nestedCDT>"

    convertToParentXML:

    "<parentCDT>
    <field3>" & ri!nestedCDT.field3& "</field3>"
    &rule!convertToNestedXML( ri!nestedCDT.field2 )&
    "</parentCDT>"

    The end results would produce something like this.

    "<parentCDT>
    <field3>field3</field3>
    <nestedCDT>
    <field1>field1</field1>
    <field2>field2</field2>
    </nestedCDT>
    </parentCDT>"



Reply
  • The same concept should work with nested structures, but two separate expression rules would be needed. So given two CDTs parentCDT and nestedCDT where parentCDT.childCDT = nestedCDT it might look something like this:

    convertToNestedXML:

    "<nestedCDT>
    <field1>" & ri!nestedCDT.field1& "</field1>
    <field2>" & ri!nestedCDT.field2 & "</field2>
    </nestedCDT>"

    convertToParentXML:

    "<parentCDT>
    <field3>" & ri!nestedCDT.field3& "</field3>"
    &rule!convertToNestedXML( ri!nestedCDT.field2 )&
    "</parentCDT>"

    The end results would produce something like this.

    "<parentCDT>
    <field3>field3</field3>
    <nestedCDT>
    <field1>field1</field1>
    <field2>field2</field2>
    </nestedCDT>
    </parentCDT>"



Children
No Data