{{tag>category:"OpenInsight 32-bit" author:"Kevin Bolitho" author:"Carl Pates" author:"carl pates"}} [[https://www.revelation.com/the-works|Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community]] ==== IE browser OLE - Sending PostData and Headers (OpenInsight 32-bit) ==== === At 02 FEB 2012 05:12:12PM Kevin Bolitho wrote: === I need to present a URL to the user and at the same time supply data and a header to the asp server. Using the IE OLE in my window the URL displays fine using CALL Send_Message(WinID:".BROWSER","Navigate2",URL) to navigate to the URL. I see that the navigate2 method allows for this postdata and headers( ie object.Navigate2( _URL As Variant, _ [Flags As Variant,] _ [TargetFrameName As Variant,] _ [PostData As Variant,] _ [Headers As Variant])) Question is - Does anyone know how to supply PostData and Header data to the Navigate2 method ??? If so - how?? Thanks in advance ---- === At 03 FEB 2012 05:40AM Carl Pates wrote: === Kevin, You probably need to use the "Single Argument" form of Send_Message which normally only allows you to pass four arguments and for the full Navigate2 method you'll need five. Here's an example: $insert logical url = "http://www.myserver.com/somepage.asp" flags = 0 target = "_self" postData = "A=1234&b=wibble&c=etc" hdrs = "myhdr: someVal" : \0A\ : "another-hdr: whatever" navData = url : @fm : flags : @fm : target : @fm : postData : @fm : hdrs call send_Message( winID : ".BROWSER", "OLE.Navigate2" : @fm : TRUE$, navData ) Notice the TRUE$ tacked onto the end of the "OLE.Navigate2" message name - this tells OI to expect all the arguments to be passed in a single @fm delimited string, rather than separately. Not tested any of this by the way so do let us know if it works :) [email=cpates@sprezzatura.com]Carl Pates[/email] [url=http://www.sprezzatura.com]Sprezzatura[/url] [url=http://www.sprezzatura.com/blog]The Sprezzatura Blog[/url] [i]World leaders in all things RevSoft[/i] [img]http://www.sprezzatura.com/zz.gif[/img] ---- === At 07 FEB 2012 04:14PM Kevin Bolitho wrote: === Thanks Carl - I have forgotten about passing extra parameters in this way. I will try out over the next few days and let you know. Cheers Kevin ---- === At 08 FEB 2012 08:09PM Kevin Bolitho wrote: === Carl, I have tried the code idea of yours. Almost works. My application of this is below. What I find is that if the postHeader contains a Content-Type or 'Content-Length item the call to the Navigate (or Navigate2 for that matter) method fails to render any htm (don't think it even calls the asp server)l. If the PostHeader is null then the method does render html but does send data that can be used at the other end (asp server). Any Ideas on what is happening here / why I cant seem to assign header items ??? Thanks Kevin *===========================> flags = 0 target = "_self" PostData = "filename1=noheader.gif&filedata1=R0lGODlhEAAQAIABAP8AAP///y" URL = "http://pilot.bestpractice.org.nz/nl_acc_arezzo.asp?numForm=831&guideline=acc_acc32 postHeader := 'Host: pilot.bestpractice.org.nz':\0A\ postHeader := 'Content-Type: application/x-www-form-urlencoded':\0A\ postHeader := 'Content-Length: ':LEN(PostData) navData = URL : @fm : flags : @fm : target : @fm : postData : @fm : postHeader CALL Send_Message( winID : ".BROWSER", "OLE.Navigate" : @fm : TRUE$, navData ) *===========================> ---- === At 09 FEB 2012 08:38AM Carl Pates wrote: === Hi Kevin, You could try changing the delimiters to \0D0A\ as this is a more standard line-delimiter in MS systems. Another thing I would look at is what the web-browser control is actually sending, and for this I'd install [url=http://fiddler2.com]Fddler[/url]. Sometimes what you get at your server is not what you got sent :) [email=cpates@sprezzatura.com]Carl Pates[/email] [url=http://www.sprezzatura.com]Sprezzatura[/url] [url=http://www.sprezzatura.com/blog]The Sprezzatura Blog[/url] [i]World leaders in all things RevSoft[/i] [img]http://www.sprezzatura.com/zz.gif[/img] ---- === At 09 FEB 2012 04:07PM Kevin Bolitho wrote: === Using delimiter of \0D0A\ no change. Using Fiddler I see the header content seems to exist correctly, now ever the request is a GET not a POST. I wonder if the problem is that the Navigate method is not seeing the postdata thus decides on a GET rather than a POST? ---- === At 09 FEB 2012 04:53PM Kevin Bolitho wrote: === From trawling the web I see that the postdata must me a type SAFEARRAY. Any idea what that would be in OI terms?? ---- === At 10 FEB 2012 06:24AM carl pates wrote: === Hi Kevin, That's going to be a problem. Send_Message only translates the arguments passed onto OLE BSTRs - it doesn't deal with setting up an OLE array in the current version (this could be a possible enhancement for version 10) In the meantime you might be better POST'ing your request using a non-visual OLE component (see the OLE_GET_WEBPAGE() stored procedure for an example) and then loading the results of this directly into your Web Browser control? [email=cpates@sprezzatura.com]Carl Pates[/email] [url=http://www.sprezzatura.com]Sprezzatura[/url] [url=http://www.sprezzatura.com/blog]The Sprezzatura Blog[/url] [i]World leaders in all things RevSoft[/i] [img]http://www.sprezzatura.com/zz.gif[/img] ---- === At 10 FEB 2012 02:20PM Kevin Bolitho wrote: === Yes that's what I thought would be the case. Thanks for your help with this. [[https://www.revelation.com/revweb/oecgi4p.php/O4W_HANDOFF?DESTN=O4W_RUN_FORM&INQID=WORKS_READ&SUMMARY=1&KEY=FA0CD25700048E77AEDCC5400|View this thread on the Works forum...]]