users@jax-ws.java.net

Q. RESTful Web Service and QUERY_STRING

From: Takayuki Okazaki <Takayuki.Okazaki_at_Sun.COM>
Date: Sat, 26 Aug 2006 23:58:59 +0900

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.
And JAX-WS 2.0.1m1 ignores QUERY_STRING of requestContext.


Are there any guidelines or limitations for QUERY_STRING?
Any pointers are appreciated.

Thanks in advance,

Takayuki