Mock REST Services War dynamic url parameters
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2013
07:27 AM
08-07-2013
07:27 AM
Mock REST Services War dynamic url parameters
When we create a war for the Mock REST service and deploy in tomcat, i am not able to pass the dynamic values in the url path for a GET request. Tomcat ignores the url path and throws a default error message.
Say, http://localhost:8080/mockService/Test/{param0}/data is working fine within soapui and i am able to pass dynamic values to param0 in soapui.
When i deploy this service as war in tomcat, it is not recognizing values set for param0 in the url and the response is default soap error message. Tomcat treats this "http://localhost:8080/mockService/Test/{param0}/data" as complete url and renders the response for matching path.
I don't have a choice to change the url pattern as the client code will get affected. Is there a way to handle this type of url for REST mock services or any documentation to check this?
Say, http://localhost:8080/mockService/Test/{param0}/data is working fine within soapui and i am able to pass dynamic values to param0 in soapui.
When i deploy this service as war in tomcat, it is not recognizing values set for param0 in the url and the response is default soap error message. Tomcat treats this "http://localhost:8080/mockService/Test/{param0}/data" as complete url and renders the response for matching path.
I don't have a choice to change the url pattern as the client code will get affected. Is there a way to handle this type of url for REST mock services or any documentation to check this?
6 REPLIES 6
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2013
05:27 AM
08-12-2013
05:27 AM
We had to override the method dispatchRequest (req, res) in MockAsWarServlet to accept the additional parameters in url for REST requests.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2013
01:51 AM
09-12-2013
01:51 AM
Hello gopiharan79,
i have the same problem.
Can you please post your code for the MockAsWarServlet?
i have the same problem.
Can you please post your code for the MockAsWarServlet?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2013
03:29 AM
10-17-2013
03:29 AM
We replaced the line - if( pathInfo.equals( mockRunner.getMockService().getPath() ) )
with if( pathInfo.startsWith( mockRunner.getMockService().getPath() ) ) in dispatchRequest method to accept url parameters.
with if( pathInfo.startsWith( mockRunner.getMockService().getPath() ) ) in dispatchRequest method to accept url parameters.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2013
05:14 PM
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2017
11:40 PM
04-20-2017
11:40 PM
@azan00, do you have the content of the link as it is no more reachable.
Regards,
Rao.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2019
12:25 AM
04-19-2019
12:25 AM
I have the same issue. How did you override it?
