Communicating with NAS & Attain 3.00

Hi all This is my first post in this discussion forum. And god help me, this is probably a stupid question, but here goes :o) I am trying to communicate with Navision Application Server from an external VB Application. What I’m basically trying to do is accessing (viewing, modifying, inserting and deleting) data from Navision Server through the NAS using Navision Communication Component and Navision Bus Adapters (NP and MSMQ). I set up Server and Application Server along with importing the BusDemo and DemoSetup FOBs into the database. I have succeeded in creating XML-output from my VB-app resolving the server and delivering the output. But how do I treat the incoming data-stream in VB ?? (data send as new OutStream datatype in Attain) Code-bit from VB-app: Dim ComCom As New CommunicationComponent Dim MSMQBA As New MSMQBusAdapter Dim OutMsg As New OutMessage Dim InMsg As New InMessage Dim OutStrm As New ??? Dim InStrm As New ??? … Call ComCom.AddBusAdapter(MSMQBA, 0) … Set OutMsg = ComCom.CreateoutMessage(“Message queue://ZORBIT\private$\comcom2_queue”) OutMsg.Protocol = 0 OutMsg.Mode = 0 Set OutStrm = OutMsg.GetStream ------ This is a little bit of code from my app. I just can’t seem to get anything else than “Type Mismatch” from that last line. Have tried multiple stream objects for OutStrm var, but no success. If anyone have suceeded in communicating with NAS from another custom application, I would very much like to hear from them ASAP :o) Basically I just need to display and manipulate data in Navision Attain 3.00 … ALSO executing any trigger code associated with these data. Best Regards Zulo A/S, Denmark Bo Stig Christensen Web Developer

Basically NAS is not a tool which allows you to manipulate data within Navision (even though that is possible). It is rather a way to communicate with Navision via the Message-Queue by sending XML files (or streams) and receiving an answer from Navision in the same format. Example: You might want to ask Navision “What is the Balance of Customer 1234” or “How many units of Item 50000 are on stock”. For this purpose you send an appropriate XML file to Navision. However Navision has to understand your request, which means some programming in Codeunit 6702 has to be done. Navision will then process your request and send you the answer as another XML file which you have to process in your VB application. You could also ask Navision to process a certain Report with Filters you add and send the resulting Report back as HTML file. But whatever you decide to do: You need programming on both sides, your VB application as well as within Navision. From your original post I gain the impression that you consider NAS as something neutral like an ODBC driver which allowes requests and tasks on the DB like with SQL. But this is not the case! ------- With best regards from Switzerland Marcus Fabian

VB6 Communication Component Sample - InMessage- VB receives the Event triggered in CC2 when a message arrives. I’m not able to process this STREAM message in VB6 code. Could someone give a VB code example which process the stream of InMessage ? Thanks

When I used an external application (written in VB) to send and receive message from a NAS I used the Microsoft Message Queue components, not the Navision compontents. This way you can use the MessageArrived-event of the MSMQQueue-object to know when a new message has arrived on the queue. The body of the msmq-message contains the data send from Navision in plain text. Because I send the content of a XML-document from Navision I know this data is the plain text representation of the XML-document. The body of the Message Queue message can then be given to a XMLDOMDocument-object directly. The receiving code in a VB-app. looks something like: Dim objQueue as MSMQ.MSMQQueue Dim objMsg as MSMQ.MSMQMessage Dim objXML as MSXML2.DOMDocument Set objQueue = OpenQueue(“MyServer\MyQueue”) Set objMsg = objQueue.ReceiveCurrent(,10000) If Not objMsg Is Nothing Then Set objXML = CreateObject(“MSXML2.DOMDocument”) objXML.loadXML(objMsg.Body) Else MsgBox “No Message on the queue” End If 'Now the variable objXML will contain the xmldocument which was contained the MSMQ-message I hope this gets you on your way, Vincent van der Tol

Thank you Vincent. Effectively CC is not the best component on the client side. Finaly, for the moment, I used mswinsck.ocx.

Help,plz! Where can i download documentation about NAS, NAS-development?

We were doing some NAS/MSMQ development about a year ago in which we were using an external VB App that used the Microsoft MSMQ automation object to create and place messages on the queue and not the Navision BusAdaptor objects. One issue that stumped us for a while and might be save some time for people who are trying this is the correct setting of the label property of the message that was created in VB. We found the Navision ComCom and BusAdaptor code that was running in Navision would only pick messages off the queue if the label property was set to “Navision MSMQ-BA”. When you use the Navision Com object to create the meassages this is done automatically so is not an issue. Navision UK told us that this dependency on the label property was set so that multiple apps could use the same queue without picking each others messages and that the MSMQ documentation would be updated to describe this. Regards, Chris.