users@jax-ws.java.net

Re: Q. RESTful Web Service and QUERY_STRING

From: Jitendra Kotamraju <Jitendra.Kotamraju_at_Sun.COM>
Date: Mon, 28 Aug 2006 13:01:53 -0700

Takayuki Okazaki wrote:

>Hi JAX-WS gurus,
>
>I'm evaluating RESTful web service by using JAX-WS. So,
>I have a question regarding QUERY_STRING for consuming
>RESTful web service.
>
>RESTful web service article like this says
>http://java.sun.com/developer/technicalArticles/WebServices/restful/
>
>query string or path info can be passed through the url of
>the port, like:
>
> service = Service.create(qname);
> service.addPort(qname, HTTPBinding.HTTP_BINDING, url + "?myparam");
>
>However, I think passing query_string through requestContext,
>like below, is more appropriate to do it. Because, the port
>should only indicates resource location and binding not a whole
>invocation information.
>
> Dispatch<Source> d = s.createDispatch(portName, Source.class,
> Service.Mode.PAYLOAD);
> Map<String, Object> reqContext = d.getRequestContext();
> reqContext.put(MessageContext.HTTP_REQUEST_METHOD, "GET");
> reqContext.put(MessageContext.QUERY_STRING, "myparam");
>
>This implementation works well on JAX-WS 2.0 with a limitation like
>non-ascii or special characters aren't allowed in QUERY_STRING.
>
>
You could encode the string using URLEncoder and set the QUERY_STRING
with that value.

>And JAX-WS 2.0.1m1 ignores QUERY_STRING of requestContext.
>
>
Please file a bug on this.

>
>Are there any guidelines or limitations for QUERY_STRING?
>
>
It should be like what is in servlet
spec(HttpServletRequest.getQueryString())

Jitu

>Any pointers are appreciated.
>
>Thanks in advance,
>
>Takayuki
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
>For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
>
>
>