Hi,
I am trying to call an outgoing REST web service using EXEC_REST_WS and need to POST XML data to the web service. Does anyone have any insight how to do this please?
I have defined the Name, Base URL, etc of the outgoing REST web service in Administration / Web Services / REST Web Services and have set the Content Type to XML.
However, when I call EXEC_REST_WS it seems to insist that I pass JSON input. I cannot see how to pass XML input.
Here's an example of the XML I am trying to send:
<Criteria limit = "7" query = "PART" match-type = "EXACT" ompn = "1">
<Criterion id = "CustomPartID">
<Parameter name = "PARTNO" match-type = "EXACT">MYPARTNO</Parameter>
</Criterion>
</Criteria>
The code I have at the moment is:
Local Char PCOD(100)(1..10),PVAL(100)(1..10),HCOD(100)(1..10),HVAL(100)(1..10)
Local Clbfile CDATA(0), RESHEAD(0),RESBODY(0)
CDATA = '<Criteria limit = "7" query = "PART" match-type = "EXACT" ompn = "1">'
CDATA += '<Criterion id = "CustomPartID"><Parameter name = "PARTNO" match-type = "EXACT">MYPARTNO</Parameter>'
CDATA += '</Criterion></Criteria>'
# Call the web service
RETVAL = func ASYRRESTCLI.EXEC_REST_WS(
& "TPPXMLAPI","POST","/xmlsearch_test.asp",PCOD,PVAL,HCOD,HVAL,CDATA, 0, "",RESHEAD, RESBODY)
When I run this code, I get an error: "Unexpected token < in JSON at position 105"