MessageQueue with Navision

rehnatrehnat Member Posts: 43
edited 2005-05-27 in Navision Attain
Hi,
I'm using webservices to communicate with Navision. I used the code present in html page :http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnav/html/nav_accbizlayerws.asp.
I created two messagequeue: one to send message to navision and the other to receive the response of the message sent.
The code of the webmethod is:

string request = "GetCustomer()";
toNavision.Send (request, "Navision MSMQ-BA");
fromNavision.Formatter = new
System.Messaging.XmlMessageFormatter (new Type[] {typeof (NavDS)});
msg = fromNavision.Receive (new System.TimeSpan (0,0,0,20));
NavDS nds = new NavDS ();
nds.ReadXml (msg.BodyStream, System.Data.XmlReadMode.Auto);
return nds;
I look on the folder of my messageQueue(N.B: my messageQueue are private). The MessageQueue Which sends message to navision contains the message sent but there is no message in the messageQueue which receives response from navision . So no message is returned to this Queue from Navision
Also I look on the application log and the system log and there is no message concerning Navision, so i can't know what is the error.
Please somebody can help me to know the problem?
Thank you for your help.

Comments

  • andreofandreof Member Posts: 133
    are you using NAS?

    Is Navision Application Server working well?
    It seem's that it can't consume the message you sent from the webservice
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
    http://www.solvingdynamics.com
  • rehnatrehnat Member Posts: 43
    Hi, andreof
    I'm using NAS and it works well because when i start the start up parameter the application log indicates that it starts well.
    is there any debuuger in NAS?
  • andreofandreof Member Posts: 133
    If NAS is working fine then it has to be a problem of permissions to the queue or the path to the queue, in navision, not set right. NAS couldn't reach the message you sent to the queue because when it does the message disapears, even when it does nothing with it.
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
    http://www.solvingdynamics.com
  • rehnatrehnat Member Posts: 43
    Hi andreof,
    I ran the debug "step into(F8)" of navision and the execution stopped suddenly with the error "break error" at the instruction CREATE(MQBUS).
    I remind that my code in navision is:

    CLEAR(CC2) ;
    CREATE(MQBUS);
    CREATE(CC2);
    CREATE (XMLDom);
    CC2.AddBusAdapter(MQBUS,1);
    MQBUS.OpenReceiveQueue('.\private$\MQToNavision',0,0);

    the error is in the second instruction (Create MQBUS) where MQBUS is an automation variable of subtype Navision MS-Message Queue Bus Adapter.MSMQBusAdapter
  • andreofandreof Member Posts: 133
    The only reason I see for CREATE to give an error is that the automation object is already created. You can call that instruction only one time.
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
    http://www.solvingdynamics.com
  • rehnatrehnat Member Posts: 43
    hello andreof,
    I created CC2 as an an automation variable with events (The subtype of CC2 is Navision MS-Message Queue Bus Adapter.MSMQBusAdapter). but when i run the codeunit it doesn't execute instructions placed on the event section of CC2:
    this is my code:

    Onrun()

    CREATE(MQBUS);
    CREATE (XMLDom);
    CREATE(CC2);
    CC2.AddBusAdapter(MQBUS,1);
    MQBUS.OpenReceiveQueue('.\private$\MQToNavision',0,0);


    //The event of CC2
    CC2::MessageReceived(VAR InMessage : Automation "''.IDISPATCH")
    // load the message into an XML document and find the string node
    InMsg := InMessage;
    InS := InMsg.GetStream();
    XMLDom.load (InS);
    XMLNode := XMLDom.selectSingleNode ('string');

    // parse the request and according to the Request variable, redirect to
    // the appropriate function
    ParseRequest (XMLNode.text);
    CASE Request OF
    'GetCustomer':
    Bizlayer.GetInstance(XMLDom);
    'InsertServOrder':
    InsertServOrder (Parameters[1],Parameters[2],Parameters[3] );

    'InsertLineServOrder':
    InsertLineServOrder (Parameters[1],Parameters[2],Parameters[3] );


    ELSE
    END;
    // open the response queue and create a new message
    MQBUS.OpenWriteQueue('DB-SERVER\private$\MQFromNavision',0,0);
    OutMsg := CC2.CreateoutMessage('Message [url=queue://DB-SERVER]queue://DB-SERVER[/url]\Private$\MQFromNavision');
    XMLDom.save (OutMsg.GetStream());

    // fill the message and send it
    OutMsg.Send(0);

    I don't know why it doesn't execute CC2::MessageReceived(VAR InMessage : Automation "''.IDISPATCH") or when i can see messages inside the MessageQueue(messagequeue which sends message to navision).
  • DenSterDenSter Member Posts: 8,307
    try this instead:
    IF ISCLEAR(MQBUS) THEN
      CREATE(MQBUS);
    
    This applies to all automation type variables.
  • rehnatrehnat Member Posts: 43
    hi, i've another problem with my integration between navision and webservice.
    Now the messages are well written in the destination queues but i can't get them in my webmethod with the method Receive of MessageQueue.
    So when the webservice execute the intruction "fromNavision.receive" (Where fromnavision is my destination Queue), the operations takes times without results and after the system tells me that time is expired.
    Please, someone could help me to find the problem?
  • jorgecphjorgecph Member Posts: 26
    Do you get any messages at all in the queue that you expect the reply? In other words, are the messages store in the "DB-SERVER\Private$\MQFromNavision" queue?

    What about the fromNavision variable. Is it set up correctly to receive in the same queue as Navision is try to write to?
    _________________
    “This posting is provided "AS IS" with no warranties, and confers no rights.”
Sign In or Register to comment.