Forum Discussion

kuttysun's avatar
kuttysun
New Contributor
12 years ago

NOT ABLE TO TEST REST SERVICES

I have created one simple REST web service. which s runnin on my tomcat 6.0.32. If I run my web service on the server, I can able to test it from REST client Add on. But when I test the same from Soap UI 3.0 am getting "HTTP Status 404 - Not Found" error. Can anyone please tell me how to resolve it.

Thanks in Advance.

Thanks,
Kutty
  • nmrao's avatar
    nmrao
    Icon for Champion Level 2 rankChampion Level 2
    When you send request from soapui, is it hitting your server and able to see anything in the server logs? What soapui logs say?
  • kuttysun's avatar
    kuttysun
    New Contributor
    Hi Thanks for the reply.If I start the tomcat normally, that time, for GET operation(getting all employees), I can able to get the response. But if I want to get an employee, I have to pass the employee id as input. My resource path is "/EmployeeREST/rest/employees/{id}". I am getting below exception in the soap ui logs.

    Error Logs:

    2013-07-17 12:04:54,369 ERROR [errorlog] Error for path: /EmployeeREST/rest/employees/{id}, QueryString: null
    2013-07-17 12:04:54,369 ERROR [errorlog] org.apache.commons.httpclient.URIException: escaped absolute path not valid
    org.apache.commons.httpclient.URIException: escaped absolute path not valid
    at org.apache.commons.httpclient.URI.setRawPath(URI.java:2837)
    at org.apache.commons.httpclient.URI.parseUriReference(URI.java:2023)
    at org.apache.commons.httpclient.URI.<init>(URI.java:147)
    at org.apache.commons.httpclient.HttpMethodBase.getURI(HttpMethodBase.java:265)
    at com.eviware.soapui.impl.wsdl.endpoint.DefaultEndpointStrategy.filterRequest(DefaultEndpointStrategy.java:137)
    at com.eviware.soapui.impl.wsdl.submit.filters.EndpointStrategyRequestFilter.filterRequest(EndpointStrategyRequestFilter.java:35)
    at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:130)
    at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:122)
    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$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    2013-07-17 12:04:54,371 ERROR [errorlog] org.apache.commons.httpclient.URIException: escaped absolute path not valid
    org.apache.commons.httpclient.URIException: escaped absolute path not valid
    at org.apache.commons.httpclient.URI.setRawPath(URI.java:2837)
    at org.apache.commons.httpclient.URI.parseUriReference(URI.java:2023)
    at org.apache.commons.httpclient.URI.<init>(URI.java:147)
    at org.apache.commons.httpclient.HttpMethodBase.getURI(HttpMethodBase.java:265)
    at com.eviware.soapui.impl.wsdl.submit.transports.http.BaseHttpResponse.<init>(BaseHttpResponse.java:61)
    at com.eviware.soapui.impl.wsdl.submit.transports.http.SinglePartHttpResponse.<init>(SinglePartHttpResponse.java:39)
    at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.createDefaultResponse(HttpClientRequestTransport.java:236)
    at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:192)
    at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:122)
    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$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    2013-07-17 12:04:54,373 ERROR [errorlog] org.apache.commons.httpclient.URIException: escaped absolute path not valid
    org.apache.commons.httpclient.URIException: escaped absolute path not valid
    at org.apache.commons.httpclient.URI.setRawPath(URI.java:2837)
    at org.apache.commons.httpclient.URI.parseUriReference(URI.java:2023)
    at org.apache.commons.httpclient.URI.<init>(URI.java:147)
    at org.apache.commons.httpclient.HttpMethodBase.getURI(HttpMethodBase.java:265)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:383)
    at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:170)
    at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:122)
    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$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)


    Thanks,
    Kutty
  • nmrao's avatar
    nmrao
    Icon for Champion Level 2 rankChampion Level 2
    How the value of {id} is passed in the request. Is it a property?
    For eg if it is a project level property
    ${#Project#id}
  • kuttysun's avatar
    kuttysun
    New Contributor
    I am passing through the Soap UI request. In the request editor I am having the parameter name and value. By using that I am passing to request. But it is not taking the value of the parameter. I am giving the id value as simply 1003. Correct me if I am doing wrong.

    Thanks & Regards
    Kutty
  • kuttysun's avatar
    kuttysun
    New Contributor
    Hi rao,

    Thanks for the reply. Now I can able to test the REST services from my Soap UI. Below are the procedure, how I have done my testing.
    1. If your REST service is running on Apache, then start the apache as normal (./startup.sh) {Don't run the project on server}
    2. For GET operations it will work by default.
    3. For any path parameters, the Click on the resource viewer, there we can give the parameter what we have to pass.
    4. For other HTTP operations, select the Accept media type accordingly.

    Hope this may use full for any new users like me.

    Thanks,
    Kutty P
  • nmrao's avatar
    nmrao
    Icon for Champion Level 2 rankChampion Level 2
    Glad that not only you could proceed with your work and but also sharing the steps followed in order to resolve the issue. Thank you.