[ http://issues.apache.org/jira/browse/AXIS2-299?page=all ]
     
Eran Chinthaka resolved AXIS2-299:
----------------------------------

    Fix Version: 0.94
     Resolution: Fixed

This is already fixed by calling url.getPath(), not url.getFile()

> CommonsHTTPTransportSender duplicates query part of endpoint URL
> ----------------------------------------------------------------
>
>          Key: AXIS2-299
>          URL: http://issues.apache.org/jira/browse/AXIS2-299
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug
>   Components: transports
>     Versions: 0.92
>  Environment: WinXP, JVM 1.4 and JVM 1.5
>     Reporter: Christoph Langguth
>      Fix For: 0.94

>
> 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:
> 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, which is obviously added again afterwards. When 
> the line is commented out, the path remains set correctly, and the 
> querystring appears only once..
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to