users@glassfish.java.net

REST endpoints with _at_WebServiceProvider and the Content-type HTTP request header

From: Mark Hansen <marklists_at_javector.com>
Date: Fri, 05 Jan 2007 17:56:27 -0500

(Added the stack trace and cross-posted to JAX-WS mailing list)

I'm trying to deploy a @WebServiceProvider to create a RESTful endpoint
that takes no XML in the request - but just HTTP parameters. For
something similar see the Yahoo Shopping API:
http://developer.yahoo.com/shopping/

One nice thing about Yahoo Shopping is that you can invoke the RESTful
endpoints using your browser by putting the parameters in the query
string, like this:
http://api.shopping.yahoo.com/ShoppingService/V2/productSearch?%20appid=YahooDemo&query=erector

When I try to deploy a similar type of endpoint using GlassFish
@WebServiceProvider, it works OK when I invoke it from a URLConnection
inside a Java client. However, it doesn't work from a browser
(Firefox). I get the below error in the server.log. I assume the error
results from the Content-type the browser is setting (or not setting -
since I'm seeing an NPE) being rejected by the HTTPAdapter.

Is this a bug? Or do the JAX-WS specs require something like having the
Content-type set to text/xml?

-- Mark

[#|2007-01-05T17:11:26.877-0500|SEVERE|sun-appserver-ee9.1|javax.enterprise.system.container.web|_ThreadID=17;_ThreadName=httpSSLWorkerThread-8080-1;_RequestID=4a89a747-64a5-48c6-a986-2d7ac0f49e50;|StandardWrapperValve[com.javector.soashopper.endpoint.rest.ShopperServiceRESTImp]:
PWC1406: Servlet.service() for servlet
com.javector.soashopper.endpoint.rest.ShopperServiceRESTImp threw exception
javax.servlet.ServletException
        at com.sun.enterprise.webservice.JAXWSServlet.doPost(JAXWSServlet.java:139)
        at com.sun.enterprise.webservice.JAXWSServlet.doGet(JAXWSServlet.java:175)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at
org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:398)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
        at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:255)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:186)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1032)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1032)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:250)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:618)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.processNonBlocked(DefaultProcessorTask.java:549)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:790)
        at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:326)
        at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:248)
        at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:199)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
        at
com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:93)
Caused by: java.lang.NullPointerException
        at
com.sun.xml.ws.transport.http.HttpAdapter.isContentTypeSupported(HttpAdapter.java:225)
        at
com.sun.xml.ws.transport.http.HttpAdapter.decodePacket(HttpAdapter.java:212)
        at
com.sun.xml.ws.transport.http.HttpAdapter.access$500(HttpAdapter.java:75)
        at
com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:374)
        at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:183)
        at
com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:134)
        at com.sun.enterprise.webservice.JAXWSServlet.doPost(JAXWSServlet.java:134)
        ... 26 more