Hi,
I am facing the following problem:
I need to create an URL with a QueryString something like:
http://
/index.asp?var1=a&var2=b
POSTmethod
to the webserver! I wonder if this is possible at all, as a querystring is naturally a GET...Otherwise when using GET, I get redirected to a login-page. I checked this with an html-page, which carries a corresponding form - this works with POST Method. I need to get the url or the source of the response page in webdynpro!
is there a way to simulate the html-form?
I think there are jars available, which can sent files to an url - I thought about sending an html-header, as the form-POSTMethod puts the form variables in the html-Header, when sending. Is this possible?
Right now I am using the following classes:
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.*;
I am sending the URL via this:
PostMethod post = new PostMethod(url.toExternalForm());
post.setRequestHeader("Content-type", "text/html; charset=ISO-88591");
HttpClient httpclient = new HttpClient();
int iResultCode = httpclient.executeMethod(post);
msgMgr.reportSuccess("iResultCode = " + iResultCode);
byte[] yaResponse = post.getResponseBody();
msgMgr.reportSuccess("Server response:"+new String(yaResponse));
post.releaseConnection();
does somebody know, if "url.toExternalForm()" creates something like a form, which then again can be sent via POST? right now i get redirected to a login-page. So it seems my postMethod is infact a GET...
any ideas welcome,
thanx matthias