You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Christoph Langguth <ch...@umit.at> on 2005/11/03 16:51:02 UTC
[Axis2] Bug in CommonsHTTPTransportSender
Dear all,
I have been experimenting with Axis2 for WS Client and Server
applications; while building a (synchronous RPC-style) client for
amazon.com webservices, I stumbled across the following bug:
the QueryString from the EndpointReference is duplicated in the POST
request, thus rendering the service unusable. I.e.:
call.setTo(new
EndPointReference("http://webservices.amazon.com/onca/soap?Service=AWSECommerceService"))
results in the following URL being used for the POST request:
http://webservices.amazon.com/onca/soap?Service=AWSECommerceService?Service=AWSECommerceService
Because I really needed this to work, I investigated the code and made
the following change to CommonsHTTPTransportSender (sorry for the
wrapping, it's the email client):
private void transportConfigurationPOST(
MessageContext msgContext,
OMElement dataout,
URL url,
String soapActionString)
throws MalformedURLException, AxisFault, IOException {
//execuite the HtttpMethodBase - a connection manager can be
given for handle multiple
httpClient = new HttpClient();
//hostConfig handles the socket functions..
//HostConfiguration hostConfig =
getHostConfiguration(msgContext, url);
//Get the timeout values set in the runtime
getTimoutValues(msgContext);
// SO_TIMEOUT -- timeout for blocking reads
httpClient.getHttpConnectionManager().getParams().setSoTimeout(soTimeout);
// timeout for initial connection
httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(connectionTimeout);
PostMethod postMethod = new PostMethod(url.toString());
/////////////////////// HERE IS THE CHANGE /////////////////////////
// postMethod.setPath(url.getFile());
////////////////////////////////////////////////////////////////////
msgContext.setProperty(HTTP_METHOD, postMethod);
String charEncoding =
(String) msgContext.getProperty(
MessageContext.CHARACTER_SET_ENCODING);
if(charEncoding == null){
charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
}
it seems that url.getFile() returns the "file" portion of the URL, but
*including* the querystring. When commented out, the path remains set
correctly.
I have tested this with Java 1.4 and 1.5, and as far as I can tell I
didn't notice any drawbacks. There might of course be similar issues in
other parts of the code (asynchronous or In-Only invocations, etc), but
I have not tested this.
I'd be grateful for feedback.
Cheers,
Christoph
PS: I would have filed a bug, but where and how? ;-)
Re: [Axis2] Bug in CommonsHTTPTransportSender
Posted by Davanum Srinivas <da...@gmail.com>.
Bug tracker is here:
http://issues.apache.org/jira/ :)
thanks,
dims
On 11/3/05, Christoph Langguth <ch...@umit.at> wrote:
> Dear all,
>
> I have been experimenting with Axis2 for WS Client and Server
> applications; while building a (synchronous RPC-style) client for
> amazon.com webservices, I stumbled across the following bug:
> the QueryString from the EndpointReference is duplicated in the POST
> request, thus rendering the service unusable. I.e.:
> call.setTo(new
> EndPointReference("http://webservices.amazon.com/onca/soap?Service=AWSECommerceService"))
> results in the following URL being used for the POST request:
> http://webservices.amazon.com/onca/soap?Service=AWSECommerceService?Service=AWSECommerceService
>
> Because I really needed this to work, I investigated the code and made
> the following change to CommonsHTTPTransportSender (sorry for the
> wrapping, it's the email client):
>
> private void transportConfigurationPOST(
> MessageContext msgContext,
> OMElement dataout,
> URL url,
> String soapActionString)
> throws MalformedURLException, AxisFault, IOException {
>
> //execuite the HtttpMethodBase - a connection manager can be
> given for handle multiple
> httpClient = new HttpClient();
> //hostConfig handles the socket functions..
> //HostConfiguration hostConfig =
> getHostConfiguration(msgContext, url);
>
> //Get the timeout values set in the runtime
> getTimoutValues(msgContext);
>
> // SO_TIMEOUT -- timeout for blocking reads
>
> httpClient.getHttpConnectionManager().getParams().setSoTimeout(soTimeout);
> // timeout for initial connection
>
> httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(connectionTimeout);
>
> PostMethod postMethod = new PostMethod(url.toString());
> /////////////////////// HERE IS THE CHANGE /////////////////////////
> // postMethod.setPath(url.getFile());
> ////////////////////////////////////////////////////////////////////
>
> msgContext.setProperty(HTTP_METHOD, postMethod);
>
> String charEncoding =
> (String) msgContext.getProperty(
> MessageContext.CHARACTER_SET_ENCODING);
> if(charEncoding == null){
> charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
> }
>
>
>
>
> it seems that url.getFile() returns the "file" portion of the URL, but
> *including* the querystring. When commented out, the path remains set
> correctly.
>
> I have tested this with Java 1.4 and 1.5, and as far as I can tell I
> didn't notice any drawbacks. There might of course be similar issues in
> other parts of the code (asynchronous or In-Only invocations, etc), but
> I have not tested this.
>
> I'd be grateful for feedback.
> Cheers,
>
> Christoph
>
> PS: I would have filed a bug, but where and how? ;-)
>
--
Davanum Srinivas : http://wso2.com/blogs/