Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Embedding Internet Explorer, problems with HTTP post
Embedding Internet Explorer, problems with HTTP post [message #248187] Wed, 02 June 2004 03:12 Go to next message
Eclipse UserFriend
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 18:32 Go to previous messageGo to next message
Eclipse UserFriend
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 #248507 is a reply to message #248187] Wed, 02 June 2004 19:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: veronika_irvine.oti.com

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 #248658 is a reply to message #248507] Thu, 03 June 2004 05:35 Go to previous messageGo to next message
Eclipse UserFriend
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 19:51 Go to previous message
Eclipse UserFriend
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
> > >
> > >
> > >
> > >
> > >
> >
> >
>
>
Previous Topic:multipage manifest style editors
Next Topic:Properties naming conventions
Goto Forum:
  


Current Time: Thu Mar 28 12:14:20 GMT 2024

Powered by FUDForum. Page generated in 0.06914 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top