IMPORT com
IMPORT xml
MAIN
DEFINE req com.HTTPRequest
DEFINE resp com.HTTPResponse
DEFINE doc xml.DomDocument
TRY
LET req = com.HTTPRequest.Create("http://localhost:8090/MyProcess")
CALL req.setMethod("POST") # Perform an HTTP POST method
# Param1 value is 'hello', Param2 value is 'how are you ?'
CALL req.doFormEncodedRequest("Param1=hello&Param2=how are you ?",FALSE)
LET resp = req.getResponse()
IF resp.getStatusCode() != 200 THEN
DISPLAY "HTTP Error ("||resp.getStatusCode()||") ",
resp.getStatusDescription()
ELSE
# Expect a returned content type of the form */xml
LET doc = resp.getXmlResponse()
DISPLAY "HTTP XML Response is : ",doc.saveToString()
END IF
CATCH
DISPLAY "ERROR :",STATUS||" ("||SQLCA.SQLERRM||")"
END TRY
END MAIN