One Star

tRESTClient : problem with the POST Verb

Hi all,
I have created a tREST service with the Integration view using the tRESTRequest component.
I have created 2 output flows : one with the GET verb and the other with the POST verb.
When I call this web service with soapUI, the GET verb woks pretty good.
Not with the POST verb. I have this message : 
2016-09-06 11:01:29,877 | WARN  | tp1686786251-327 | AbstractJAXBProvider             | rs.provider.AbstractJAXBProvider

  223 | 135 - org.apache.cxf.cxf-rt-frontend-jaxrs - 2.7.5 | Message body is empty

2016-09-06 11:01:29,877 | WARN  | tp1686786251-327 | WebApplicationExceptionMapper    | pl.WebApplicationExceptionMapper

   73 | 135 - org.apache.cxf.cxf-rt-frontend-jaxrs - 2.7.5 | javax.ws.rs.BadRequestException

        at org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.reportEmptyContentLength(AbstractJAXBProvider.java:224)

        at org.apache.cxf.jaxrs.provider.json.JSONProvider.readFrom(JSONProvider.java:203)

        at org.apache.cxf.jaxrs.provider.dom4j.DOM4JProvider.readFrom(DOM4JProvider.java:69)

        at org.apache.cxf.jaxrs.provider.dom4j.DOM4JProvider.readFrom(DOM4JProvider.java:40)

        at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBodyReader(JAXRSUtils.java:1288)

        at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1236)

        at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:787)

        at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:747)

        at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:240)

        at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:100)

        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)

        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)

        at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239)

        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)

        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:203)

        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:137)

        at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:158)

        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:243)

        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPut(AbstractHTTPServlet.java:180)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)

        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:219)

        at sun.reflect.GeneratedMethodAccessor124.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:606)

        at org.ops4j.pax.web.service.internal.HttpServiceStarted$1.invoke(HttpServiceStarted.java:183)

        at org.ops4j.pax.web.service.internal.$Proxy1.service(Unknown Source)

        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:652)

        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:447)

        at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:70

)

        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)

        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:556)

        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)

        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1038)

        at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:117)

        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:374)

        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)

        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:972)

        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)

        at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.jav

a:81)

        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)

        at org.eclipse.jetty.server.Server.handle(Server.java:363)

        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:483)

        at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:920)

        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:982

)

        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)

        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)

        at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)

        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)

        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)

        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)

        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)

        at java.lang.Thread.run(Thread.java:745)


What's wrong with this component ? any idea ?
Best regards.
1 REPLY
Employee

Re: tRESTClient : problem with the POST Verb

223 | 135 - org.apache.cxf.cxf-rt-frontend-jaxrs - 2.7.5 | Message body is empty


73 | 135 - org.apache.cxf.cxf-rt-frontend-jaxrs - 2.7.5 | javax.ws.rs.BadRequestException

seems your POST operation configured for accept JSON as payload and you invoke it with empty request body.