OLE calling method (OpenInsight 32-Bit)
At 26 FEB 2009 06:39:56AM Martin Drenovac wrote:
I have a working piece of HTTP code, which we now have to extend to set a "proxy" param. I have tried everything to call the method correctly, but cannot get past the errors:
Below is the line of code that I need to work, and as you can see from VB example code as well as the extract from VB object viewer I think it's working fine. However always get the same error "Unknown Name":
x=OleCallMethod(oHttp, "setProxy",2,socket)
and here's the code which works other than the new one liner (above) that I'm trying to introduce.
oHttp=OleCreateInstance('MSXML2.SERVERXMLHTTP')
status =oleStatus()if status thenestateE=OleGetProperty(oHttp,'readyState')estatus=OleGetProperty(oHttp,'status')estext =OleGetProperty(oHttp,'statusText')debugcall msg(@window,'Error in OleCreateInstance of SERVERXMLHTTP: ':status)return 0end
* x=oHttp-]Open(method, url, sync$)x=OleCallMethod(oHttp,"Open", method, url, sync$)status=oleStatus()if status thenestateE=OleGetProperty(oHttp,'readyState')estatus=OleGetProperty(oHttp,'status')estext =OleGetProperty(oHttp,'statusText')debugcall msg(@window,'Error in Open: ':status)return 0end
* If you use a proxy server you must configure it
*/*Sub setProxy(proxySetting As SXH_PROXY_SETTING, varProxyServer, varBypassList)Member of MSXML2.ServerXMLHTTPSpecify proxy configuration*/IP=10.30.5.7'PORT=8080socket=ip:":":port
* x=oHttp-]SetProxy(2,(socket));
* x=OleCallMethod(oHttp, "getOption",2,socket) ;* returns 147352562 (8002000E) Invalid number of parameters.
* x=OleCallMethod(oHttp, "getOption",2) ;* returns x=13056, status=0
* x=OleCallMethod(oHttp, "getOption",-1) ;* 147024809 (80070057) One or more arguments are invalid.
* OlePutProperty(oHttp, "setProxy", socket) ;* 2147352570 (80020006) Unknown name
* x=OleCallMethod(oHttp, "setProxy",2,socket) ;* 2147352570 (80020006) Unknown namestatus=oleStatus()debugif status thenestateE=OleGetProperty(oHttp,'readyState')estatus=OleGetProperty(oHttp,'status')estext =OleGetProperty(oHttp,'statusText')debugcall msg(@window,'OLE setProxy failed with error: ':status)return 0end
At 26 FEB 2009 08:19AM Bob Carten wrote:
Martin,
Your script is using 'MSXML2.SERVERXMLHTTP', which will invoke version 2 of the ServerXmlHttp Object. From what I have read, use MSXML2.SERVERXMLHTTP.3.0 or better yet 'MSXML2.SERVERXMLHTTP.6.0'. Do not use 'MSXML2.SERVERXMLHTTP.4.0', or 'MSXML2.SERVERXMLHTTP.5.0'.
So … the number of the counting shall be three. Four shalt thou not count, neither count thou two, excepting that thou then proceed to three. Five is right out. Six is best
At 26 FEB 2009 08:30AM Martin Drenovac wrote:
Bob - you're a "damned" legend (this is in fact a compliment in Oz)..
Thank you very much - status() of 0
- will check it in production and drop you a confirmation note.
Cheers Bob
At 26 FEB 2009 12:32PM DSig wrote:
You made me laugh .. thanks
At 26 FEB 2009 11:34PM Martin Drenovac wrote:
Bob - works perfectly. Thank you again.