Corfu Navision 2016, Development Tips, How To, XMLports

Multiple namespace support in XML Ports – Microsoft Dynamics NAV 2016

Microsoft Dynamics NAV 2016 now enables developers to create XMLPorts which contain more than one namespace. Namespaces are used to distinguish fields and provide uniqueness.

The inclusion of namespaces enables parties to tag elements and resolve any ambiguity.

What is default Namespace?

This property specifies the default namespace for both import and export. The default value is unique for different XMLports.

For example, the following string specifies a namespace: urn:microsoft-dynamics-nav/xmlports/x100, where 100 is the ID of the XMLport.

What is Namespace?

You can use this property to declare one or more namespaces on the XMLport.

To add a namespace, you can choose the AssistEdit button or enter the namespaces directly in the field.

A namespace declaration consists of prefix and the namespace name, which has the format prefix=namespace. Separate multiple namespaces with a comma.

In the XML documents exported or imported by the XMLport, the namespaces declarations are only supported in the <root> element.

For example, if an XMLport has the namespace mynavprefix=mynavnamepace and the default namespace urn:nav:schema:all, then the root element will be as follows:

<Root xmlns:mynavprefix=”mynavnamespace” xmlns=”urn:nav:schema:all”>

To specify a default namespace, leave the Prefix field blank.

You can also specify the default namespace by specifying the namespace in the DefaultNamespace Property and setting the UseDefaultNamespace Property to Yes.

However, there can only be one default namespace. So if you want to specify a default namespace in the Namespace property, you must set the UseDefaultNamespace Property to No.

How to Define Namespace:
Namespace-1

Using Namespace:
Namespace-2

The final XMLport will be as below:
Namespace-3

Now save your XMLport and execute it.
Namespace-4

The output will be similar to below:
Namespace-5

Conclusion:

  • Multiple namespaces are defined in the root element of the XMLport and have their own property editor for defining them.
  • Developers can easily select the namespace via lookups on the element record.
  • XMLports are accessible both for developers and super users. Including the namespace prefix in the core editor lets you see key data while developing.

I will come up with more information in my upcoming posts.

1 thought on “Multiple namespace support in XML Ports – Microsoft Dynamics NAV 2016”

Comments are closed.