<?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 Re: Talend Service Factory example: jaxrs-jaxws-java-first extension in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Talend-Service-Factory-example-jaxrs-jaxws-java-first-extension/m-p/2345192#M112751</link>
    <description>Hi Sergey, 
&lt;BR /&gt;Thanks for your suggestion. I tried it, however it is now throws "Unresolved variables; only 0 value(s) given for 1 unique variable(s)" on the call to the byId method in the RESTClient. Below are code snippets: 
&lt;BR /&gt;HelloWorld.java: 
&lt;BR /&gt;// ** New call 
&lt;BR /&gt; @GET 
&lt;BR /&gt; @Produces("text/xml") 
&lt;BR /&gt; @Path("{id}") 
&lt;BR /&gt; User byId(long id); 
&lt;BR /&gt;RESTClient.java 
&lt;BR /&gt; HelloWorld service = JAXRSClientFactory.create(address, HelloWorld.class); 
&lt;BR /&gt;.... 
&lt;BR /&gt; // New call 
&lt;BR /&gt;System.out.println("entering byId"); 
&lt;BR /&gt;// Now fails with "Unresolved variables; only 0 value(s) given for 1 unique variable(s)" message 
&lt;BR /&gt;User us = service.byId(1); 
&lt;BR /&gt;System.out.println(us.getName()); 
&lt;BR /&gt; 
&lt;BR /&gt;Any suggestions are very appreciated.</description>
    <pubDate>Tue, 27 Sep 2011 03:15:28 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2011-09-27T03:15:28Z</dc:date>
    <item>
      <title>Talend Service Factory example: jaxrs-jaxws-java-first extension</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Talend-Service-Factory-example-jaxrs-jaxws-java-first-extension/m-p/2345189#M112748</link>
      <description>Environment: 
&lt;BR /&gt; talend-sf-2.4.2.0 
&lt;BR /&gt; Windows 7 
&lt;BR /&gt; Java version 1.60.0_26-b03 
&lt;BR /&gt; Jetty 6.1.15 servlet container 
&lt;BR /&gt; 
&lt;BR /&gt;Description: 
&lt;BR /&gt; Extended jaxrs-jaxws-java-first example (from talend-sf-2.4.2.0-examples.zip, 
&lt;A href="http://www.talend.com/download.php#SF)" target="_blank" rel="nofollow noopener noreferrer"&gt;http://www.talend.com/download.php#SF)&lt;/A&gt; to add a simple new method. 
&lt;BR /&gt; It is produces an exception on the client side on an existing method. 
&lt;BR /&gt; Added the following new method to common/src/main/java/common/codefirst/HelloWorld.java, see the code snippet below and screen shot: 
&lt;BR /&gt; &amp;lt;code&amp;gt; 
&lt;BR /&gt; // ** New call 
&lt;BR /&gt; &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/192275"&gt;@get&lt;/a&gt; 
&lt;BR /&gt; @Produces("text/xml") 
&lt;BR /&gt; User byId(@QueryParam("text") String id); 
&lt;BR /&gt; // ** Existing call 
&lt;BR /&gt; &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/192275"&gt;@get&lt;/a&gt; 
&lt;BR /&gt; @Produces("text/plain") 
&lt;BR /&gt; String sayHi(@QueryParam("text") String text); 
&lt;BR /&gt; &amp;lt;/code&amp;gt; 
&lt;BR /&gt; Added the following code in Service/src/main/java/service/codefirst/HellooWorldImpl.java file, see the code snippet below and screen shot" 
&lt;BR /&gt; &amp;lt;code&amp;gt; 
&lt;BR /&gt; public User byId(String id) { 
&lt;BR /&gt; return new UserImpl(id); 
&lt;BR /&gt; } 
&lt;BR /&gt; &amp;lt;/code&amp;gt; 
&lt;BR /&gt; Added the following code in client/src/main/java/client/RESTClient.java, see the code snippet below and the screen shot: 
&lt;BR /&gt; &amp;lt;code&amp;gt; 
&lt;BR /&gt; private void useHelloService(HelloWorld service, String user) { 
&lt;BR /&gt; // New call 
&lt;BR /&gt; System.out.println("entering byId"); 
&lt;BR /&gt; User us = service.byId("test User"); 
&lt;BR /&gt; System.out.println(us.getName()); 
&lt;BR /&gt; // Existing call 
&lt;BR /&gt; System.out.println("Getting the list of existing users"); 
&lt;BR /&gt; printUsers(service.getUsers()); 
&lt;BR /&gt; &amp;lt;/code&amp;gt; 
&lt;BR /&gt; 
&lt;BR /&gt;Problem: 
&lt;BR /&gt; Did a full clean build of the example code. Ran both the Server code and the Client code through maven. 
&lt;BR /&gt; The following is the stack trace on the client. There is no stack trace on the server. It appears to be a client marshaling problem. 
&lt;BR /&gt; Also see the attached screen shot: 
&lt;BR /&gt; Using CXF JAX-RS proxy to invoke on HelloWorld service 
&lt;BR /&gt; entering byId 
&lt;BR /&gt; test User 
&lt;BR /&gt; Getting the list of existing users 
&lt;BR /&gt; java.lang.ClassCastException: common.codefirst.UserImpl cannot be cast to common 
&lt;BR /&gt; .codefirst.IntegerUserMap 
&lt;BR /&gt; at common.codefirst.IntegerUserMapAdapter.unmarshal(IntegerUserMapAdapte 
&lt;BR /&gt; r.java:11) 
&lt;BR /&gt; at org.apache.cxf.jaxrs.utils.JAXBUtils.useAdapter(JAXBUtils.java:107) 
&lt;BR /&gt; at org.apache.cxf.jaxrs.utils.JAXBUtils.useAdapter(JAXBUtils.java:90) 
&lt;BR /&gt; at org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.checkAdapter(Abstr 
&lt;BR /&gt; actJAXBProvider.java:512) 
&lt;BR /&gt; at org.apache.cxf.jaxrs.provider.JAXBElementProvider.readFrom(JAXBElemen 
&lt;BR /&gt; tProvider.java:158) 
&lt;BR /&gt; at org.apache.cxf.jaxrs.client.AbstractClient.readBody(AbstractClient.ja 
&lt;BR /&gt; va:435) 
&lt;BR /&gt; at org.apache.cxf.jaxrs.client.ClientProxyImpl.handleResponse(ClientProx 
&lt;BR /&gt; yImpl.java:520) 
&lt;BR /&gt; at org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(Clien 
&lt;BR /&gt; tProxyImpl.java:480) 
&lt;BR /&gt; at org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.ja 
&lt;BR /&gt; va:188) 
&lt;BR /&gt; at $Proxy16.getUsers(Unknown Source) 
&lt;BR /&gt; at client.RESTClient.useHelloService(RESTClient.java:83) 
&lt;BR /&gt; at client.RESTClient.sayHelloRest(RESTClient.java:55) 
&lt;BR /&gt; at client.RESTClient.main(RESTClient.java:117) 
&lt;BR /&gt; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
&lt;BR /&gt; at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. 
&lt;BR /&gt; java:39) 
&lt;BR /&gt; at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces 
&lt;BR /&gt; sorImpl.java:25) 
&lt;BR /&gt; at java.lang.reflect.Method.invoke(Method.java:597) 
&lt;BR /&gt; at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:291) 
&lt;BR /&gt; at java.lang.Thread.run(Thread.java:662) 
&lt;BR /&gt; 
&lt;BR /&gt;NOTE: this problem disappears if the new byId() method is stubbed out in HelloWorld.java. 
&lt;BR /&gt;I have tried a number of ways to workaround this problem but so far without any success. Any comments or suggestions are very appreciated.</description>
      <pubDate>Sat, 16 Nov 2024 12:41:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Talend-Service-Factory-example-jaxrs-jaxws-java-first-extension/m-p/2345189#M112748</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T12:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Talend Service Factory example: jaxrs-jaxws-java-first extension</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Talend-Service-Factory-example-jaxrs-jaxws-java-first-extension/m-p/2345190#M112749</link>
      <description>Hi 
&lt;BR /&gt;it appears the JAX-RS provider is finding the wrong adapter in case of byId(). I think explicitly adding @XmlJavaTypeAdapter(UserAdapter.class) to byId() annotations will fix it. 
&lt;BR /&gt;I'll check in meantime why a wrong adapter is picked up 
&lt;BR /&gt;Thanks, Sergey</description>
      <pubDate>Mon, 26 Sep 2011 10:28:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Talend-Service-Factory-example-jaxrs-jaxws-java-first-extension/m-p/2345190#M112749</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-26T10:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: Talend Service Factory example: jaxrs-jaxws-java-first extension</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Talend-Service-Factory-example-jaxrs-jaxws-java-first-extension/m-p/2345191#M112750</link>
      <description>Actually, the problem is that byId() and getUsers() are equal selection candidates on the server side (thanks to Dan Kulp who spotted it first), note they share @GET, @Path and @Produces thus the spec says the selections basically random in this case. A proxy is unaware about it though and expects UserAdaper to unmarshall the response.
&lt;BR /&gt;Updating byid like this should fix it:
&lt;BR /&gt;@Path("{id}")
&lt;BR /&gt;@Produces("text/xml")
&lt;BR /&gt;@GET
&lt;BR /&gt;User byId(String id) {...}</description>
      <pubDate>Mon, 26 Sep 2011 12:41:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Talend-Service-Factory-example-jaxrs-jaxws-java-first-extension/m-p/2345191#M112750</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-26T12:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: Talend Service Factory example: jaxrs-jaxws-java-first extension</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Talend-Service-Factory-example-jaxrs-jaxws-java-first-extension/m-p/2345192#M112751</link>
      <description>Hi Sergey, 
&lt;BR /&gt;Thanks for your suggestion. I tried it, however it is now throws "Unresolved variables; only 0 value(s) given for 1 unique variable(s)" on the call to the byId method in the RESTClient. Below are code snippets: 
&lt;BR /&gt;HelloWorld.java: 
&lt;BR /&gt;// ** New call 
&lt;BR /&gt; @GET 
&lt;BR /&gt; @Produces("text/xml") 
&lt;BR /&gt; @Path("{id}") 
&lt;BR /&gt; User byId(long id); 
&lt;BR /&gt;RESTClient.java 
&lt;BR /&gt; HelloWorld service = JAXRSClientFactory.create(address, HelloWorld.class); 
&lt;BR /&gt;.... 
&lt;BR /&gt; // New call 
&lt;BR /&gt;System.out.println("entering byId"); 
&lt;BR /&gt;// Now fails with "Unresolved variables; only 0 value(s) given for 1 unique variable(s)" message 
&lt;BR /&gt;User us = service.byId(1); 
&lt;BR /&gt;System.out.println(us.getName()); 
&lt;BR /&gt; 
&lt;BR /&gt;Any suggestions are very appreciated.</description>
      <pubDate>Tue, 27 Sep 2011 03:15:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Talend-Service-Factory-example-jaxrs-jaxws-java-first-extension/m-p/2345192#M112751</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-27T03:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Talend Service Factory example: jaxrs-jaxws-java-first extension</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Talend-Service-Factory-example-jaxrs-jaxws-java-first-extension/m-p/2345193#M112752</link>
      <description>I have the same problem. Did you find a solution?</description>
      <pubDate>Mon, 03 Oct 2011 12:05:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Talend-Service-Factory-example-jaxrs-jaxws-java-first-extension/m-p/2345193#M112752</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2011-10-03T12:05:36Z</dc:date>
    </item>
  </channel>
</rss>

