Saminda,
AFAIK the + character is interchangeable with %20 in HTTP URLs. (This
may not be true for generic URLs, however). As to your example: It's
encoded the wrong way! You must only encode the names and values BETWEEN
the ? = and ; characters! It's generally very wrong to run whole URLs /
the whole Query string through URLEncode. (Lots of people do that wrong
and don't understand what they are doing.)
Ortwin
Saminda Abeyruwan wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Ortwin,
When encoded with URLEncode.encode(); the space character is converted
to "+" sign, {JavaDoc}; but the rfc3986 (section 2.1) says, the "space
character should encoded to %x20". Seem this is a problem in
interoperability. Do you have an insight of this problem.
Ex: "?op=EchoInt;int=4 2;" is encoded to %3Fop%3DEchoInt%3Bint%3D4+2%3B
Thank you
Saminda
Ortwin Glück wrote:
Hi Saminda,
The colon (:) is a reserved character and must therefore be URL-escaped
if it is used for anything else than separating the port from the host.
In your case you should simply run the query part (everything after the
?) through java.net.URLEncoder.encode():
String url =
"http://localhost:8081/axis2/services/ProbeSpaceService.PathsEndpoint?constructReference/datespace/2006/11/18/16:10:00.000Z-19:30:42.000Z.html";
int separator = url.indexOf('?');
String path = url.substring(0, separator);
String query = url.substring(separator+1);
url = path +'?'+ URLEncoder.encode(query, "ASCII");
Cheers
Ortwin
Saminda Abeyruwan wrote:
Hi,
We have a (WSDL2.0) complaint URL
http://localhost:8081/axis2/services/ProbeSpaceService.PathsEndpoint?constructReference/datespace/2006/11/18/16:10:00.000Z-19:30:42.000Z.html
to send. But HttpClient gives me the following exception;
=============================================================================
org.apache.axis2.AxisFault: invalid port number; nested exception is:
org.apache.commons.httpclient.URIException: invalid port number;
nested exception is:
org.apache.axis2.AxisFault: invalid port number; nested exception is:
org.apache.commons.httpclient.URIException: invalid port number
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:497)
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:365)
at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:295)
at
org.example.pathsEndpoint.ProbeSpaceServiceStub.constructReference(ProbeSpaceServiceStub.java:164)
at pathsEndpoint.PathsEndpointClient.main(PathsEndpointClient.java:30)
Caused by: org.apache.axis2.AxisFault: invalid port number; nested
exception is:
org.apache.commons.httpclient.URIException: invalid port number
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:338)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:205)
... 5 more
Caused by: org.apache.commons.httpclient.URIException: invalid port
number
at org.apache.commons.httpclient.URI.parseAuthority(URI.java:2225)
at org.apache.commons.httpclient.URI.parseUriReference(URI.java:1968)
at org.apache.commons.httpclient.URI.<init>(URI.java:165)
at
org.apache.commons.httpclient.HttpMethodBase.getURI(HttpMethodBase.java:261)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:382)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
at
org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:534)
at
org.apache.axis2.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java:174)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:334)
... 6 more
==================================================================================
This is due to the "6:10:00.000Z-19:30:42.000Z.html" part in the URL.
Could you please give me a solution to escape these characters.
Thank you
Saminda
- ---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFpyorYmklbLuW6wYRApBkAJ0XsxRMLq6h552cO9cMlhJTPnI1tQCgxwed
Iq7oUglvnG1G5nNm/K5fSyY=
=4X6v
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
[web] http://www.odi.ch/
[blog] http://www.odi.ch/weblog/
[pgp] key 0x81CF3416
finger print F2B1 B21F F056 D53E 5D79 A5AF 02BE 70F5 81CF 3416
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]