Mule LDAP搜索json输出
在我的mule流中,我有一个LDAP页面结果搜索,如下所示。我想得到json格式的输出。我要回一份ArrayListMule 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
<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条目(使用MEL表达式转换器),或者使用LDAP:paged result search
返回单个LDAP条目LDAP:lookup
- 它将LDAP条目转换为其LDIF表示形式,LDIF表示形式为
。然后将该字符串序列化为JSON。我认为您需要选择一个,或者将ldif的字符串
ldap条目替换为映射的
,以便它可以正确地序列化为JSON,或者删除JSON transformer的ldap条目
,让流返回ldif表示。因为您声明要从最终表示中删除一些值,所以我觉得您对JSON表示比LDIF表示更感兴趣。在这种情况下,前一种方法就是做什么:在映射的JSON:object
,您可以在JSON序列化映射之前,使用MEL表达式转换器过滤您不想要的内容ldap条目之后
���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