|
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.
|