directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <elecha...@gmail.com>
Subject Re: [LDAP API 1.0.0-RC2] server side sorting control with DSMLv2
Date Fri, 27 Jan 2017 14:38:51 GMT
I have committed a fix for this problem. Yu might want to rebuild the
API and test it.


Le 27/01/2017 à 13:16, clauds2x@gmail.com a écrit :
> Hi,
>
> I have an application running in an OSGi container that uses the LDAP
> API and DSML parser and I would like to use the server side sorting
> control.
>
> When I send the following control...
>
>         <ns2:control criticality="true" type="1.2.840.113556.1.4.473">
>             <ns2:controlValue
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="xs:base64Binary">MAYwBAQCc24=</ns2:controlValue>
>         </ns2:control>
>
> ...I get an error: "sorted results control value is absent".
>
> 2017-01-27 12:19:37,304 | DEBUG | NioProcessor-1   |
> CODEC_LOG                        | 94 -
> org.apache.directory.api.ldap.net.mina - 1.0.0.RC2 | Decoded
> LdapMessage : MessageType : SEARCH_RESULT_DONE
> Message ID : 4
>     Search Result Done
>         Ldap Result
>             Result code : (PROTOCOL_ERROR) protocolError
>             Matched Dn : ''
>             Diagnostic message : 'sorted results control value is absent'
>
> I saw that an OpaqueControl is created for the sort control. Debugging
> I noticed that setEncodedValue is never called.
>
> org.apache.directory.api.ldap.model.message.SearchRequestImpl@7ea4768c
> OpaqueControl Control
>         Type OID    : '1.2.840.113556.1.4.473'
>         Criticality : 'true'
>
> Looking into this I came across the control factories registered on
> LdapApiService and saw that there are two implementations:
> - DefaultLdapCodecService
> - StandaloneLdapApiService
>
> DefaultLdapCodecService is what is initialized in OSGi setup. I
> noticed that DefaultLdapCodecService unlike StandaloneLdapApiService
> does not register SortRequestFactory/SortResponseFactory. To try if
> this solves the issue I registered the two factories but then I get a
> ClassCastException:
>
> Caused by: java.lang.ClassCastException:
> org.apache.directory.api.dsmlv2.DsmlControl cannot be cast to
> org.apache.directory.api.ldap.model.message.controls.SortRequest
>     at
> org.apache.directory.api.ldap.codec.controls.sort.SortRequestFactory.newCodecControl(SortRequestFactory.java:35)[89:org.apache.directory.api.ldap.codec.core:1.0.0.RC2]
>     at
> org.apache.directory.api.ldap.codec.osgi.DefaultLdapCodecService.newControl(DefaultLdapCodecService.java:253)
>     at
> org.apache.directory.api.ldap.codec.api.MessageDecorator.addControl(MessageDecorator.java:329)[89:org.apache.directory.api.ldap.codec.core:1.0.0.RC2]
>     at
> org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator.addControl(SearchRequestDecorator.java:1072)
>     at
> org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator.addControl(SearchRequestDecorator.java:83)
>     at
> org.apache.directory.api.ldap.codec.api.MessageDecorator.getDecorator(MessageDecorator.java:204)[89:org.apache.directory.api.ldap.codec.core:1.0.0.RC2]
>     at
> org.apache.directory.api.ldap.codec.api.LdapEncoder.encodeMessage(LdapEncoder.java:159)[89:org.apache.directory.api.ldap.codec.core:1.0.0.RC2]
>     at
> org.apache.directory.api.ldap.codec.protocol.mina.LdapProtocolEncoder.encode(LdapProtocolEncoder.java:81)
>     at
> org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCodecFilter.java:299)
>     ... 58 more
>
> I do not understand how the DSMLv2 parser works together with the LDAP
> codec and start to wonder if the server side sort control is even
> supposed to work at the moment.
> - Is it possible that the parser for DSMLv2 does not support the
> server side sort control?
> - Should SortRequestFactory/SortResponseFactory be registered or is
> there a reason why they are not registered on DefaultLdapCodecService
> per default?
>
> I would appreciate any hints to get this working.
>
> Cheers
> Claudia
>

-- 
Emmanuel Lecharny

Symas.com
directory.apache.org


Mime
View raw message