0

I am using a LDAP request to fetch AD data according to the requirement. The result from the request is the xml document (in lack of a schema for the results. The message containing the result/XMLDoc is named msg_AD_xxx_response) with masked values below:

<LDAPSearchResults>
  <ResultEntry DN="CN=Donald Duck,OU=BFN,OU=Organisation,OU=xxx,DC=xx,DC=xx">
    <LDAPAttribute Type="sn" Value="Donald" />
    <LDAPAttribute Type="givenName" Value="Duck" />
    <LDAPAttribute Type="extensionAttribute2" Value="xxx123" />
    <LDAPAttribute Type="extensionAttribute3" Value="1234" />
    <LDAPAttribute Type="extensionAttribute5" Value="eH_abcd" />
    <LDAPAttribute Type="mail" Value="[email protected]" />
  </ResultEntry>
  <ResultEntry DN="CN=Daisy Duck,OU=BFN,OU=Organisation,OU=xxx,DC=xx,DC=se">
    <LDAPAttribute Type="sn" Value="Duck" />
    <LDAPAttribute Type="givenName" Value="Daisy" />
    <LDAPAttribute Type="extensionAttribute2" Value="xxx123" />
    <LDAPAttribute Type="extensionAttribute3" Value="4321" />
    <LDAPAttribute Type="extensionAttribute5" Value="eH_xxx" />
    <LDAPAttribute Type="mail" Value="[email protected]" />
  </ResultEntry>

 .
 . (Lots of ResultEntries)
 .

</LDAPSearchResults>

The end result is supposed to be a flat file with the first row as a header with specifik non-changable data and propteries (but this will be another question. This info is for context only but if the solution is easy, please feel free to divulge it) and the rest of the entries the rest of the LDAP users.

USER;xxx;1067;2023-05-02T13:40:01;[email protected];F;
070511234;Donald;Duck;[email protected];;;;;;;;1234;
070514321;Daisy;Duck;[email protected];;;;;;;;4321;

I do realise that I will need schemas for both source and target but I have no idea how to make data go from source to targetand to the correct node (like 'Efternamn_sn' to 'Surname').

The target FF schema I created looks like below.

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://xxx.xxx_HR_xxx_to_xxx.Schemas.xxx_LDAPSearchResult" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://xxx.xxx_HR_xxx_to_xxx.Schemas.xxx_LDAPSearchResult" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="AllBfnUsers">
    <xs:annotation>
      <xs:appinfo>
        <b:recordInfo rootTypeName="AllBfnUsers" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" name="ResultEntry">
          <xs:complexType>
            <xs:sequence>
              <xs:element minOccurs="0" name="xxx_extensionAttribute2" type="xs:string" />
              <xs:element minOccurs="0" name="Fornamn_givenName" type="xs:string" />
              <xs:element minOccurs="0" name="Efternamn_sn" type="xs:string" />
              <xs:element minOccurs="0" name="xxx_extensionAttribute5" type="xs:string" />
              <xs:element minOccurs="0" name="Mail_mail" type="xs:string" />
              <xs:element minOccurs="0" name="xxx_extensionAttribute3" type="xs:string" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Now, I google a bit and found a schema that might work as a source schema (unmodified) for the mapping but not too sure about that either.

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="LDAPSearchResults">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" name="ResultEntry">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="LDAPAttribute">
                <xs:complexType>
                  <xs:attribute name="Type" type="xs:string" />
                  <xs:attribute name="Value" type="xs:string" use="required" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="DN" type="xs:string" use="required" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

I hope someone can see an easy solution to this issue and hopefully help out.

3
  • No, that schema does not match the XML, so you will need that first. To make data go from the source to the destination, you need to create a map.
    – Dijkgraaf
    Commented May 3, 2023 at 23:24
  • Hi, @Dijkgraaf. I noticed that I pasted in the wrong source schema (the old one was an experiment I tried with and not what the result from the LDAP request looks like). Apologies. Can you please take a look at the correct source schema? So the result I need is from source schema to target schema but I dont know how to fix the issue. Commented May 4, 2023 at 6:46
  • You mean the wrong XML example, yes, now it matches
    – Dijkgraaf
    Commented May 4, 2023 at 12:11

1 Answer 1

0

Quite simply you need to use the Equal Functoid, that is linked from Type, with one of the Type values (e.g. extensionAttribute2) as the other parameter, and the Value Mapping (Flattening) functoid, where the first link is from the equal functoid, and the second from the Value node, and link that to your destination node (e.g. xxx_extensionAttribute2), repeat for the other Type's, until they are all linked.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.