NAS not answering the handler function “MessageReceived”

2»

Comments

  • jlgjlg Member Posts: 4
    Does somebody help me ?
    Problem is that MessageReceived fonction is never activated.
    I'de checked parameters (UTF-8, authorizations, queues).
    This is my code :
    OBJECT Codeunit 50017 WebServices
    {
    OBJECT-PROPERTIES
    {
    Date=23.10.08;
    Time=17:01:11;
    Modified=Yes;
    Version List=WEBSERVICES;
    }
    PROPERTIES
    {
    SingleInstance=Yes;
    OnRun=
    BEGIN
    BEGIN

    MESSAGE('BEGIN OK');

    IF ISCLEAR(CC2) THEN
    IF NOT CREATE(CC2) THEN
    ERROR('Erreur lors de la cr‚ation NavisionComponent CC2');
    IF ISCLEAR(MQBus) THEN
    IF NOT CREATE(MQBus) THEN
    ERROR('Erreur lors de la cr‚ation QueueBus MQBus');
    CC2.AddBusAdapter(MQBus,1);
    MQBus.OpenReceiveQueue('.\private$\toNavision',0,0);
    MQBus.OpenReplyQueue('.\private$\fromNavision',0,0);

    MESSAGE('Queues OPEN OK');
    END;
    END;

    }
    CODE
    {
    VAR
    MQBus@1150000 : Automation "{B8BD635A-E191-47EF-84A0-02921E2A44A6} 1.0:{CD49794B-0E84-4A2E-9522-C518C825D390}:'Navision MS-Message Queue Bus Adapter'.MSMQBusAdapter";
    CC2@1150001 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{01018FA5-E4B4-413C-A47C-AD34B0CC2647}:'Navision Communication Component version 2'.CommunicationComponent" WITHEVENTS;
    InMsg@1150002 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{D184D0AC-61C9-4AC1-B537-0D28C277FEDE}:'Navision Communication Component version 2'.InMessage";
    InS@1150003 : InStream;
    XMLDom@1150004 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 3.0:{F6D90F11-9C73-11D3-B32E-00C04F990BB4}:'Microsoft XML, v3.0'.DOMDocument";
    XMLNode@1150005 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 3.0:{2933BF80-7B36-11D2-B20E-00C04F983E60}:'Microsoft XML, v3.0'.IXMLDOMNode";
    OutMsg@1150006 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{6CB9762C-E61C-4F96-BA34-8B20D3A5B46E}:'Navision Communication Component version 2'.OutMessage";
    OutS@1150007 : OutStream;
    Request@1150008 : Text[250];
    Parameters@1150010 : ARRAY [200] OF Text[50];
    WebServicesFunction@1150009 : Codeunit 50018;
    ReceiveQueue@1150011 : Automation "{B8BD635A-E191-47EF-84A0-02921E2A44A6} 1.0:{CD49794B-0E84-4A2E-9522-C518C825D390}:'Navision MS-Message Queue Bus Adapter'.MSMQBusAdapter";
    ReceiveQueueInfo@1150012 : Automation "{B8BD635A-E191-47EF-84A0-02921E2A44A6} 1.0:{CD49794B-0E84-4A2E-9522-C518C825D390}:'Navision MS-Message Queue Bus Adapter'.MSMQBusAdapter";

    PROCEDURE ParseRequest@1150000(string@1150000 : Text[250]);
    VAR
    auxstring@1150002 : Text[250];
    argpos@1150003 : Integer;
    commapos@1150004 : Integer;
    ParCount@1150005 : Integer;
    BEGIN
    Request := COPYSTR (string, 1, STRPOS (string, '(') - 1);
    auxstring := COPYSTR (string, STRPOS (string, '(') + 1, STRLEN (string) - STRPOS (string, '(') - 1);
    argpos := 1;
    commapos := STRPOS (auxstring, ',');
    WHILE (commapos <> 0) DO
    BEGIN
    Parameters[argpos] := COPYSTR (auxstring, 1, commapos - 1);
    auxstring := COPYSTR (auxstring, STRPOS (auxstring, ',') + 1);
    argpos := argpos + 1;
    commapos := STRPOS (auxstring, ',');
    END;
    Parameters[argpos] := auxstring;
    ParCount := argpos;
    END;


    EVENT CC2@1150001::MessageReceived@1(VAR InMessage@1150000 : Automation ":{00020400-0000-0000-C000-000000000046}:''.IDISPATCH");
    BEGIN

    MESSAGE('NEVER PASS HERE !');
    // 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
    'GetItem':
    WebServicesFunction.GetItem (Parameters[1], XMLDom);
    'InsertItem':
    WebServicesFunction.InsertItem
    (Parameters[1], Parameters[2], Parameters[3], XMLDom);
    ELSE
    END;
    // open the response queue and create a new message
    MQBus.OpenWriteQueue('.\fromNavision',0,0);
    OutMsg := CC2.CreateoutMessage('Message [url=queue://]queue://[/url].\fromNavision');
    XMLDom.save (OutMsg.GetStream());
    // fill the message and send it
    OutMsg.Send(0);
    END;
    BEGIN
    {
    JLG 23/10/2008
    }
    END.
    }
    }
Sign In or Register to comment.