在搜索时使用 Mule ESB 的 LDAP 连接器获得一致的响应

Getting coherent response with Mule ESB's LDAP connector on search

我正在尝试将 LDAP 连接器用于 Mule ESB。我能够看到一些结果,但我无法对其执行任何操作,因为响应不是任何格式。

我想做的是获取响应并将其转换为某种 CSV,但这不是主要问题。

我的主要问题是我不知道如何处理我的回复,网上没有很多关于此的信息。

这是我回复的一部分,它是机密信息,所以我不能展示太多,但你会明白的。

��srjava.util.ArrayListx����a�Isizexp w sr"org.mule.module.ldap.api.LDAPEntry���5���L attributest.Lorg/mule/module/ldap/api/LDAPEntryAttributes;LdntLjava/lang/String;xpsr,org.mule.module.ldap.api.LDAPEntryAttributesf�&/f�L attributestLjava/util/Map;xpsrjava.util.HashMap���`�F loadFactorI thresholdxp?@wt streetaddresssr6org.mule.module.ldap.api.LDAPSingleValueEntryAttribute"�k.�eLvaluetLjava/lang/Object;xr+org.mule.module.ldap.api.LDAPEntryAttribute�C�ؠJ�Lnameq~xpt streetAddresst85, street iashdapsd postalcodesq~t postalCodetpostal codetmailsq~q~tuser.user@org.orgttitlesq~q~tthetitletphysicaldeliveryofficenamesq~tphysicalDeliveryOfficeNametPLACEtsnsq~q~ tNamet departmentsq~q~#tServicet givennamesq~t givenNametSurnametlsq~q~*tCitytstsq~q~-tSTATEttelephonenumbersq~ttelephoneNumbert9789 987 987xtACN=Surnam Name,OU=myou,OU=myou,OU=myou,DC=mydc

这是我的流程:

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper" xmlns:wmq="http://www.mulesoft.org/schema/mule/ee/wmq" xmlns:http="http://www.mulesoft.org/schema/mule/http"
    xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.6.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ldap="http://www.mulesoft.org/schema/mule/ldap"
    xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/ldap http://www.mulesoft.org/schema/mule/ldap/current/mule-ldap.xsd
http://www.mulesoft.org/schema/mule/ee/wmq http://www.mulesoft.org/schema/mule/ee/wmq/current/mule-wmq-ee.xsd
http://www.mulesoft.org/schema/mule/ee/data-mapper http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd">
    <ldap:config name="ldapConf" url="ldap://host.host.host:389/" authDn="user@host.host" authPassword="secret" doc:name="LDAP"/>
    <flow name="activedirectoryGetUsers">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP (Deprecated)" path="activeDirectory"/>
        <ldap:search config-ref="ldapConf" doc:name="LDAP" baseDn="OU=myOu,DC=myDC, DC=myDC" filter="(&amp;(objectClass=user)(Company=*mycompany))" scope="SUB_TREE">
        <ldap:attributes>
                <ldap:attribute>dn</ldap:attribute>
                <ldap:attribute>GivenName</ldap:attribute>
                <ldap:attribute>sn</ldap:attribute>
                <ldap:attribute>mail</ldap:attribute>
                <ldap:attribute>telephonenumber</ldap:attribute>    
                <ldap:attribute>Department</ldap:attribute> 
                <ldap:attribute>Title</ldap:attribute> 
                <ldap:attribute>physicalDeliveryOfficeName</ldap:attribute> 
                <ldap:attribute>l</ldap:attribute>     
                <ldap:attribute>st</ldap:attribute>
                <ldap:attribute>postalCode</ldap:attribute>
                <ldap:attribute>streetAddress</ldap:attribute>                     
        </ldap:attributes>          
    </ldap:search>
    </flow>
</mule>

感谢您的帮助。

您收到 Listorg.mule.module.ldap.api.LDAPEntry which is exactly what is expected per the user guide

<ldap:search>

Performs a LDAP search returning a list with all the resulting LDAP entries.

然后您可以在转换器或组件中使用 MEL 表达式处理此列表,或者使用 collection-splitter 拆分它或使用 for-each 范围迭代它。