Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid client for REST web service with basic security
    primarykey
    data
    text
    <p>I have write a simple RESTful web service using basic authentication.I use tips from this page <a href="http://www.butonic.de/2010/06/18/a-simple-jax-rs-security-context-example-in-glassfish/" rel="noreferrer">secureRestWS</a>. They have also created a video and posted on youtube with more details. It works just fine when you open it in browser. You need to write User Name and Password in authorization window.</p> <p>I have also find a page with android client that call rest web service using httpclient and if the web service is without authentication it works. I am using this example <a href="http://lukencode.com/2010/04/27/calling-web-services-in-android-using-httpclient/" rel="noreferrer">androidRestWSClient</a>. But I don`t know how to add User Name and Password in this scenario, I tried like :</p> <pre><code>client.AddParam("User Name", "myusername"); client.AddParam("Password", "mypassword"); </code></pre> <p>or in header :</p> <pre><code>client.AddHeader("User Name", "myusername"); client.AddHeader("Password", "mypassword"); </code></pre> <p>but nothing works. I also try to create url that tell the web service username and password like :</p> <pre><code>http://192.168.1.42/RestWS/resources/helloWorld?username=myusername&amp;password=mypassword </code></pre> <p>I really don`t have a solution for this so if somebody have an example client I would appreciate that.</p> <p>In webservice I have simple GET method</p> <pre><code>@GET @Path("/text") public String getText() { return "Hello World!"; } </code></pre> <p>Do I need to use SecurityContext for username and password? Is it better to create authentication manualy like in this example :</p> <pre><code>http://aruld.info/accessing-restful-services-configured-with-ssl-using-resttemplate/ </code></pre> <p>Thanks for your help</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload