commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew van der Voort" <and...@astarte.co.nz>
Subject [HttpClient] Can't even Post Data
Date Mon, 28 Jun 2004 05:35:04 GMT
Hi. I'm sure I'm doing something wrong, but don't know what...

I have an applet that communicates with a J2EE server. It's going OK with
java.net classes but I am wanting to see if I can make the thing more
robust with the HttpClient package.

We send up a stream of data, which the server reads, assembles into
meaningful data for it, and acts upon it. Usually it returns another
similarly formatted stream of data in return.

Here's what I'm doing:
HttpClient httpClient = new HttpClient();
PostMethod method = new PostMethod(completeURL);
method.setRequestHeader("Content-type", "text/xml; charset=UTF-8");
method.addParameter( "toServer", requestData.getText() );
       
int statusCode = -1;
try
{
  statusCode = httpClient.executeMethod( method );
}
catch (HttpRecoverableException e) 
.
.
.

However when I get to the server, request.getParameter("toServer") is null,
so the data isn't getting sent up. What's wrong with what I've done? I've
seen a few posts that say "use setRequestBody()" but that seems like a
cop-out. I have a parameter, I've set it, why isn't it being sent?

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message