My Test Code
// connect to the OLE object
oleHTTP = CREATE OLEObject
li_rc = oleHTTP.ConnectToNewObject("Msxml2.XMLHTTP.6.0")
If li_rc < 0 Then
httpstatus = li_rc
statusText = oleHTTP.of_ConnectError(li_rc)
MessageBox("Connect Msxml2.XMLHTTP.6.0", string(statusText),StopSign!)
Return False
End If
try
// Initialize the request
oleHTTP.open(Upper(as_Method), as_Url, False, as_userid, as_password)
oleHTTP.setRequestHeader("Content-Type", as_ContentType) // ContentType = "text/plain"
oleHTTP.setRequestHeader( "If-None-Match", string(ll_Rndnumber)) // to avoid reading from cache.
oleHTTP.setRequestHeader( "Cache-Control", "no-cache")
oleHTTP.send(as_SendString) // Worked for POST, but PUT fails with 1223
CATCH ( PBXRuntimeError re )
CATCH ( OLERuntimeError exOLE)
// MessageBox('OLE Error', + exOLE.GetMessage() + '~r~n' + exOLE.description + '~r~n' + exOLE.Source)
CATCH (RuntimeError ex)
// MessageBox('run time ERROR', ex.GetMessage())
FINALLY
MessageBox('HTTP STATUS', string(oleHTTP.status) ) // The status is 1223. This is shown
end try
//--------------------------------------------------------------------------------------
// The code from here is not executed due to PB error R0019
//-------------------------------------------------------------------------------------
// Response status
statusText = oleHTTP.statusText
httpstatus = oleHTTP.status
// Response data
responseHeaders = oleHTTP.getAllResponseHeaders()
responseBody = oleHTTP.responseBody
responseText = oleHTTP.responseText
oleXML = oleHTTP.responseXML
responseXML = oleXML.xml
// disconnect from the OLE object
oleHTTP.DisconnectObject()
Destroy oleHTTP
MessageBox(" HTTP FINAL STATUS", httpstatus) // This part of code not reached
If httpstatus = 204 or httpstatus = 1223 Then
Return True
End If
Return False