Return-Path: X-Original-To: apmail-axis-java-dev-archive@www.apache.org Delivered-To: apmail-axis-java-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 30256F530 for ; Thu, 28 Mar 2013 12:43:00 +0000 (UTC) Received: (qmail 56602 invoked by uid 500); 28 Mar 2013 12:29:22 -0000 Delivered-To: apmail-axis-java-dev-archive@axis.apache.org Received: (qmail 56474 invoked by uid 500); 28 Mar 2013 12:29:20 -0000 Mailing-List: contact java-dev-help@axis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@axis.apache.org Delivered-To: mailing list java-dev@axis.apache.org Received: (qmail 56410 invoked by uid 99); 28 Mar 2013 12:29:18 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Mar 2013 12:29:18 +0000 Date: Thu, 28 Mar 2013 12:29:16 +0000 (UTC) From: =?utf-8?Q?Miguel_=C3=81ngel_Francisco_Fern=C3=A1ndez_=28JIRA=29?= To: java-dev@axis.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (AXIS2-5489) Encoding GET parameters with '+' character in generated REST clients with WSDL2Java MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AXIS2-5489?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1361= 6210#comment-13616210 ]=20 Miguel =C3=81ngel Francisco Fern=C3=A1ndez edited comment on AXIS2-5489 at = 3/28/13 12:28 PM: ---------------------------------------------------------------------------= -------- Yes, the problem is that I can't send the + symbol in a GET parameter. For = example, if I want to send the string "a+b", I can't, because the + symbol = is not encoded, and it is interpreted as a blank space in the server. This is an example that you can use to reproduce the problem: ---------------------------------------------------------------------------= --------------- WSDL ---------------------------------------------------------------------------= --------------- Example Example operation. HTTP binding for the Sample service. Sample service. ---------------------------------------------------------------------------= --------------- XSD ---------------------------------------------------------------------------= --------------- Params for operation foo. Response of operation foo. ---------------------------------------------------------------------------= --------------- wsdl2java command line ---------------------------------------------------------------------------= --------------- ./wsdl2java.sh -wv 2 -uw -o /tmp/output -uri /tmp/sample.wsdl ---------------------------------------------------------------------------= --------------- Java client using the generated JAR file: Sample-test-client.jar ---------------------------------------------------------------------------= --------------- public class Main { public static void main(String[] args) { try { SampleStub sampleStub =3D new SampleStub(); =20 /* * Invoking the operation with "a b", AXIS2 makes the following= HTTP * request: *=20 * GET /foo?bar=3Da%20b HTTP/1.1 * Content-Type: application/x-www-form-urlencoded; charset=3DU= TF-8 * SOAPAction: "" * User-Agent: Axis2 * Host: www.sample.com *=20 * This request is correct because it encodes the space as "%20= ". */ sampleStub.foo("a b"); =20 /* * Invoking the operation with "a+b", AXIS2 makes the following= HTTP * request: *=20 * GET /foo?bar=3Da+b HTTP/1.1 * Content-Type: application/x-www-form-urlencoded; charset=3DU= TF-8 * SOAPAction: "" * User-Agent: Axis2 * Host: www.sample.com *=20 * This request is incorrect because it does not encode the + * symbol, it should invoke: GET /foo?bar=3Da%2Bb HTTP/1.1. */ sampleStub.foo("a+b"); =20 /* * Invoking the operation with "a%2Bb", AXIS2 makes the followi= ng HTTP * request: *=20 * GET /foo?bar=3Da%252Bb HTTP/1.1 * Content-Type: application/x-www-form-urlencoded; charset=3DU= TF-8 * SOAPAction: "" * User-Agent: Axis2 * Host: www.sample.com *=20 * This request is correct because it encodes the symbol % as * space as "%25". */ sampleStub.foo("a%2Bb"); } catch(Exception e) { e.printStackTrace(); } } } =20 was (Author: miguelafr): Yes, the problem is that I can't send the + symbol in a GET parameter. = For example, if I want to send the string "a+b", I can't, because the + sym= bol is not encoded, and it is interpreted as a blank space in the server. This is an example that you can use to reproduce the problem: ---------------------------------------------------------------------------= --------------- WSDL ---------------------------------------------------------------------------= --------------- Example Example operation. HTTP binding for the Sample service. Sample service. ---------------------------------------------------------------------------= --------------- XSD ---------------------------------------------------------------------------= --------------- Params for operation foo. Response of operation foo. ---------------------------------------------------------------------------= --------------- wsdl2java command line ---------------------------------------------------------------------------= --------------- ./wsdl2java.sh -wv 2 -uw -o /tmp/output -uri /tmp/sample.wsdl ---------------------------------------------------------------------------= --------------- Java client using the generated JAR file: Sample-test-client.jar ---------------------------------------------------------------------------= --------------- public class Main { public static void main(String[] args) { try { SampleStub sampleStub =3D new SampleStub(); =20 /* * Invoking the operation with "a b", AXIS2 do the following HT= TP * request: *=20 * GET /foo?bar=3Da%20b HTTP/1.1 * Content-Type: application/x-www-form-urlencoded; charset=3DU= TF-8 * SOAPAction: "" * User-Agent: Axis2 * Host: www.sample.com *=20 * This request is correct because it encodes the space as "%20= ". */ sampleStub.foo("a b"); =20 /* * Invoking the operation with "a+b", AXIS2 do the following HT= TP * request: *=20 * GET /foo?bar=3Da+b HTTP/1.1 * Content-Type: application/x-www-form-urlencoded; charset=3DU= TF-8 * SOAPAction: "" * User-Agent: Axis2 * Host: www.sample.com *=20 * This request is incorrect because it does not encode the + * symbol, it should invoke: GET /foo?bar=3Da%2Bb HTTP/1.1. */ sampleStub.foo("a+b"); =20 /* * Invoking the operation with "a%2Bb", AXIS2 do the following = HTTP * request: *=20 * GET /foo?bar=3Da%252Bb HTTP/1.1 * Content-Type: application/x-www-form-urlencoded; charset=3DU= TF-8 * SOAPAction: "" * User-Agent: Axis2 * Host: www.sample.com *=20 * This request is correct because it encodes the symbol % as * space as "%25". */ sampleStub.foo("a%2Bb"); } catch(Exception e) { e.printStackTrace(); } } } =20 > Encoding GET parameters with '+' character in generated REST clients with= WSDL2Java > -------------------------------------------------------------------------= ---------- > > Key: AXIS2-5489 > URL: https://issues.apache.org/jira/browse/AXIS2-5489 > Project: Axis2 > Issue Type: Bug > Components: kernel, transports > Affects Versions: 1.6.2 > Environment: Ubuntu > Reporter: Miguel =C3=81ngel Francisco Fern=C3=A1ndez > Priority: Blocker > Labels: +, GET, REST, encode, > Fix For: 1.6.2 > > Original Estimate: 2h > Remaining Estimate: 2h > > Using the wsdl2java tool to generate a Java client to access a REST web s= ervice described with a WSDL 2.0, the generated client does not encode the = symbol '+' in GET parameters. > For example, if I have an URL "/get_url", and I set the parameter "param"= to "x+x", the symbol "+" is not encoded, and therefore it is interpreted a= s a space on the server ("x x"). If I try to send the parameter encoded, i.= e., "%2B", then "%252B" is received in the server. > Therefore, it is not possible to send the '+' symbol in a GET parameter. > I guess that it is caused by the definition of the field LEGAL_CHARACTERS= _IN_QUERY in the interface org.apache.axis2.description.WSDL2Constants, whi= ch is set to "-._~!$'()*+,;=3D:@/?" -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org For additional commands, e-mail: java-dev-help@axis.apache.org