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.