So,
I feel like a retard. When I make the same request through a browser, the
params comes out fine. The reason I was seeing the problem was I was trying
to execute the request in commandline using GET.
When I hit the service in a browser, the params go through.
I am using jax-rs and jax-ws together. If I use jax-ws alone, when I access
the base service URI , my tomcat server lists all the services mounted.
However, when I integrate jax-rs services too, then I get the following
error:
------------------------------------------------------------------------
java.lang.NullPointerException
org.apache.cxf.service.model.EndpointInfo.getInterface(EndpointInfo.java:55)
org.apache.cxf.transport.servlet.ServletController$1.compare(ServletController.java:220)
org.apache.cxf.transport.servlet.ServletController$1.compare(ServletController.java:219)
java.util.Arrays.mergeSort(Arrays.java:1283)
java.util.Arrays.sort(Arrays.java:1223)
java.util.Collections.sort(Collections.java:176)
org.apache.cxf.transport.servlet.ServletController.generateServiceList(ServletController.java:218)
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:122)
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:175)
org.apache.cxf.transport.servlet.AbstractCXFServlet.doGet(AbstractCXFServlet.java:157)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:112)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
This is not a stopper since I can still access each invidiaul Services if I
know the proper URI.
My Web.XML looks like this
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.5">
<display-name>callcontrol</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:META-INF/applicationContext.xml,
/WEB-INF/callcontrol-cxf.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<filter>
<filter-name>OpenEntityManagerInViewFilter</filter-name>
<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>OpenEntityManagerInViewFilter</filter-name>
<url-pattern>/svc/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<display-name>CallControl Services</display-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/svc/*</url-pattern>
</servlet-mapping>
</web-app>
And my /WEB-INF/callcontrol-cxf.xml looks like this
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd">
<!-- Load CXF modules from cxf.jar -->
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import
resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<context:component-scan base-package="com.tgear.callcontrol.service" />
<!-- Rest Service Endpoints -->
<jaxrs:server id="callService" address="/rest/">
<jaxrs:serviceBeans>
<ref bean="callLogServiceImpl" />
<ref bean="helloWorldJaxRsImpl" />
</jaxrs:serviceBeans>
</jaxrs:server>
<!-- Soap Service EndPoints -->
<jaxws:endpoint id="helloServicePoint"
implementor="#helloServiceImpl"
address="/HelloWorld"></jaxws:endpoint>
<jaxws:endpoint id="accountServicePoint"
implementor="#accountServiceImpl" address="/Account"></jaxws:endpoint>
<jaxws:endpoint id="clientServicePoint"
implementor="#clientServiceImpl" address="/Client"></jaxws:endpoint>
</beans>
What am I doing wrong ?
Dawa
On Wed, Nov 12, 2008 at 1:53 PM, Sergey Beryozkin <[EMAIL PROTECTED]>wrote:
> Hi
>
> It's strange indeed. Well, with JAXWS these are not query parameters,
> they're extracted from a soap body, so no surprise here. What I'm not
> sure about is why we see one query parameter lost when a GET request is
> used.
>
> I'm still thinking that it's lost earlier.
>
> Are you using a combined JAXWS-JAXRS service ?
>
> Can you please post a complete sample JAXRS code and a request URI and a
> config sample so that we can investigate ?
>
> Cheers, Sergey
>
> -----Original Message-----
> From: Dawa Sherpa [mailto:[EMAIL PROTECTED]
> Sent: 12 November 2008 19:32
> To: [email protected]
> Subject: Re: JAXRS UriInfo problem
>
> The problem only occurs when i am trying to use jax-rs api. I have other
> services which uses the jax-ws and the parameters seems to get through
> to
> them without a problem.
>
>
> @WebService(name = "testService")
> @SOAPBinding(style = Style.RPC, use = Use.LITERAL)
> public interface testService {
> public void printParams(@WebParam(name = "param1") String param1,
> @WebParam(name = "param2") String param2);
> }
>
>
> Works .. but
>
> @Path("/testService")
> public interface testService {
> @GET
> @Path("/printParams")
> public void printParams(@QueryParam("param1") String param1,
> @QueryParam("param2"));
> }
>
> Does not work. Only the first param could be used .
>
>
> Everything else is the same for both these services.
>
> Dawa
> On Wed, Nov 12, 2008 at 10:20 AM, Sergey Beryozkin <
> [EMAIL PROTECTED]> wrote:
>
> > Hi
> >
> > So the problem occurs much earlier then.
> > CXF does not modify HttpServletRequest as far as I'm aware so if it's
> not
> > available there then it's lost elsewhere
> >
> > May be you can debug ? Or provide more info on the overall
> infrastructure
> > you're usingthen it might help
> >
> > Cheers, Sergey
> >
> >
> > Hi Sergey,
> >>
> >> Thanks for the reply.
> >>
> >> I am using apache-cxf 2.1.3.
> >>
> >> Using "@Context HttpServletRequest request" did not help. It does the
> same
> >> thing.
> >>
> >> Here is the result for a request :
> >> <server>/<path>/<service-name>?param1=value1¶m2=value2
> >>
> >> request.getRequestURI() .. prints <path>/svc/<service-name>
> >> request.getQueryString() .. print param1=value1
> >>
> >>
> >>
> >> Dawa :-D
> >>
> >>
> >> On Wed, Nov 12, 2008 at 9:55 AM, Sergey Beryozkin <
> >> [EMAIL PROTECTED]> wrote:
> >>
> >> I haven't tried tomcat though but jetty, but I tries uri info
> injected as
> >>> a
> >>> field and as a parameter. Will having
> >>> @Context HttpServletRequest request
> >>>
> >>> in your code help ? So that you could try and get the info you need
> >>> directly from a request ?
> >>>
> >>> Cheers, Sergey
> >>>
> >>>
> >>>
> >>> Hi
> >>>>
> >>>> What CXF version you're using ? I did a quick try with 2.2-SNAPSHOT
> and
> >>>> I
> >>>> have no problems at all retrieving multiple query parameters from a
> >>>> UriInfo...
> >>>>
> >>>> Cheers, Sergey
> >>>>
> >>>>
> >>>> Dawa Sherpa wrote:
> >>>>
> >>>>
> >>>>> I am trying to use apache-cxf 's REST service. However, jax-rs
> seems to
> >>>>> be doing something bad to my URLs .. I only get the first query
> >>>>> parameter that is passed to the request. Is this a bug or am I
> missing
> >>>>> some configuration ?
> >>>>>
> >>>>> Eg. If I pass <server>/svc/something?param1=value1¶m2=value2
> >>>>> When print out
> >>>>> UriInfo.getRequestURI() , I get
> <server>/svc/something?param1=value1
> >>>>>
> >>>>> and ofcourse, when I do getQueryParameters, I only get the first
> one .
> >>>>> Please help
> >>>>>
> >>>>>
> >>>>> On Tue, 2008-11-11 at 12:03 -0800, Perch24 wrote:
> >>>>>
> >>>>> We recently upgraded to CXF 2.1.3 from 2.1.2. After the upgrade
> we
> >>>>>> noticed
> >>>>>> that JMS conduits with a reply to queue were not always working
> if we
> >>>>>> had
> >>>>>> multiple instances running. I didn't dive into the problem real
> deep,
> >>>>>> but
> >>>>>> rather just removed the reply to queue config so that it would
> use a
> >>>>>> temporary queue. That fixed the problem.
> >>>>>>
> >>>>>> It looks like to me that the new implemenation of the JMS conduit
> is
> >>>>>> broken
> >>>>>> if you have multiple instances of a conduit running against the
> same
> >>>>>> reply
> >>>>>> to queue. It's possible that this could be fixed with the new
> Spring
> >>>>>> configuration, but it is not backwards compatible with 2.1.2.
> >>>>>> I'm posting this to list first to see if anyone else has seen
> this.
> >>>>>> Let
> >>>>>> me
> >>>>>> know if you would like me to open a defect.
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>> View this message in context:
> >>>>
> http://www.nabble.com/CXF-2.1.3-JMS-Conduit-tp20447067p20465355.html
> >>>> Sent from the cxf-user mailing list archive at Nabble.com.
> >>>>
> >>>>
> >>>>
> >>>
> >>
> >
>
>