Forum Discussion

gvalenc's avatar
gvalenc
New Contributor
14 years ago

Parameters with space result in URL truncation of REST reque

I have a REST resource with a parameter /groups/{groupName}?username=user. If groupName has a space in it, an exception is thrown and then the actual request that is sent is truncated (notice most of the resource path is gone).

GET https://<server>:9443/myapp_ui/jaxrs?username=userA HTTP/1.1
Accept-Encoding: gzip,deflate

Here is the exception (index 50 is the space after group):

Fri Apr 27 09:34:00 PDT 2012:ERROR:java.net.URISyntaxException: Illegal character in path at index 50: https://<server>:9443/myapp_ui/jaxrs/groups/group A
java.net.URISyntaxException: Illegal character in path at index 50: https://<server>:9443/myapp_ui/jaxrs/groups/group A
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.checkChars(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.<init>(Unknown Source)
at org.apache.http.client.utils.URIUtils.createURI(URIUtils.java:106)
at com.eviware.soapui.impl.wsdl.submit.filters.HttpRequestFilter.filterHttpRequest(HttpRequestFilter.java:226)
at com.eviware.soapui.impl.wsdl.submit.filters.RestRequestFilter.filterRestRequest(RestRequestFilter.java:39)
at com.eviware.soapui.impl.wsdl.submit.filters.AbstractRequestFilter.filterAbstractHttpRequest(AbstractRequestFilter.java:39)
at com.eviware.soapui.impl.wsdl.submit.filters.AbstractRequestFilter.filterRequest(AbstractRequestFilter.java:31)
at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:177)
at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:123)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

7 Replies

  • gvalenc's avatar
    gvalenc
    New Contributor
    So I think this is not related to the space in the URL but actually caused by having too complex a path in the endpoint. If I have anything beyond the host and port in the endpoint, e.g. https://<server>:<ip>/myapp_ui/jaxrs, and then create resources based on this, I see the truncation occur.

    If I limit the endpoint to just https://<server>:<ip> and modify the resources to prepend /myapp_ui/jaxrs, it works fine. I didn't see anything in the docs that required the endpoint to be limited in such a way though.
  • gvalenc's avatar
    gvalenc
    New Contributor
    It automatically does the encoding. That isn't the problem. The problem occurs if the endpoint has additional paths after the hostname and port.
  • marwanzo's avatar
    marwanzo
    New Contributor
    This used to work fine in 3.6.1 wondering what changed in 4.5.0. Any updates on this issues?
  • marwanzo's avatar
    marwanzo
    New Contributor
    I think that the issues is with https://<server>:9443 the colon ":" which does not make sense, I tried the same rest request on 3.6.1 without the port number and it worked fine.
  • I am also getting this error with SOAP UI 4.5.0. I am trying to call RESTful Webservice GET method using an URL like http://localhost/abc/xyz/{param}. Here if I give a param value like 'Test Param' ie with a space in between, it resolves to Test+param if encoding is on. This results in URL being truncated to http://localhost. If I disable encoding, I can see 'Test Param' mentioned in Resource/Method field and it also results in same error. So I tried giving 'Test%20Param'. Now its getting encoded to Test%2520Param even though the encoding is disabled. So the server reads it as Test%20Param and thats not what is expected.

    Is there a solution to this issue?
  • andrew_laser's avatar
    andrew_laser
    Occasional Contributor
    +1 also need some solution for this issue. Also reproduced on 4.5.1