Strange leading characters in XML created with XMLDOM

ehsehs Member Posts: 34
I am setting up an integration between Navision and MSMQ.
Receiving XML documents from MSMQ with XMLDOM is no problem, but when I create an xml document and send it to MSMQ it can not be opened as an XML because Navision/XMLDOM has inserted some strange charaters in the beginning of the file:

ÙösœÓ³.
´<Nodename>String</Nodename>

How can I avoid this so the xml document is delivered in a valid format ?

My test codeunit is very simple and looks like this:

OBJECT Codeunit 58005 XML Integration Test
{
OBJECT-PROPERTIES
{
Dato=03-05-07;
Tidspunkt=21:35:43;
Endret=Ja;
Versjonsoversikt=NAVW13.70,DPO2NAV1.01;
}
PROPERTIES
{
SingleInstance=Nei;
OnRun=BEGIN
CREATE(XMLDoc);

DOMNode := XMLDoc.createNode(1,'Nodename','');
XMLDoc.appendChild(DOMNode);

DOMTekstNode := XMLDoc.createTextNode('String');
DOMNode.appendChild(DOMTekstNode);

CREATE(QueueInfo);
CREATE(Queue);
CREATE(Mes);
QueueInfo.FormatName := 'DIRECT=OS:localhost\private$\test_outbox';
Queue := QueueInfo.Open(2,0);
Mes.Label := '';
Mes.Body := XMLDoc;
Mes.Send(Queue);
Queue.Close();
END;

}
CODE
{
VAR
O2Setup@1000000008 : Record 50004;
Text001@1000 : TextConst 'ENU=The O2 integration has started.;NOR=O2 integrasjonen har startet.';
MQBus@1000000000 : Automation "{B8BD635A-E191-47EF-84A0-02921E2A44A6} 1.0:{CD49794B-0E84-4A2E-9522-C518C825D390}:'Navision MS-Message Queue Bus Adapter'.MSMQBusAdapter";
InMsg@1000000002 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{D184D0AC-61C9-4AC1-B537-0D28C277FEDE}:'Navision Communication Component version 2'.InMessage";
InS@1000000003 : InStream;
XMLDoc@1000000004 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 3.0:{F5078F32-C551-11D3-89B9-0000F81FE221}:'Microsoft XML, v3.0'.DOMDocument30";
DOMNode@1000000005 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 3.0:{2933BF80-7B36-11D2-B20E-00C04F983E60}:'Microsoft XML, v3.0'.IXMLDOMNode";
DOMTekstNode@1000000001 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 3.0:{2933BF87-7B36-11D2-B20E-00C04F983E60}:'Microsoft XML, v3.0'.IXMLDOMText";
OutMsg@1000000006 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{6CB9762C-E61C-4F96-BA34-8B20D3A5B46E}:'Navision Communication Component version 2'.OutMessage";
OutS@1000000007 : OutStream;
TempDoc@1000000009 : Record 50005;
MessageQueueNameIn@1000000010 : Text[250];
MessageQueueNameOut@1000000011 : Text[250];
MessageLabel@1000000012 : Text[80];
ErrorText@1000000013 : Text[250];
O2ReqMan@1000000018 : Codeunit 58002;
QueueInfo@1000000017 : Automation "{D7D6E071-DCCD-11D0-AA4B-0060970DEBAE} 3.0:{D7D6E07C-DCCD-11D0-AA4B-0060970DEBAE}:'Microsoft Message Queue 3.0 Object Library'.MSMQQueueInfo";
Mes@1000000016 : Automation "{D7D6E071-DCCD-11D0-AA4B-0060970DEBAE} 3.0:{D7D6E075-DCCD-11D0-AA4B-0060970DEBAE}:'Microsoft Message Queue 3.0 Object Library'.MSMQMessage";
Queue@1000000015 : Automation "{D7D6E071-DCCD-11D0-AA4B-0060970DEBAE} 3.0:{D7D6E079-DCCD-11D0-AA4B-0060970DEBAE}:'Microsoft Message Queue 3.0 Object Library'.MSMQQueue";

EVENT XMLDoc@1000000004::ondataavailable@198();
BEGIN
END;

EVENT XMLDoc@1000000004::onreadystatechange@-609();
BEGIN
END;

BEGIN
END.
}
}


I have tried with many different versions of the XMLDOM and Message Queue Automation but the result is the same :-(

Please help !

Comments

  • mathiaslindahlmathiaslindahl Member Posts: 4
    When you do like this:
    Mes.Body := XMLDoc;
    XMLDoc is Automation
    Body is expected to be text
    You should probably write like this:
    Mes.Body := XMLDoc.text;

    /m
    It'd be very quiete in the forest if only the best birds were singing.
  • doodoo Member Posts: 12
    Hi !

    Did you find any solution to your problem ? I've exactly the same problem with strange characters in XML created with XMLDom in Navision.

    I find a solution by using XMLDom.xml to implement MSMQMessage.body ! But there is a problem, I've this message when xml is bigger than 250 characters --> "The length of the text string exceeds the size of the string buffer"

    XMLDom.Text returns empty !

    If you find any solution to your problem, it will be very great to have a feedback ! I'm trying to solve this point since 3 days and impossible to find any solution !

    Thanks for your answer.

    Ludovic
  • ara3nara3n Member Posts: 9,256
    Hello

    I was wondering if somebody resolved this.

    Thanks.

    This also happens with 'Microsoft Message Queue 3.0 Object Library'.MSMQMessage
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ara3nara3n Member Posts: 9,256
    A half solution is to use NAV BA connector instead to send msmq messages .
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.