I am quite new in NAVISION and need som help, I did read Application Designer’s Guis and Development Guid for Communication Componenets but still have som problem with MLPORT and MSMQ.

I have a simple .NET app that can communicate with Navision with MSMQ by a CODEUNIT, and I have another CODEUNIT that can make a XML file from a XMLPORT.

I wonder how I can use XMLPORT in my first CODEUNIT to send back the this XML content to my .NET app insted of writing to file.

Any suggestion!?

Well it’s not really my area of expertise, but I found this great blog entry with a lot of details about how to communicate with MSMQ and XMLPorts:


I hope it can help you.


Thanks for the tip, I have seen that and I am doing the same stoff.

My problem is that some how the XML back to my .NET app get corrupt( a lot of dots(.) in the XML ( I can see that from Message queuing) and therefore I get the following exception in my .NET app:

Cannot deserialize the message passed as an argument. Cannot recognize the serialization format.

But the funny thing is that I have another CODEUNIT that do almost the same job except that I do write the XML to a file and the XML is OK.

Are you streaming the XML back and forth?

If you are try saving it locally then picking it up.

If you aren’t try streaming it.

Or else try using the XML Dom instead of the XML port and see if that works for you.


I try to send some string from my .NET app to Navision and based on this string so I will try to get some XML back

ex: “Customer” will( I hope) to get back a XML with daa about Customers

“Item” to get Items from Navision.

I have problem with both XMLPORT and XMLDOM but with a slightly difference, when I use the XMLPORT so result what I can see from Message Queuing is the following

whole XML is splitted by DOT(.) and When I use XMLDOM so I getsome extra DOTS in the end of the XML,.

May be my explanation is not that clear as it should be but forgive me for my NAVISION-ignorence.

Do you have any advise fo me?

Okay my suggestion would be to break this down into easy to manage chunks to find out “What” is causing the issue.

Can you try creating an offline XML file that is perfect.

Then try using your code to send it down the 'Q and back. If the file does not get corrupted, then you need to go back and look at how the file is being created, maybe your schema is out slightly?


I’m also a nav n00b trying to put together a solution where a web service communicates with NAV app. server. The problem with the dots disappeared when we switched format from utf-16 to utf-8 in the XMLPort.

Still trying to work out how to serialize the message going out from NAS so that it can be deserialized in my .NET code. Any suggestions on that would be helpful. :slight_smile:

If this is going back into a .Net application and if you are using SQL Server 2005, why not create a sproc and use “Select * From [Table] [Join] FOR XML AUTO”

But if you are using .Net 2.0+ why not use ADO.Net and the disconnected Dataset to suck your data in? Remember the concern is writing the data back to a Navision Database not sucking it out.

.Net 2.0 comes with classes for both SQL (sqlclient) and ODBC/ADO for Native.

If none of these solutions work for you can you explain to me what you mean by the dots have disappeared, and the issue with your serialisation?


Ah, thanks, I’ll see if we can try the select … for XML AUTO and how that works out.