This version of www.jasonlam604.com is deprecated.
If you are not redirected to the new web site in 3 seconds, please click on the following link
http://www.jasonlam604.com/v2/index.php
 

 


kSOAP with Basic Authentication
by Jason Lam

public String username = null;
public String password = null;

if (username != null && password != null) {


StringBuffer buf = new
StringBuffer(username);
buf.append(':').append(password);
byte[] raw = buf.toString().getBytes();
buf.setLength(0);
buf.append("Basic ");
org.kobjects.base64.Base64.encode(raw, 0,
raw.length, buf);
connection.setRequestProperty
("Authorization",
buf.toString());


}


You will need to add in the public method to set the Credientials too.

Thanks to stonedMonk from the kSOAP forum for the tip.

 

| Home | Tutorials | Tips / Hints | Books | Links |
| Resume | Portfolio | Services | Contact |

The contents of this webpage are copyright © 2003 - 2006
Jason Lam All Rights Reserved