Ah, that's it ! After deleting the http:// of the hostname i got a
connection.
Thank you very much :)
But, on to the next problem.
After connecting to the LDAP directory I want to login/bind a user to
it.
That's the code for the binding:
public boolean login(String name, String password) {
LDAPConnection connection = new LDAPConnection();
String dn = "uid="+name+",OU=employe,OU=user,DC=xyz";
try {
connection.connect("dc1.xyz", 80);
connection.bind(dn, password);
return true;
} catch (LDAPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
However I get following error:
07-13 11:06:45.908: WARN/System.err(673): LDAPException(resultCode=84
(decoding error), errorMessage='The connection to server dc1.xyz:80
was closed while waiting for a response to a bind request
SimpleBindRequest(dn='uid=TP,OU=employe,OU=user,DC=xyz'): Unable to
read or decode an LDAP message: Invalid value length of 80 for an ASN.
1 integer element. Integer element values must have a length between
1 and 4 bytes.com.unboundid.asn1.ASN1Exception: Invalid value length
of 80 for an ASN.1 integer element. Integer element values must have
a length between 1 and 4 bytes.')
07-13 11:06:45.928: WARN/System.err(673): at
com.unboundid.ldap.sdk.SimpleBindRequest.handleResponse(SimpleBindRequest.java:
522)
07-13 11:06:45.928: WARN/System.err(673): at
com.unboundid.ldap.sdk.SimpleBindRequest.process(SimpleBindRequest.java:
428)
07-13 11:06:45.928: WARN/System.err(673): at
com.unboundid.ldap.sdk.LDAPConnection.bind(LDAPConnection.java:1688)
07-13 11:06:45.938: WARN/System.err(673): at
com.unboundid.ldap.sdk.LDAPConnection.bind(LDAPConnection.java:1651)
07-13 11:06:45.938: WARN/System.err(673): at
com.myApplication.de.login.login(login.java:54)
07-13 11:06:45.948: WARN/System.err(673): at
com.myApplication.de.login$1.onClick(login.java:31)
07-13 11:06:45.948: WARN/System.err(673): at
android.view.View.performClick(View.java:2408)
07-13 11:06:45.958: WARN/System.err(673): at android.view.View
$PerformClick.run(View.java:8816)
07-13 11:06:45.958: WARN/System.err(673): at
android.os.Handler.handleCallback(Handler.java:587)
07-13 11:06:45.968: WARN/System.err(673): at
android.os.Handler.dispatchMessage(Handler.java:92)
07-13 11:06:45.968: WARN/System.err(673): at
android.os.Looper.loop(Looper.java:123)
07-13 11:06:45.978: WARN/System.err(673): at
android.app.ActivityThread.main(ActivityThread.java:4627)
07-13 11:06:45.978: WARN/System.err(673): at
java.lang.reflect.Method.invokeNative(Native Method)
07-13 11:06:45.988: WARN/System.err(673): at
java.lang.reflect.Method.invoke(Method.java:521)
07-13 11:06:45.988: WARN/System.err(673): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-13 11:06:45.998: WARN/System.err(673): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-13 11:06:45.998: WARN/System.err(673): at
dalvik.system.NativeStart.main(Native Method)
Any ideas ?
On 12 Jul., 20:33, Neil <[email protected]> wrote:
>
> It looks like when you're creating theLDAPconnection, you're
> supplying a hostname of "http://dc1.xyz" and a port of 80. A hostname
> should simply be a resolvable name and not a URL (e.g., just
> "dc1.xyz"). However, it also looks like you're supplying information
> for a web server rather than a directory server. I would recommend
> checking your code to ensure that you're actually trying to connect to
> anLDAPserver and make sure that you just put in the hostname rather
> than a URL.
--
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