On Fri, Jan 27, 2017 at 5:46 PM, [email protected] <[email protected]>
wrote:

> 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.SortReques
> tFactory.newCodecControl(SortRequestFactory.java:35)[89:org.
> apache.directory.api.ldap.codec.core:1.0.0.RC2]
>     at org.apache.directory.api.ldap.codec.osgi.DefaultLdapCodecSer
> vice.newControl(DefaultLdapCodecService.java:253)
>     at org.apache.directory.api.ldap.codec.api.MessageDecorator.add
> Control(MessageDecorator.java:329)[89:org.apache.directory.
> api.ldap.codec.core:1.0.0.RC2]
>     at org.apache.directory.api.ldap.codec.decorators.SearchRequest
> Decorator.addControl(SearchRequestDecorator.java:1072)
>     at org.apache.directory.api.ldap.codec.decorators.SearchRequest
> Decorator.addControl(SearchRequestDecorator.java:83)
>     at org.apache.directory.api.ldap.codec.api.MessageDecorator.get
> Decorator(MessageDecorator.java:204)[89:org.apache.directory
> .api.ldap.codec.core:1.0.0.RC2]
>     at org.apache.directory.api.ldap.codec.api.LdapEncoder.encodeMe
> ssage(LdapEncoder.java:159)[89:org.apache.directory.api.
> ldap.codec.core:1.0.0.RC2]
>     at org.apache.directory.api.ldap.codec.protocol.mina.LdapProtoc
> olEncoder.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?
>
no this case shouldn't arise cause DSML engine internally uses LDAP API to
perform the operation

> - Should SortRequestFactory/SortResponseFactory be registered or is there
> a reason why they are not registered on DefaultLdapCodecService per default?
>
I am suspecting that this might be the issue.

>
> I would appreciate any hints to get this working.
>
> Cheers
> Claudia
>
> Kiran Ayyagari

Reply via email to