AIF Transformation of Sales Order and ASN - Custom Code in Class Library
We used the following code to meet specific requirements of transformation.
1- Sales Order Transformation
2- ASN Transformation
Place the DLL to Client and Server Folders first.
1- Client Path
C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin
2- Server Path
C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin
1- Setup Tools > AIF > Manage Transform from your Development Environment. Point to the DLL from the Client Path as follows. May be different for others
C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin
1- Sales Order Transformation
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Xml;
- using System.IO;
- using Microsoft.Dynamics.IntegrationFramework.Transform;
- namespace SalesOrderTransform
- {
- public class Class1:ITransform
- {
- public void Transform(System.IO.Stream input, System.IO.Stream output, string config)
- {
- StreamReader sreader = new StreamReader(input);
- XmlTextWriter xwriter = new XmlTextWriter(output, Encoding.UTF8);
- string tagName = "SalesOrder";
- string inputXml = sreader.ReadToEnd();
- xwriter.WriteStartElement(tagName);
- xwriter.WriteString(inputXml);
- sreader.Close();
- xwriter.WriteEndElement();
- xwriter.Close();
- }
- }
- }
2- ASN Transformation
- namespace AsnTransform
- {
- using Microsoft.Dynamics.IntegrationFramework.Transform;
- using System;
- using System.IO;
- using System.Reflection;
- using System.Xml;
- using System.Xml.XPath;
- using System.Xml.Xsl;
- public class AsnTrans : ITransform
- {
- public void Transform(Stream input, Stream output, string config)
- {
- Stream inputXML = File.Open(@"AsnTransform.AsnStylesheet.xslt", FileMode.Open);
- if (inputXML != null)
- {
- XPathDocument document = new XPathDocument(input);
- XPathDocument stylesheet = new XPathDocument(inputXML);
- XslCompiledTransform transform = new XslCompiledTransform();
- transform.Load(stylesheet);
- XmlWriterSettings settings = new XmlWriterSettings
- {
- OmitXmlDeclaration = false,
- Indent = true
- };
- XmlWriter results = XmlWriter.Create(output, settings);
- transform.Transform((IXPathNavigable)document, null, results);
- results.Close();
- output.Close();
- }
- else
- {
- output = input;
- }
- }
- }
- }
Place the DLL to Client and Server Folders first.
1- Client Path
C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin
2- Server Path
C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin
1- Setup Tools > AIF > Manage Transform from your Development Environment. Point to the DLL from the Client Path as follows. May be different for others
C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin
2- Once its setup then go to System Administration > Services and Application Integration Framework > Outbound Ports
Click the checkbox Transform all responses and select the appropriate transformation as defined in the development environment.
3- Now verification is required from Batch Jobs to check the transformation. Need to check if batch jobs are running properly to ensure document outputs.
Comments
Post a Comment