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:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFiRqOYmklbLuW6wYRAk2wAJ9ccVqB+uLmMmllVMhc++UML9h0MQCgrzXJ
OsjoEJcquMV9qRt+JAvq5KQ=
=wml4
-----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]

Reply via email to