Hi all.

I am feeling very bad as i am not getting help for android basic
authentication. follwong class to access the webservice. but not able
to do so.

I have been searching over the internet but no hope.  Anyone has
working code. Will be great relief to all New android developers those
are struggling with such problem. I can expect from google to provide
the same with examples.



# public class HttpTransportBasicAuth extends HttpTransport {
#     private String username;
#     private String password;
#     /**
#      * Constructor with username and password
#      *
#      * @param url
#      *            The url address of the webservice endpoint
#      * @param username
#      *            Username for the Basic Authentication challenge
RFC 2617
#      * @param password
#      *            Password for the Basic Authentication challenge
RFC 2617
#      */
#     public HttpTransportBasicAuth(String url, String username,
String password) {
#         super(url);
#         this.username = username;
#         this.password = password;
#     }
#
#     protected ServiceConnection getServiceConnection() throws
IOException {
#         ServiceConnectionMidp midpConnection = new
ServiceConnectionMidp(url);
#         addBasicAuthentication(midpConnection);
#         return midpConnection;
#     }
#
#     protected void addBasicAuthentication(ServiceConnection
midpConnection) throws IOException {
#         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);
#             midpConnection.setRequestProperty("Authorization",
buf.toString());
#         }
#     }
#
# }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to