You also need the @WebParam annotation, like below:
@WebService
public interface NamasteService {
@Get
@HttpResource(location = "/namaste/{text}")
String namaste(@WebParam(name = " text ")String text);
}
> -----Original Message-----
> From: Kamlesh [mailto:[EMAIL PROTECTED]
> Sent: 2008年1月4日 1:52
> To: [email protected]
> Subject: RE: unable to get uri parameter in rest service having wrapped true
>
>
> Hi, Jervis
>
>
> I have already tried making input prameter as string. I got the following
> reply with not text.
>
> <ns2:namasteResponse
> xmlns:ns2="http://webservices.transcode.scrippsnetworks.com/">
> <response>Namaste</response>
> </ns2:namasteResponse>
>
> Regards
> Kamlesh
>
>
> Liu, Jervis wrote:
> >
> > In the wrapped mode, CXF presumes that the request comes in within a
> > wrapper, in which case CXF will try to unwrap the request and the request
> > will be marshaled to "String text" instead of "NamasteText text".
> >
> > Following should work for you in the wrapped mode:
> >
> > @WebService
> > public interface NamasteService {
> > @Get
> > @HttpResource(location = "/namaste/{text}")
> > String namaste(String text);
> >
> > }
> >
> >> -----Original Message-----
> >> From: Kamlesh [mailto:[EMAIL PROTECTED]
> >> Sent: 2008年1月3日 0:17
> >> To: [email protected]
> >> Subject: unable to get uri parameter in rest service having wrapped true
> >>
> >>
> >> Hi, All
> >>
> >> This is with refrence to my posting in CXF-user mailing list where I did
> >> not
> >> get reply. I think it is bug in cxf. I am using CXF version 2.0.3.
> >>
> >>
> http://www.nabble.com/unable-to-get-uri-parameter-in-rest-service-having
> >> -wrapped-true-to14518283.html
> >>
> >> I have following simple service. In wrapped false mode I get correct
> >> response:
> >>
> >> url:
> >>
> http://localhost:8080/mywebapp-web-1.0-SNAPSHOT/services/NamasteSer
> >> viceRest/namaste/Kamlesh
> >>
> >> <ns2:namasteResponse
> >>
> xmlns:ns2="http://webservices.transcode.scrippsnetworks.com/">Namaste
> >> Kamlesh</ns2:namasteResponse>
> >>
> >> But if I change configuration to wrapped true, I get following response
> >>
> >> <ns2:namasteResponse
> >> xmlns:ns2="http://webservices.transcode.scrippsnetworks.com/">
> >> <response> Namaste null</response>
> >> </ns2:namasteResponse>
> >>
> >> Kindly help me to understand why.
> >>
> >>
> >> <jaxws:endpoint id="namaste_rest"
> >>
> >>
> implementor="com.scrippsnetworks.transcode.webservices.impl.NamasteSe
> >> rviceImpl"
> >> address="/NamasteServiceRest"
> >>
> bindingUri="http://apache.org/cxf/binding/http">
> >> <jaxws:serviceFactory>
> >> <bean
> >> class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
> >> <property name="wrapped" value="false" />
> >> </bean>
> >> </jaxws:serviceFactory>
> >> </jaxws:endpoint>
> >>
> >> Interface:
> >> ========
> >> @WebService
> >> public interface NamasteService {
> >> @Get
> >> @HttpResource(location = "/namaste/{text}")
> >> String namaste(NamasteText text);
> >>
> >> }
> >>
> >> impl class
> >> ========
> >>
> >> public class NamasteServiceImpl implements NamasteService {
> >>
> >> /* (non-Javadoc)
> >> * @see
> >>
> com.scrippsnetworks.transcode.webservices.NamasteService#namaste(java
> >> .lang.String)
> >> */
> >>
> >> public String namaste(NamasteText text) {
> >> //
> >> return "Namaste " + text.getText();
> >> }
> >>
> >>
> >>
> >> }
> >>
> >> public class NamasteText {
> >> private String text;
> >>
> >> public String getText() {
> >> return text;
> >> }
> >>
> >> public void setText(String text) {
> >> this.text = text;
> >> }
> >> }
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/unable-to-get-uri-parameter-in-rest-service-having
> >> -wrapped-true-tp14580995p14580995.html
> >> Sent from the cxf-dev mailing list archive at Nabble.com.
> >
> > ----------------------------
> > IONA Technologies PLC (registered in Ireland)
> > Registered Number: 171387
> > Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/unable-to-get-uri-parameter-in-rest-service-having
> -wrapped-true-tp14580995p14601627.html
> Sent from the cxf-dev mailing list archive at Nabble.com.
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland