commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@bluewin.ch
Subject Re: problem in sending the correct http request
Date Tue, 01 Jun 2004 14:27:21 GMT
Ravi,

Per default HTTP POST uses so called URL-encoding to encode the request body.
To override the default behaviour use PostMethod#setRequestBody(String)

httppost.setRequestBody(
  "XMLMSG=<A1> <B1> abc </B1> <B1> bd</B1> <B2> 1 </B2>
</A1>");
httppost.setRequestHeader("Content-type", "TEXT/PLAIN");

Hope this helps

Oleg



>-- Original Message --
>Reply-To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
>From: "Ravi Mutyala" <ravi.mutyala@gawab.com>
>To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
>Subject: Re: problem in sending the correct http request
>Date: Tue, 01 Jun 2004 14:03:44 GMT
>
>
>
>hi,
>
>Changing request header to
>httppost.setRequestHeader("Content-type", "TEXT/PLAIN");  
>hasn't helped.
>
>I printed the request that I sent with the namevaluepair using
>   
>        String temp =  httppost.getRequestBodyAsString();
>        System.out.println( "Request  Object now is"+ temp);
>I got the requestbody is something below
>XMLMSG=%3CA1%3E+%3CB1%3abc%3C%2FB1%3E+%3CB2%3ECRT%3C%2FB2%3E+%........
>
>what can be the reason for this kind of ouput when i'm expecting
><A1> <B1> abc </B1> <B1> bd</B1> <B2> 1 </B2>
</A1> ?
>
>Is this the way how the POSTed data is sent across? I checked
>out the POST data using an IE plugin and the HTML that is
>working has
>a name value pair XMLMSG and <A1> <B1> abc </B1> <B1> bd</B1>
><B2> 1 </B2> </A1>.
>
>thanks in advance.
>
>/
>Ravi.
>
>
>Oleg Kalnichevski writes:
>
>> Ravi,
>> 
>> If you are lucky setting content type to TEXT/PLAIN
>> 
>> httppost.setRequestHeader("Content-type", "TEXT/PLAIN");
>> 
>> instead of
>> 
>> httppost.setRequestHeader("Content-type", "text/xml;
>> charset=ISO-8859-1");
>> 
>> may do the trick. If you are unlucky, the one sure way to know would be
>> to get hold of the complete HTTP request sent by the browser. There are
>> several possibilities to do so: (1) use a proxy capable of HTTPS
>> proxying (not just tunneling) (2) use a browser plugin that can display
>> request/response headers for a particular HTTP session
>> 
>> In order to see what exactly HttpClient sends across the wire you way
>> want to activate the wire log
>> 
>> http://jakarta.apache.org/commons/httpclient/logging.html
>> 
>> Oleg
>________________________________
>15 Mbytes Free Web-based and  POP3
>Sign up now: http://www.gawab.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
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