OLE_GETWEBPAGE functionality (OpenInsight 32-bit)
At 11 DEC 2012 01:57:57AM Matthew Jones wrote:
OI 9.3.1
Using OLE_GETWEBPAGE on an IBM WebFacing based website URL is returning the following error message:
WF0095: WebFacing requires Internet Explorer 5.5 or greater.This is the command I used:
retVal = ole_getwebpage( url )Is there anything I am missing that needs to be set before calling the function?
Also, can I use OLE_GETWEBPAGE to get data from a web page that require login credentials, and if so, how?
Any suggestions would be greatly appreciated.
Thanks and cheers,
Matt Jones.
At 11 DEC 2012 02:16PM Jared Bratu wrote:
Matt,
The OLE_GetWebPage function relies on one of the three following COM controls:
Msxml2.ServerXMLHTTP.6.0
Msxml2.ServerXMLHTTP.3.0
Msxml2.ServerXMLHTTP
The first, most specific control that can be created is used to fetch the web page. If none of the three controls are available you should get a get_status() error of "Unable to create XML object". Since you aren't getting that error the control must be getting created but not working properly.
Try running the following code snippet.
ProgId = 'Msxml2.ServerXMLHTTP.6.0' oHttp = OleCreateInstance(progid) test = oHttp->ReadyState status = OleStatus()Does OleStatus() return 0?
At 11 DEC 2012 02:54PM bshumsky wrote:
OI 9.3.1
Using OLE_GETWEBPAGE on an IBM WebFacing based website URL is returning the following error message:
WF0095: WebFacing requires Internet Explorer 5.5 or greater.This is the command I used:
retVal = ole_getwebpage( url )Is there anything I am missing that needs to be set before calling the function?
Also, can I use OLE_GETWEBPAGE to get data from a web page that require login credentials, and if so, how?
Any suggestions would be greatly appreciated.
Thanks and cheers,
Matt Jones.
HI, Matt. It seems (from the return message) that the IBM web site is not expecting to be queried by non-browser clients; I would imagine it's looking for the "User Agent" string that indicates a browser running IE5 or better. Can you find out if there is a different URL available to service programmatic (non-browser) requests? If not, I imagine you will need to "fake" the fact that you are not coming from the browser.
Looking on-line, I see that this url indicates the web developers may be able to set one of the web facing XML parameters so that this error is not generated:
An unsupported browser is one with which the product has not been tested. When you use an unsupported browser, you receive error message WF0095. If you want your WebFacing application to run in the unsupported browser without having the error message issued, set the web.xml variable WFIgnoreBrowserTypeCheck to true. However, this should only be used for development and testing of projects. Running the project in an unsupported browser in production is not recommended.
Hope that helps,
- Bryan Shumsky
At 12 DEC 2012 05:17AM Carl Pates wrote:
Hi Matthew,
Do you have the source to OLE_GETWEBPAGE? I believe it was supplied with the product at some point - it's a very simple wrapper around the OLE ServerXMLHTTPRequest object as Jared mentioned (if you don't let me know and I'll post you an equivalent).
If you do you should be able to copy and modify it to set your own "User-Agent" string in the request header using the setRequestHeader() method.
e.g.
objSXH = oleCreateInstance( "Msxml2.ServerXMLHTTP.6.0" ) ... etc ... hr = objSXH->SetRequestHeader( "User-Agent", "Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))" ) ... etc....Check out http://www.useragentstring.com/ for more user-agent string examples.
World leaders in all things RevSoft
At 12 DEC 2012 08:41AM bshumsky wrote:
Hi Matthew,
Do you have the source to OLE_GETWEBPAGE? I believe it was supplied with the product at some point - it's a very simple wrapper around the OLE ServerXMLHTTPRequest object as Jared mentioned (if you don't let me know and I'll post you an equivalent).
If you do you should be able to copy and modify it to set your own "User-Agent" string in the request header using the setRequestHeader() method.
e.g.
objSXH = oleCreateInstance( "Msxml2.ServerXMLHTTP.6.0" ) ... etc ... hr = objSXH->SetRequestHeader( "User-Agent", "Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))" ) ... etc....Check out http://www.useragentstring.com/ for more user-agent string examples.
World leaders in all things RevSoft
Looking at the latest OLE_GETWEBPAGE functionality, Matt can even pass in the header information without having to go to the source. The currently-shipping (and, I believe, available in 9.3.1) version has the following interface:
Function OLE_GETWEBPAGE(url, method, payload, credentials, headers)
where url is the URL parameter (no surprise there
), method is an optional string of either "GET" or "POST" (the default is "GET"), payload is the optional data that is "posted" if the method is a POST, credentials are the optional username:@FM:password if proxy authentication is being used, and headers are the optional header strings.
The header parameter is a set of @VM delimited header names in field 1, and the associated values in field 2. So using Carl's example:
headers = "" headers<1> = "User-Agent" headers<2> = "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)" rslt = OLE_GETWEBPAGE(URL, "", "", "", headers)- Bryan Shumsky