Mule LDAP搜索json输出

Mule LDAP搜索json输出,mule,Mule,在我的mule流中,我有一个LDAP页面结果搜索,如下所示。我想得到json格式的输出。我要回一份ArrayList <flow name="ldapsearchFlow1" doc:name="ldapsearchFlow1"> <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="3555" doc:name="HTTP"/> <ldap

在我的mule流中,我有一个LDAP页面结果搜索,如下所示。我想得到json格式的输出。我要回一份ArrayList

<flow name="ldapsearchFlow1" doc:name="ldapsearchFlow1">
    <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="3555" doc:name="HTTP"/>
    <ldap:paged-result-search config-ref="LDAP" baseDn="${xxx.ad.base}" filter="(objectClass=*)" pageSize="100" doc:name="LDAP">
        <ldap:attributes>
            <ldap:attribute>uid</ldap:attribute>
            <ldap:attribute>cn</ldap:attribute>
        </ldap:attributes>          
    </ldap:paged-result-search>
     <ldap:ldap-entry-to-ldif doc:name="ldap1"/>             
    <json:object-to-json-transformer doc:name="Object to JSON" />       
</flow> 

配置中有两个问题与ldif的ldap条目的使用有关:

  • 它将单个LDAP条目转换为LDIF,但您可以使用它来处理
    LDAP:paged result search
    结果集合。您需要从搜索结果中选择一个LDAP条目(使用MEL表达式转换器),或者使用
    LDAP:lookup
    返回单个LDAP条目
  • 它将LDAP条目转换为其LDIF表示形式,LDIF表示形式为
    字符串
    。然后将该字符串序列化为JSON。我认为您需要选择一个,或者将ldif的
    ldap条目替换为映射的
    ldap条目
    ,以便它可以正确地序列化为JSON,或者删除JSON transformer的
    JSON:object
    ,让流返回ldif表示。因为您声明要从最终表示中删除一些值,所以我觉得您对JSON表示比LDIF表示更感兴趣。在这种情况下,前一种方法就是做什么:在映射的
    ldap条目之后
    ,您可以在JSON序列化映射之前,使用MEL表达式转换器过滤您不想要的内容
���sr�java.util.ArrayListx����a��I�sizexp��%w��%t�W{"dn":"CN=aaronj,ou=people,dc=xxx,dc=org","attributes":{"count":1},"attributeCount":1}t�W{"dn":"CN=abbasa,ou=people,dc=xxx,dc=org","attributes":{"count":1},"attributeCount":1}t�X{"dn":"CN=abbottl,ou=people,dc=xxx,dc=org","attributes":{"count":1},"attributeCount":1}t�\{"dn":"CN=abeyrathnep,ou=people,dc=xxx,dc=org","attributes":{"count":1},"attributeCount":1}t�Z