Setting up XMLport

luc50514
Member Posts: 2
I am posting this for information on how to set up a XMLport because I couldn't find information and how you would set up a XMLport in Navision. I had to learn this on my own. Feel free to comment or correct any or all of my findings. I don't care about being wrong in the beginning as long as I am right at the end. ](*,)
If you open an xml document you will find that the document has a bunch of “<” and “</” these symbols define a tag in the xml document. So <name> is called a beginning tag and </name> is the end tag. Put the two tags together and you have an element. So in the xml document that is sent to us from the internet the very first element is the root element. Some people call this the document type it is just semantics to me. All the elements below the root element they are child elements of the root. Also if an element is inside of another element this element is also called a child of the element. The element containing the child is also called the parent.
<order>root element
<name> Parent element
<first>firstname</first>Child element
<last>lastname</last>Child element
</name>
</order>
When you set up the xml port in Navision you have to set up every element in the xml document. This would include the root element and every element contained in the xml document. To set the xml port to insert a record in a table the parent element has to be set equal to the table and then the child elements will be set to the fields of the table.
TagName TagType SourceType DataSource
OrderHeader Element Text <OrderHeader>
Order Element Table <TableName>(TableName)
OrderNo Element Field <TableName>::Fieldname
CustomerNo Element Field <TableName>::Fieldname
Sell-toName Element Field <TableName>::Fieldname
Notice how the root element is set as text and it has to be included in the port. If you do not have the root element, the port will not write the information directly to the table when the xml port is ran. When you compile the xmlport it will also give you an error message when you compile without the root element. The XMLport writes directly to the table that you specify. We all know that data needs to be checked before we input into the database. For that reason they put a trigger in the xml port called in our case Order - Import::OnBeforeInsertRecord(). We can put our checks in this trigger to check the data and XMLport.SKIP if the data isn’t clean.
This is very basic i know but hopefully the next person wondering how to set one of these up with no documentation will be able to.
If you open an xml document you will find that the document has a bunch of “<” and “</” these symbols define a tag in the xml document. So <name> is called a beginning tag and </name> is the end tag. Put the two tags together and you have an element. So in the xml document that is sent to us from the internet the very first element is the root element. Some people call this the document type it is just semantics to me. All the elements below the root element they are child elements of the root. Also if an element is inside of another element this element is also called a child of the element. The element containing the child is also called the parent.
<order>root element
<name> Parent element
<first>firstname</first>Child element
<last>lastname</last>Child element
</name>
</order>
When you set up the xml port in Navision you have to set up every element in the xml document. This would include the root element and every element contained in the xml document. To set the xml port to insert a record in a table the parent element has to be set equal to the table and then the child elements will be set to the fields of the table.
TagName TagType SourceType DataSource
OrderHeader Element Text <OrderHeader>
Order Element Table <TableName>(TableName)
OrderNo Element Field <TableName>::Fieldname
CustomerNo Element Field <TableName>::Fieldname
Sell-toName Element Field <TableName>::Fieldname
Notice how the root element is set as text and it has to be included in the port. If you do not have the root element, the port will not write the information directly to the table when the xml port is ran. When you compile the xmlport it will also give you an error message when you compile without the root element. The XMLport writes directly to the table that you specify. We all know that data needs to be checked before we input into the database. For that reason they put a trigger in the xml port called in our case Order - Import::OnBeforeInsertRecord(). We can put our checks in this trigger to check the data and XMLport.SKIP if the data isn’t clean.
This is very basic i know but hopefully the next person wondering how to set one of these up with no documentation will be able to.
0
Comments
-
I didn't realize how many posts have been made about this untill I did the forum search for "xmlport". these posts might help you.
here's 1 to start
http://www.mibuso.com/forum/viewtopic.php?t=49500
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions