我正在尝试将LDAP连接器用于Mule ESB。我能够看到一些结果,但由于响应不是任何格式,我无法对其进行任何操作。
我想做的是接受回复并将其转换为某种CSV,但这不是主要问题。
我的主要问题是我不知道如何处理我的回复,网上没有很多关于此的信息。
这是我的回复的一部分,它是机密信息所以我不能表现得多,但你会明白这一点。
srjava.util.ArrayListx a Isizexpwsr“org.mule.module.ldap.api.LDAPEntry 5 L attributest.Lorg /骡/模块/ LDAP / API / LDAPEntryAttributes; LdntLjava /郎/字符串; xPSR寄存器,org.mule.module.ldap.api.LDAPEntryAttributesf&安培; / FL attributestLjava / UTIL /地图; xpsrjava.util.HashMap`F loadFactorI thresholdxp?@wt streetaddresssr6org.mule.module.ldap.api.LDAPSingleValueEntryAttribute“k.eLvaluetLjava /郎/对象; XR + org.mule.module.ldap.api.LDAPEntryAttributeCؠJLnameq〜XPT streetAddresst85,街道iashdapsd postalcodesq〜Ť postalCodetpostal codetmailsq~q~tuser.user@org.orgttitlesq~q~tthetitletphysicaldeliveryofficenamesq~tphysicalDeliveryOfficeNametPLACEtsnsq〜q〜tNamet departmentsq~q~#tServicet givennamesq~t givenNametSurnametlsq~q~ * tCitytstsq~q~-tSTATEttelephonenumbersq~tetephoneNumbert9789 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="(&(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>
感谢您的帮助。
答案 0 :(得分:2)
您收到List
org.mule.module.ldap.api.LDAPEntry
,这正是预期的per the user guide:
<ldap:search>
执行LDAP搜索,返回包含所有结果LDAP条目的列表。
然后,您可以在变换器或组件中使用MEL表达式处理此列表,或者使用collection-splitter
将其拆分,或者使用for-each
范围进行迭代。