hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: What I must put in the URL of post command
Date Tue, 24 Jan 2006 19:10:48 GMT
Hello Fatiha.

Fatiha Lokmane wrote:

> I try to upload file  with the following code in the ActionForm:
>            //attach file                         
> post.setRequestHeader("Content-type", "text/xml;
> charset=ISO-8859-1");                       post.setRequestEntity(new
> InputStreamRequestEntity(inFormFile));

We can't tell you what the server application expects. Take a look at the
available documentation for the server application, contact the owner of
the server application to ask for the required values and format, or use
some sniffer tool to see what other clients (such as browsers) send there.

We have no idea what kind of application it is, we can't tell you. Neither
do we have an idea what you are trying to achieve, so we can't even guess.
Is it a file upload mimicking browser behavior? A SOAP call? Something else?

>                      HttpClient httpclient = new HttpClient();
>                      int statusCode1 = httpclient.executeMethod(post);
>                      System.out.println(post.getResponseBodyAsString());
>             .....
>         This code does not work, the post.getResponseBodyAsString()
> don't print my file.

What makes you think that post.getResponseBodyAsString() should return
your file? You're sending a file to the server, why should the server
send back your file in the response? If you want to see the contents
of your file, just read it from the input stream on the client instead
of sending it to the server.

hope that helps,

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

View raw message