How to understand the HTTPRequest Error Object reference required
I am trying to call to a website that renders a xml structure as a response.if I put the url on the browser an xml rendered page is returned but if i call to this using the below code I get an object reference error which I am finding had to understand is there anyone who could help understand this error or point me in the right direction thanks.
Set httpRequest = ##class(%Net.HttpRequest).%New() Set httpRequest.Server = "msedgewebdriverstorage.blob.core.windows.net"
Set httpRequest.Port=443
Set httpRequest.ContentType ="application/octet-stream"
;;"application/xml"
Set httpRequest.SSLConfiguration="Open"
Set httpRequest.Https=1
Do httpRequest.Get("/edgewebdriver"_$C(63)_"comp=list")
Do $System.OBJ.Dump(httpRequest.HttpResponse)
please note the SSL is just an empty SSL configuration to be able to use https
Comments
I have no idea, from which error you talk.
ClassMethod MyRequest()
{
set req = ##class(%Net.HttpRequest).%New()
set req.Server = "msedgewebdriverstorage.blob.core.windows.net"
set req.SSLConfiguration="Open"
set req.Https=1
do req.Get("/edgewebdriver/?comp=list")
set rsp=req.HttpResponse
if rsp.StatusCode=200 {
write "Data Size: ",rsp.Data.Size,!
write "Dumping the first 256 bytes..." zzdump rsp.Data.Read(256)
} else {
write "Return Code: ",rsp.StatusCode,!
write "Resp.Phrase: ",rsp.ReasonPhrase,!
}
quit rsp
}The output is just fine... no errors.
do ##class(...).MyRequest() --->
Data Size: 1832857
Dumping the first 256 bytes...
0000: EF BB BF 3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E <?xml version
0010: 3D 22 31 2E 30 22 20 65 6E 63 6F 64 69 6E 67 3D ="1.0" encoding=
0020: 22 75 74 66 2D 38 22 3F 3E 3C 45 6E 75 6D 65 72 "utf-8"?><Enumer
0030: 61 74 69 6F 6E 52 65 73 75 6C 74 73 20 43 6F 6E ationResults Con
0040: 74 61 69 6E 65 72 4E 61 6D 65 3D 22 68 74 74 70 tainerName="http
0050: 73 3A 2F 2F 6D 73 65 64 67 65 77 65 62 64 72 69 s://msedgewebdri
0060: 76 65 72 73 74 6F 72 61 67 65 2E 62 6C 6F 62 2E verstorage.blob.
0070: 63 6F 72 65 2E 77 69 6E 64 6F 77 73 2E 6E 65 74 core.windows.net
0080: 2F 65 64 67 65 77 65 62 64 72 69 76 65 72 2F 22 /edgewebdriver/"
0090: 3E 3C 42 6C 6F 62 73 3E 3C 42 6C 6F 62 3E 3C 4E ><Blobs><Blob><N
00A0: 61 6D 65 3E 31 30 30 2E 30 2E 31 31 35 34 2E 30 ame>100.0.1154.0
00B0: 2F 65 64 67 65 64 72 69 76 65 72 5F 61 72 6D 36 /edgedriver_arm6
00C0: 34 2E 7A 69 70 3C 2F 4E 61 6D 65 3E 3C 55 72 6C 4.zip</Name><Url
00D0: 3E 68 74 74 70 73 3A 2F 2F 6D 73 65 64 67 65 77 >https://msedgew
00E0: 65 62 64 72 69 76 65 72 73 74 6F 72 61 67 65 2E ebdriverstorage.
00F0: 62 6C 6F 62 2E 63 6F 72 65 2E 77 69 6E 64 6F 77 blob.core.window
You have to work with the Data property of the response object (which is a 1.8MB stream)
Having tested this outside a restricted environment I realised my problem was the proxy server as the htttpResponse was not being instantiated, the work around was to use the proxy sever and running everything through the proxy tunnel.
{
set tSC=$$$OK
set req = ##class(%Net.HttpRequest).%New()
set req.Server = "msedgewebdriverstorage.blob.core.windows.net"
set req.ProxyPort=**
set req.ProxyServer="*******"
set req.ProxyHTTPS=1
set req.ProxyTunnel=1
set req.SSLConfiguration="Open" do:tSC req.Get("/edgewebdriver/?comp=list") Do $System.OBJ.Dump(req.HttpResponse)
quit tSC
}