I devoloped the following Rest service:
@POST
@Path("getTokenUser")
@Produces(javax.ws.rs.core.MediaType.APPLICATION_JSON)
public String getTokenUser(@QueryParam("User")String
User,@QueryParam("Password")String Password) throws Exception
{
pToken ptoken=new pToken();
return ptoken.getAuth_Token(User, Password).toString();
}
And the client:
try
{
Client cliente=Client.create();
WebResource wresource=cliente.resource("http://Localhost:8084/API_FE/webresources/Facturacion/getTokenUser");
String values="{\"User\":\"AbrahamV\",\"Password\":\"1234sa\"}";
ClientResponse response = wresource.type("application/json").post(ClientResponse.class, values);
String output = response.getEntity(String.class);System.out.println(output);
}
catch(Exception ex)
{
System.out.println("Error:"+ex.getMessage());
}
But when I run the client,the rest service doesn't recive anything. I don't know what Im doing bad, I'm new in this.
Response Web Service Rest:
run:
{"Message":"Son necesarias las credenciales de acceso","Token":"","Code":"afe-e01"}