Hi to all, this is my first email here. First sorry for my bad english. 
I have a problem with a RESTful web service and a simple java 
application that i do to consume a POST resource of the RESTful ws. I'm 
using Jersey API client to consume my ws. First, the code of ws is this:
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Produces;
@Path("recargas")
public class RecargasResource {
     @Context
     private UriInfo context;
     /** Creates a new instance of RecargasResource */
     public RecargasResource() {
     }
     @GET
     @Path("methodGet")
     @Produces("application/xml")
     public String getMethod()
     {
         return "<xml><message>Saying Hello from GET 
method</message></xml>";
     }
     @POST
     @Path("methodPost")
     public String recargaSaldo(
             )
     {
         return "<?xml version=\"1.0\" encoding='UTF-8'?>" +
                 "<recarga>" +
                 "<codResult>" + "00" + "</codResult>" +
                 "</recarga>";
     }
}
When i run in netbeans the URI of the resource is this:
http://localhost:8089/MyProject/resources
So i developed a simple command-line java application, the code is this:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.core.impl.provider.entity.StringProvider;
public class Main {
     public static void main(String[] args) throws IOException {
         ClientConfig config = new DefaultClientConfig();
         config.getClasses().add(StringProvider.class);
         Client clienteWs = Client.create(config);
         WebResource webResource = 
clienteWs.resource("
http://localhost:8089/MyProject/resources/");
         webResource.path("methodPost");
         String s = webResource.post(String.class);
         System.out.println("Aqui esta la respuesta gracias a Jersey: " 
+ s.toString());
     }
}
But, when i run it with java -jar myproject.jar i get this error:
Exception in thread "main" 
com.sun.jersey.api.client.UniformInterfaceException: POST 
http://localhost:8089/MyProject/resources returned a response status of 
404 ...
But i don't understand why doesn't work.
Regards
-- 
Oscar Calderon
JAVA Tutorials and How to's? Visit http://www.javahowto.net/