You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by gdprao <gd...@yahoo.com> on 2008/04/04 01:46:00 UTC

GET request URL parameters

I have tried the rest style web service with http binding with CXF2.0.3
version.  My service looks as follows. 

	@Get
	@HttpResource(location = "/searchCustomer/{firstName}/{lastName}")
	Customer searchCustomer(@WebParam(name =
"searchInputType")SearchCriteriaType searchInput);

	When I tried with the URL,
	
	http://localhost:8080/myapp/services/searchCustomer/foo_first/bar_last

	I got the correct output.  

	But I would like to use request parameters query string as follows.

   
http://localhost:8080/myapp/services/searchCustomer?firstName=foo_first&lastName=bar_last

	But the service is failed with the following Exception:

org.apache.cxf.interceptor.Fault: Invalid URL/Verb combination. Verb: GET
Path: /searchCustomer
	at
org.apache.cxf.binding.http.interceptor.DispatchInterceptor.handleMessage(DispatchInterceptor.java:74)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
	at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:73)
	at
org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDestination.java:79)
	at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:256)
	at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:123)
	at
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:170)
	at
org.apache.cxf.transport.servlet.AbstractCXFServlet.doGet(AbstractCXFServlet.java:152)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)

	I would like to know is there any way can I configure CXF web service to
use query strings?  Because I suspect there could be special characters or
white spaces in the parameters which might break the URL if I follow the
first approach.  If I use request parameters as query string I can use
proper encoding for parameters provided by JSTL taglibs.

Thanks,
Durga

	

-- 
View this message in context: http://www.nabble.com/GET-request-URL-parameters-tp16476108p16476108.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: GET request URL parameters

Posted by Sergey Beryozkin <se...@iona.com>.
Hi

CXF HttpBinding can be considered deprecated as it has not been supported for a while.
I'd recommend you to try a JAX-RS approach, multiple query parameters are supported there...

Cheers, Sergey


> 
> I have tried the rest style web service with http binding with CXF2.0.3
> version.  My service looks as follows. 
> 
> @Get
> @HttpResource(location = "/searchCustomer/{firstName}/{lastName}")
> Customer searchCustomer(@WebParam(name =
> "searchInputType")SearchCriteriaType searchInput);
> 
> When I tried with the URL,
> 
> http://localhost:8080/myapp/services/searchCustomer/foo_first/bar_last
> 
> I got the correct output.  
> 
> But I would like to use request parameters query string as follows.
> 
>   
> http://localhost:8080/myapp/services/searchCustomer?firstName=foo_first&lastName=bar_last
> 
> But the service is failed with the following Exception:
> 
> org.apache.cxf.interceptor.Fault: Invalid URL/Verb combination. Verb: GET
> Path: /searchCustomer
> at
> org.apache.cxf.binding.http.interceptor.DispatchInterceptor.handleMessage(DispatchInterceptor.java:74)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
> at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:73)
> at
> org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDestination.java:79)
> at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:256)
> at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:123)
> at
> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:170)
> at
> org.apache.cxf.transport.servlet.AbstractCXFServlet.doGet(AbstractCXFServlet.java:152)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
> 
> I would like to know is there any way can I configure CXF web service to
> use query strings?  Because I suspect there could be special characters or
> white spaces in the parameters which might break the URL if I follow the
> first approach.  If I use request parameters as query string I can use
> proper encoding for parameters provided by JSTL taglibs.
> 
> Thanks,
> Durga
> 
> 
> 
> -- 
> View this message in context: http://www.nabble.com/GET-request-URL-parameters-tp16476108p16476108.html
> Sent from the cxf-user mailing list archive at Nabble.com.

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland