Home » Eclipse Projects » Eclipse Platform » Embedding Internet Explorer, problems with HTTP post
Embedding Internet Explorer, problems with HTTP post [message #248187] |
Tue, 01 June 2004 23:12  |
Eclipse User |
|
|
|
Originally posted by: deven.persistent.co.in
Hi,
We have an urgent requirement to embed Internet explorer
with our IDE developed using Eclipse. We are using the
webbrowser eclipse plugin to do so. As of now, all "http get"
requests are working fine but sending "http post" requests is
not working. The server on the other side is still getting the
request as "http get". I guess we are not setting up the postData
argument correctly.
There are lot of examples explaining how to create and send
a "get" request but could not find any for "http post".
Does anybody have sample code for this (http post)?
Any help/pointers will be greatly appreciated.
thanks,
Devendra
|
|
|
Re: Embedding Internet Explorer, problems with HTTP post [message #248463 is a reply to message #248187] |
Wed, 02 June 2004 14:32   |
Eclipse User |
|
|
|
Originally posted by: pdrolet.mac.com
Devendra Badhani wrote:
> Hi,
>
> We have an urgent requirement to embed Internet explorer
> with our IDE developed using Eclipse. We are using the
> webbrowser eclipse plugin to do so. As of now, all "http get"
> requests are working fine but sending "http post" requests is
> not working. The server on the other side is still getting the
> request as "http get". I guess we are not setting up the postData
> argument correctly.
>
> There are lot of examples explaining how to create and send
> a "get" request but could not find any for "http post".
>
> Does anybody have sample code for this (http post)?
> Any help/pointers will be greatly appreciated.
>
> thanks,
> Devendra
>
>
>
>
>
Hi,
Here is a way to do a post in code. This is java stuff - not eclipse.
This post is done in code.
// Construct data - I need to encode it in my app.
String data = URLEncoder.encode("logon", "UTF-8") + "=" +
URLEncoder.encode(app.codeAgence, "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$ //$NON-NLS-4$
data += "&" + URLEncoder.encode("old", "UTF-8") + "=" +
URLEncoder.encode(app.passeAgence, "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
data += "&" + URLEncoder.encode("new", "UTF-8") + "=" +
URLEncoder.encode(newPswd, "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
data += "&" + URLEncoder.encode("new2", "UTF-8") + "=" +
URLEncoder.encode(newPswd, "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
// Send data
URL url = new URL("https://" + YOUR_URL); //$NON-NLS-1$ //$NON-NLS-2$
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
Patrice
|
|
| |
Re: Embedding Internet Explorer, problems with HTTP post [message #248658 is a reply to message #248507] |
Thu, 03 June 2004 01:35   |
Eclipse User |
|
|
|
Originally posted by: deven.persistent.co.in
Thanks much Veronika.
I am trying to make it work as per the sample code in the bug report.
Here's the sample code I was experimenting with :
------- <snip> --------
public void testPostRequest(){
int[] httpArgs = webBrowser.getIDsOfNames(new String[]{ "Navigate",
"URL", "Flags", "TargetFrameName", "Postdata", "Headers"});
int dispIdMember = httpArgs[0]; // Navigate
Variant[] paramVals = new Variant[3];
int[] paramNames = new int[3];
paramNames[0] = httpArgs[1]; // URL
paramVals[0] = new Variant("http://10.33.4.68:5555/");
paramNames[1] = httpArgs[5]; // HEADERS
paramVals[1] = new Variant("Content-Type: text/html");
String sPostData = "login=try&password=catch";
paramNames[2] = httpArgs[4]; // PostData
paramVals[2] = new Variant(sPostData);
webBrowser.invoke(dispIdMember, paramVals, paramNames);
}
------- </snip> --------
This webbrowser control generates the the following http request for this :
------------------
GET / HTTP/1.0
Accept: */*
Accept-Language: en-us
Content-Type: text/htmlAccept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR
1.0.3705)
Host: 10.33.4.68:5555
Cache-Control: max-age=259200
Connection: keep-alive
---------------------
regards,
Devendra
"Veronika Irvine" <veronika_irvine@oti.com> wrote in message
news:c9la1s$tfe$1@eclipse.org...
> See:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=10977
>
> This might help. If not, post some code example of what you are trying to
> do.
>
> "Devendra Badhani" <deven@persistent.co.in> wrote in message
> news:c9jg4a$i0p$1@eclipse.org...
> > Hi,
> >
> > We have an urgent requirement to embed Internet explorer
> > with our IDE developed using Eclipse. We are using the
> > webbrowser eclipse plugin to do so. As of now, all "http get"
> > requests are working fine but sending "http post" requests is
> > not working. The server on the other side is still getting the
> > request as "http get". I guess we are not setting up the postData
> > argument correctly.
> >
> > There are lot of examples explaining how to create and send
> > a "get" request but could not find any for "http post".
> >
> > Does anybody have sample code for this (http post)?
> > Any help/pointers will be greatly appreciated.
> >
> > thanks,
> > Devendra
> >
> >
> >
> >
> >
>
>
|
|
|
Re: Embedding Internet Explorer, problems with HTTP post [message #249060 is a reply to message #248658] |
Thu, 03 June 2004 15:51  |
Eclipse User |
|
|
|
Originally posted by: veronika_irvine.oti.com
According to the MSDN:
http://msdn.microsoft.com/library/default.asp?url=/workshop/ browser/webbrowser/reference/ifaces/iwebbrowser2/navigate.as p
"The post data specified by PostData is passed as a SAFEARRAY Data Type
structure. The VARIANT should be of type VT_ARRAY and point to a SAFEARRAY
Data Type. The SAFEARRAY Data Type should be of element type VT_UI1,
dimension one, and have an element count equal to the number of bytes of
post data."
Bug 10977 talks about how to get the data out of a safearray of type VT_U1.
You will have to do the reverse and create a safearray of this type. If I
get a few minutes, I will hack up an example but don't wait for me - you can
probably figure this out on your own.
"Devendra Badhani" <deven@persistent.co.in> wrote in message
news:c9mcsj$379$1@eclipse.org...
> Thanks much Veronika.
> I am trying to make it work as per the sample code in the bug report.
>
> Here's the sample code I was experimenting with :
>
> ------- <snip> --------
> public void testPostRequest(){
>
> int[] httpArgs = webBrowser.getIDsOfNames(new String[]{ "Navigate",
> "URL", "Flags", "TargetFrameName", "Postdata", "Headers"});
>
> int dispIdMember = httpArgs[0]; // Navigate
>
> Variant[] paramVals = new Variant[3];
> int[] paramNames = new int[3];
>
>
> paramNames[0] = httpArgs[1]; // URL
> paramVals[0] = new Variant("http://10.33.4.68:5555/");
>
> paramNames[1] = httpArgs[5]; // HEADERS
> paramVals[1] = new Variant("Content-Type: text/html");
>
> String sPostData = "login=try&password=catch";
> paramNames[2] = httpArgs[4]; // PostData
> paramVals[2] = new Variant(sPostData);
>
> webBrowser.invoke(dispIdMember, paramVals, paramNames);
> }
> ------- </snip> --------
>
> This webbrowser control generates the the following http request for this
:
> ------------------
> GET / HTTP/1.0
> Accept: */*
> Accept-Language: en-us
> Content-Type: text/htmlAccept-Encoding: gzip, deflate
> User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR
> 1.0.3705)
> Host: 10.33.4.68:5555
> Cache-Control: max-age=259200
> Connection: keep-alive
> ---------------------
>
> regards,
> Devendra
>
>
> "Veronika Irvine" <veronika_irvine@oti.com> wrote in message
> news:c9la1s$tfe$1@eclipse.org...
> > See:
> > https://bugs.eclipse.org/bugs/show_bug.cgi?id=10977
> >
> > This might help. If not, post some code example of what you are trying
to
> > do.
> >
> > "Devendra Badhani" <deven@persistent.co.in> wrote in message
> > news:c9jg4a$i0p$1@eclipse.org...
> > > Hi,
> > >
> > > We have an urgent requirement to embed Internet explorer
> > > with our IDE developed using Eclipse. We are using the
> > > webbrowser eclipse plugin to do so. As of now, all "http get"
> > > requests are working fine but sending "http post" requests is
> > > not working. The server on the other side is still getting the
> > > request as "http get". I guess we are not setting up the postData
> > > argument correctly.
> > >
> > > There are lot of examples explaining how to create and send
> > > a "get" request but could not find any for "http post".
> > >
> > > Does anybody have sample code for this (http post)?
> > > Any help/pointers will be greatly appreciated.
> > >
> > > thanks,
> > > Devendra
> > >
> > >
> > >
> > >
> > >
> >
> >
>
>
|
|
|
Goto Forum:
Current Time: Tue May 13 09:15:58 EDT 2025
Powered by FUDForum. Page generated in 0.05930 seconds
|