<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Why doesn't this REST service work? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Why-doesn-t-this-REST-service-work/m-p/2294299#M67195</link>
    <description>Trying to create a proof-of-concept REST service bundle. 
&lt;BR /&gt;It compiles fine. 
&lt;BR /&gt;Karaf starts the bundle with no errors. 
&lt;BR /&gt;But when I go the the URL where it should be, I get no response, and no errors in the log. Nothing. 
&lt;BR /&gt;here's the Interface: 
&lt;BR /&gt; 
&lt;PRE&gt;@Path("greeter")&lt;BR /&gt;public interface Greeter {&lt;BR /&gt;    &lt;BR /&gt;    @GET&lt;BR /&gt;    @Path("greet/{name}")&lt;BR /&gt;    @Produces(MediaType.TEXT_PLAIN)&lt;BR /&gt;    public String greeter(@PathParam("name") String name);&lt;BR /&gt;    &lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;The implementation: 
&lt;BR /&gt; 
&lt;PRE&gt;public class GreeterImpl implements Greeter {&lt;BR /&gt;    &lt;BR /&gt;    public String greeter(String name) {&lt;BR /&gt;        return "hello "+name;&lt;BR /&gt;    }&lt;BR /&gt;    &lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;The bundle activator: 
&lt;BR /&gt; 
&lt;PRE&gt;public class Activator implements BundleActivator {&lt;BR /&gt;    private ServiceRegistration registration;&lt;BR /&gt;    public void start(BundleContext bc) throws Exception {&lt;BR /&gt;        Dictionary props = new Hashtable();&lt;BR /&gt;        props.put("service.exported.interfaces", "*");&lt;BR /&gt;        props.put("service.exported.configs", "org.apache.cxf.rs");&lt;BR /&gt;        props.put("service.exported.intents", "HTTP");&lt;BR /&gt;        props.put("org.apache.cxf.rs.address", "http://0.0.0.0:9118/");&lt;BR /&gt;        &lt;BR /&gt;        registration = bc.registerService(Greeter.class.getName(), new GreeterImpl(), props);&lt;BR /&gt;        &lt;BR /&gt;        System.out.println("CXF REST Test: http://0.0.0.0:9118/");&lt;BR /&gt;    }&lt;BR /&gt;    public void stop(BundleContext bc) throws Exception {&lt;BR /&gt;        registration.unregister();&lt;BR /&gt;    }&lt;BR /&gt;    &lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;When I go to this URL: 
&lt;BR /&gt;&lt;A href="http://localhost:9118/greeter/greet/miles" target="_blank"&gt;http://localhost:9118/greeter/greet/miles&lt;/A&gt; 
&lt;BR /&gt;I get nothing. This is in Talend ESB 5.2.2. What am I doing wrong?</description>
    <pubDate>Sat, 16 Nov 2024 12:03:12 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-11-16T12:03:12Z</dc:date>
    <item>
      <title>Why doesn't this REST service work?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Why-doesn-t-this-REST-service-work/m-p/2294299#M67195</link>
      <description>Trying to create a proof-of-concept REST service bundle. 
&lt;BR /&gt;It compiles fine. 
&lt;BR /&gt;Karaf starts the bundle with no errors. 
&lt;BR /&gt;But when I go the the URL where it should be, I get no response, and no errors in the log. Nothing. 
&lt;BR /&gt;here's the Interface: 
&lt;BR /&gt; 
&lt;PRE&gt;@Path("greeter")&lt;BR /&gt;public interface Greeter {&lt;BR /&gt;    &lt;BR /&gt;    @GET&lt;BR /&gt;    @Path("greet/{name}")&lt;BR /&gt;    @Produces(MediaType.TEXT_PLAIN)&lt;BR /&gt;    public String greeter(@PathParam("name") String name);&lt;BR /&gt;    &lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;The implementation: 
&lt;BR /&gt; 
&lt;PRE&gt;public class GreeterImpl implements Greeter {&lt;BR /&gt;    &lt;BR /&gt;    public String greeter(String name) {&lt;BR /&gt;        return "hello "+name;&lt;BR /&gt;    }&lt;BR /&gt;    &lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;The bundle activator: 
&lt;BR /&gt; 
&lt;PRE&gt;public class Activator implements BundleActivator {&lt;BR /&gt;    private ServiceRegistration registration;&lt;BR /&gt;    public void start(BundleContext bc) throws Exception {&lt;BR /&gt;        Dictionary props = new Hashtable();&lt;BR /&gt;        props.put("service.exported.interfaces", "*");&lt;BR /&gt;        props.put("service.exported.configs", "org.apache.cxf.rs");&lt;BR /&gt;        props.put("service.exported.intents", "HTTP");&lt;BR /&gt;        props.put("org.apache.cxf.rs.address", "http://0.0.0.0:9118/");&lt;BR /&gt;        &lt;BR /&gt;        registration = bc.registerService(Greeter.class.getName(), new GreeterImpl(), props);&lt;BR /&gt;        &lt;BR /&gt;        System.out.println("CXF REST Test: http://0.0.0.0:9118/");&lt;BR /&gt;    }&lt;BR /&gt;    public void stop(BundleContext bc) throws Exception {&lt;BR /&gt;        registration.unregister();&lt;BR /&gt;    }&lt;BR /&gt;    &lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;When I go to this URL: 
&lt;BR /&gt;&lt;A href="http://localhost:9118/greeter/greet/miles" target="_blank"&gt;http://localhost:9118/greeter/greet/miles&lt;/A&gt; 
&lt;BR /&gt;I get nothing. This is in Talend ESB 5.2.2. What am I doing wrong?</description>
      <pubDate>Sat, 16 Nov 2024 12:03:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Why-doesn-t-this-REST-service-work/m-p/2294299#M67195</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T12:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Why doesn't this REST service work?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Why-doesn-t-this-REST-service-work/m-p/2294300#M67196</link>
      <description>Hi - I think you are going the DOSGi path and we do not support it in ESB AFAIK.&lt;BR /&gt;Please have a look at /examples/cxf/jaxrs-intro/services, check how Blueprint context (in resources/OSGI_INF) can be used to activate an endpoint.</description>
      <pubDate>Fri, 19 Apr 2013 10:20:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Why-doesn-t-this-REST-service-work/m-p/2294300#M67196</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-19T10:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Why doesn't this REST service work?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Why-doesn-t-this-REST-service-work/m-p/2294301#M67197</link>
      <description>Thank you for you help sberyozkin, yes, I was using a DOSGi example from the web. 
&lt;BR /&gt;Basically, I'm trying to build some services using JAX annotation and no configuration files, like I can do on TomEE. 
&lt;BR /&gt;So I looked up the example you mentioned and made these changes to my Greeter service: 
&lt;BR /&gt;1. Removed the Activator class. 
&lt;BR /&gt;2. copied the service.xml file from example to my src/main/java/resources/OSGI-INF/blueprint directory in my Maven project, with the changes below. 
&lt;BR /&gt;3. removed reference to bundle activator in my pom.xml file. 
&lt;BR /&gt;src/main/java/resources/OSGI-INF/blueprint/service.xml: 
&lt;BR /&gt; 
&lt;PRE&gt;     &amp;lt;jaxrs:server id="greeterService" address="/cxf"&amp;gt;&lt;BR /&gt;        &amp;lt;jaxrs:serviceBeans&amp;gt;&lt;BR /&gt;           &amp;lt;ref component-id="greeterBean" /&amp;gt;&lt;BR /&gt;        &amp;lt;/jaxrs:serviceBeans&amp;gt;&lt;BR /&gt;     &amp;lt;/jaxrs:server&amp;gt;&lt;BR /&gt;     &amp;lt;bean id="greeterBean" class="com.cn.dsa.greet.GreeterImpl"/&amp;gt;&lt;/PRE&gt; 
&lt;BR /&gt;The builds with no errors, and karaf launches it with no errors. 
&lt;BR /&gt;But again, there is no service at the URL. 
&lt;BR /&gt;I've tried: 
&lt;BR /&gt;http://localhost:8040/services/cxf/greeter/greet/miles 
&lt;BR /&gt;and 
&lt;BR /&gt;http://localhost:8040/cxf/greeter/greet/miles 
&lt;BR /&gt; 
&lt;BR /&gt;If I go here: 
&lt;BR /&gt;http://localhost:8040/services/ 
&lt;BR /&gt;it says "No services have been found" so are there a few more things I need to do?</description>
      <pubDate>Fri, 19 Apr 2013 15:17:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Why-doesn-t-this-REST-service-work/m-p/2294301#M67197</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-19T15:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: Why doesn't this REST service work?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Why-doesn-t-this-REST-service-work/m-p/2294302#M67198</link>
      <description>I have the service working now with blueprint.
&lt;BR /&gt;The problem was that the @Path attribute value must start with a slash. That was it. 
&lt;BR /&gt;
&lt;PRE&gt;@Path("/greeter")&lt;BR /&gt;public interface Greeter {&lt;BR /&gt;    &lt;BR /&gt;    @GET&lt;BR /&gt;    @Path("greet/{name}")&lt;BR /&gt;    @Produces(MediaType.TEXT_PLAIN)&lt;BR /&gt;    public String greeter(@PathParam("name") String name);&lt;BR /&gt;    &lt;BR /&gt;}&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Apr 2013 23:33:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Why-doesn-t-this-REST-service-work/m-p/2294302#M67198</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-19T23:33:49Z</dc:date>
    </item>
  </channel>
</rss>

