Hi,
Le 16/02/2018 à 15:25, Kevin Hale Boyes a écrit : > I've been unable to retrieve operational attributes using the API. > I think the server is microsoft AD but I'm not sure. > > I give more detail about what I'm doing below but my question is simple: > How do I retrieve operational attributes using this API? > > > Here's my search call: > > connection.search(dn, LdapConstants.OBJECT_CLASS_STAR, > SearchScope.OBJECT, SchemaConstants.ALL_ATTRIBUTES_ARRAY); Sounds correct. > > When I iterate over the results and inspect the attributes of an entry > I don't find the operational attributes. Weird. You hsould have them. You can try using ALL_OPERATIONAL_ATTRIBUTES instead of ALL_ATTRIBUTES_ARRAY to see if it's any better. > > I was looking at the API code a bit and it seems that operational > attributes are somehow associated with a schema manager so that's the > next thing I tried. I put this before the search call: > > connection.setSchemaManager(new DefaultSchemaManager()); Actually, no, there is no relation with the SchemaManager. If you inject a SchemaManager, then it has to know about the OperationalAttributes you will get. In this very case, you'll get an error because they are unknown. > > But this fails now with an exception: > > 2018-02-16 07:18:52,034 WARN [NioProcessor-1] - The attribute > 'usncreated' cannot be stored-DefaultEntry.<init>330 > 2018-02-16 07:18:52,034 WARN [NioProcessor-1] - ERR_04269 > ATTRIBUTE_TYPE for OID usncreated does not > exist!-LdapNetworkConnection.exceptionCaught1973 > org.apache.directory.api.ldap.model.exception.LdapNoSuchAttributeException: > ERR_04269 ATTRIBUTE_TYPE for OID usncreated does not exist! > at > org.apache.directory.api.ldap.model.schema.registries.DefaultAttributeTypeRegistry.lookup(DefaultAttributeTypeRegistry.java:304) > at > org.apache.directory.api.ldap.model.schema.registries.DefaultAttributeTypeRegistry.lookup(DefaultAttributeTypeRegistry.java:47) > at > org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager.lookupAttributeTypeRegistry(DefaultSchemaManager.java:1756) > at > org.apache.directory.api.ldap.model.entry.DefaultEntry.<init>(DefaultEntry.java:318) > at > org.apache.directory.ldap.client.api.LdapNetworkConnection.messageReceived(LdapNetworkConnection.java:2311) > at > org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:858) > > I've also downloaded Apache Directory Studio and connected to the same > server and enabled the 'Fetch operational attributes while browsing' > feature on the connection. I can see the operational attributes when > I inspect a DN. I just can't seem to do it using this API. Actually, Studio uses the API, so it should work. Try with ALL_OPERATIONAL_ATTRIBUTES, see if it's any better. If you get the operational attribute, I would say we have a problem in the way we process a request might be buggy. Otherwise, it woud be interesting to get a wireshark capture of the dialogue, to see if the problem is in the request or in the response. -- Emmanuel Lecharny Symas.com directory.apache.org