Create a source transformation in the Mapping Designer to read data from Microsoft Dynamics AX 2012.
When you select a Microsoft Dynamics AX V3 connection for a source transformation in a mapping to read data from Microsoft Dynamics AX 2012, you can select an operation based on the imported WSDL.
After you specify the configured connection, specify All Operations on the Source tab of the source transformation. The Secure Agent displays all the supported operations. You can select the operation that you want to perform. When you select Read Operations, a subset of the available read operations for the WSDL appears.
Select the operation you require, configure the request message in XML from the sample template provided, and configure the advanced properties for the operation. If you want to write to a relational target, define a relational structure for the customer data by mapping the incoming fields that is in hierarchical format to the output fields in relational format. When you run the mapping, the Secure Agent retrieves data for the specified operation from Microsoft Dynamics AX 2012.
Configuring a Request Using Request Message Editor
When you create a source transformation, configure an XML request message for the operation that you want to perform in Microsoft Dynamics AX V3.
Use the Request Message Editor to create a request message. The request message is in XML format. You can use the default request message for the operation and then customize the request message to specify the data that you want to enter into the data flow.
To customize your request, copy the request message from the sample template to the Request Message Editor pane where you can edit the XML message and add the attributes for the request.
For example, you want to perform an operation find using Microsoft Dynamics AX V3 Connector to retrieve data of customers who belong to a particular group. Specify the attribute CustGroup values in the request message to fetch customers who belong to that group. For example, CustGroup Retail Customers.
The following XML sample shows the request input elements that you want in the response:
<!--1 or more repetitions:--> <proc:find_INPUT xmlns:proc="http://xml.schemas/infa/procedure/"> <!--Optional:--> <find> <!--1 or more repetitions:--> <CustomerServiceFindRequest> <!--Optional:--> <QueryCriteria> <!--1 or more repetitions:--> <CriteriaElement> <!--1 or more repetitions:--> <DataSourceName> CustTable </DataSourceName> <!--1 or more repetitions:--> <FieldName> CustGroup </FieldName> <!--1 or more repetitions:--> <Operator> Equal </Operator> <!--1 or more repetitions:--> <Value1> 30 </Value1> <!--Optional:--> </CriteriaElement> </QueryCriteria> </CustomerServiceFindRequest> </find> </proc:find_INPUT>
The following image shows the validated request message in a find operation in the Mapping Designer:
Ensure that you use well-formed XML formatting in the request message. You can verify if the XML request is valid to ensure that the XML matches the structure expected by the operation.
Parameterize Input Values in a Request Message
You can use in-out parameters to represent input values in a request XML.
Configure the in-out parameters in the Mapping Designer. From the Mapping Designer page, you open the parameters panel and configure an in-out parameter.
The following image shows a configured CustGroup in-out parameter value:
After you configure a parameter, use the parameter name in the following format, $$Name, in a request message. The XML uses the fields from the parameterized object.
For example, you want to use parameterized CustGroup value in an XML request for a find operation.
The following sample request shows the parameterized values that you can specify in an XML request:
<!--1 or more repetitions:--> <proc:find_INPUT xmlns:proc="http://xml.schemas/infa/procedure/"> <!--Optional:--> <find> <!--1 or more repetitions:--> <CustomerServiceFindRequest> <!--Optional:--> <QueryCriteria> <!--1 or more repetitions:--> <CriteriaElement> <!--1 or more repetitions:--> <DataSourceName> CustTable </DataSourceName> <!--1 or more repetitions:--> <FieldName> CustGroup </FieldName> <!--1 or more repetitions:--> <Operator> Equal </Operator> <!--1 or more repetitions:--> <Value1> $$CustGroup </Value1> <!--Optional:--> </CriteriaElement> </QueryCriteria> </CustomerServiceFindRequest> </find> </proc:find_INPUT>
The following image shows how to use a configured in-out parameter in a mapping task:
Field Mapping in a Source Transformation
The response message format follows the service response definition in Microsoft Dynamics AX V3. You can map response fields from a hierarchical to a relational structure of output groups and fields.
After you configure an operation for a source and specify the request message, create the relational format from the hierarchical data to include groups and fields that you want in the output.
To do this, select the elements in the response structure that you want to include as output fields. The Secure Agent converts the XML response in the hierarchical structure to relational groups at run time.
The output groups along with the primary and foreign keys are automatically generated. You can hover the mouse over an output field to view the XPath expression, which indicates which field the output field is mapped to in the response structure of the hierarchy tree.
The following image shows an example hierarchical response structure generated from the request XML for the find operation of customer service:
For example, in the Response Structure pane, you select AccountNum and CustGroup, and then you select Address, which is located under a different parent in the hierarchy. In the Output Fields area, the structure is relational with system-generated primary and foreign keys.
You can map fields from only one output group to a particular branch of the response structure hierarchy. For example, if County is a sibling of nodes that are mapped to the DirParty group, you must map County to the DirParty group.
You can edit the data type, precision, and scale for the groups and fields after mapping the fields.
Creating Packed Fields in a Field Mapping
You can reduce the number of output groups for a complex request message by marking fields that you want to pack when you configure the field mapping.
You can pack multiple instances of a single element or a hierarchy of elements into one field. A packed icon displays next to elements marked to be packed, indicating that you can pack the entire element into one output field when you check that element.
Fields can come from the source that are already marked for packing. You can unpack fields by clicking the pack icon. You cannot select fields that are descendants of packed fields.
The following image shows the packed CustTable element:
When you run the mapping, the agent packs the element and its descendants into a single XML string.