Hi
I have seen one example in MSDN regarding Navision Communication through Message Queues. which passes a string to navision and gets back the string with uppercase from an windows application through Message Queues.
for reference :
Talking with Navision: Say Hello to Navision and Expect Navision to Be Politehttp://msdn2.microsoft.com/en-us/library/ms952182.aspx
If I pass Dataset as follows to the Mesage Queue :
Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
sqlconn.ConnectionString = "database=VConnect;server= (local);user id=sa;password=password2006"
Dim rs As New DataSet
Dim da As SqlDataAdapter
Dim Command As New SqlCommand
Command.CommandType = CommandType.Text
Command.CommandText = "SELECT * FROM VK_Suppliers"
sqlconn.Open()
Command.Connection = sqlconn
da = New SqlDataAdapter(Command)
da.Fill(rs)
mqToNavision.Send(rs.Tables(0), "Navision MSMQ-BA")
mqFromNavision.BeginReceive(New System.TimeSpan(0, 0, 0, 30))
sqlconn.Close()
End Sub
What code I need to write in the following Automation Event to receive that dataset.
CC2 automation 'Navision Communication Component version
2'.CommunicationComponent
CC2::MessageReceived(VAR InMessage : Automation "''.IDISPATCH")
regards
ajay
Comments
I already did that!
I think you can get help here:
http://msdn.microsoft.com/library/defau ... ayerws.asp
Regards,
but my scenario is I have a set of records , how to send these set of records to Navision through Message queues.
For example I have a table Temp contains 100 records in sql db. from the
outside application(assume that this is windows application using vb .net or C#). how can i send these 100 records to the message queue at a time
if i were send those set of records to message queue , what code i have to write in navision to receive these set of records.
regards
ajay
why pass the entire dataset? Why not use dataset.WriteXML to write the data as XML to the Message Queue?
Storing them as an XML Document and read that using the DOM?
From the devguide.chm on the Navision install Disk
Receiving a Document - Code Example 2
In this example, we use a single instance codeunit to initialize the Navision Communication Component, establish contact to a Navision MS-Message Queue Bus Adapter, open the bus adapter's receive queue, read the message that is received and then send a reply.
For the purpose of this example, we have defined the following variables:
Variable Name Data Type Subtype Length
MQBus Automation 'Navision MS-Message Queue Bus Adapter'.MSMQBusAdapter
CC2 Automation 'Navision Communication Component Version 2'.CommunicationComponent
InMsg Automation 'Navision Communication Component version 2'.InMessage
InS InStream
Txt Text 100
OutMsg Automation 'Navision Communication Component version 2'.OutMessage
OutS OutStream
Note that in the following example, you can use .\MyQueue (instead of MyMessageQueueServer\MyQueue) if you have installed the Microsoft Message Queue Server on your local machine.
Example
But if .Net application sends a set of records to the message queue in an xml format , how can i receive those set of records in navision single instance codeunit
That should have nothing to do with it, if you Message payload is an XML document. You Store the XML in a temp file or steam it inside Navision.
Whats the exact problem? Have you coded it and get an error? If so whats the error? Or are you still designing it?
/TH
In Navision, you should only have to iterate the nodes using the XML DOM objects.
can u send some code example for this
The example that u have given, just talking about a simple string.
you are receiving a string from .net and u r sending the string back
to .net using MSMQ.
If I receive set of records in XML format through message queue how to
parse them in Navision. I need a simple example.
ajay
the XMLNode object is a member of the Microsoft XMLDOM libraries, and allows you to iterate the nodes of an XML document. Note that I'm saying nodes here, and not elements - in XML, both elements AND attributes are considered nodes.
SelectSingleNode accepts a parameter in the form of an XSL/XPath query.
For an example of how to use SelectSingleNode, look here
For an example of how to access Navision through a web service, look here
finally - for information on XSL and XPath queries, check out w3school under the XML tutorials.
Is it really feasible to develop third party application using message queues.
I am with lot of problems while developing the integration with MessageQueues.
all the messages struk up in the queue and only, navision picks up the first message.
do u know how to clear the messages in the queue
ajay
I've done this 3 times. Twice with MSMQ and once with MQSeries so I know it works :-)