title: Restlet - Connection Problems - 406 Not Acceptable - Plain Text
body: <p>couldnt find somewhere else advice.</p>
  
  <p>I am writing a Restlet JSE Client for a Jersey(!) Restful Service. I already wrote a Jersey client for that and it is working, so the jersey service is alright. Now I get problems in writing a restlet client:</p>
  
  <p>My Service root adress is: </p>
  
  <pre><code> http://localhost:8080/com-project-core/rest, so I call:
  
   ClientResource = service = new ClientResource("http://localhost:8080/com-project-core/rest");
  </code></pre>
  
  <p>My Basic Auth Credentiels are admin and xxx, so I call:</p>
  
  <pre><code> service.setChallengeResponse(ChallengeScheme.HTTP_BASIC, "admin", "xxx");
  </code></pre>
  
  <p>Now the problems:</p>
  
  <pre><code> ClientResource service = new ClientResource("http://localhost:8080/com-project-core/rest/ping");
  </code></pre>
  
  <p>calls up my service. After that I try </p>
  
  <pre><code> String myString = service.get(String.class);
   System.out.println(myString);
  </code></pre>
  
  <p>I get a:</p>
  
  <pre><code> 08.07.2012 17:41:48 org.restlet.engine.http.connector.HttpClientHelper start
   INFO: Starting the default HTTP client
  </code></pre>
  
  <p>in my output. Not more! The Junit Test says:</p>
  
  <pre><code> Not Acceptable (406) - Not Acceptable 
  </code></pre>
  
  <p>So he can find the resource but cannot produce @Produces("text/plain") ??</p>
  
  <p>So when I remove @Produces("text/plain") on server side it works!!</p>
  
  <p>For the resourcey my server side looks like this:</p>
  
  <pre><code>    @Path("/ping")
      @RolesAllowed({"admin", "user"})
      public class ConnectedResourceBean implements ConnectedResourceIF {
  
          @GET
          @Produces("text/plain")
          public String getPingMessage() throws NamingException {             
  
          return "Hello World";
         }
   }
  </code></pre>
  
  <p>For my pom in set this dependencies:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.restlet.jse&lt;/groupId&gt;
      &lt;artifactId&gt;org.restlet&lt;/artifactId&gt;
      &lt;version&gt;${restlet.version}&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;org.restlet.jse&lt;/groupId&gt;
      &lt;artifactId&gt;org.restlet.ext.xstream&lt;/artifactId&gt;
      &lt;version&gt;${restlet.version}&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>As I said, its working with my jersey client.</p>