XML error.

RoelofRoelof Member Posts: 377
Hi,

I need help on a weird error.
We are trying to drop a message in the MS-MessageQueue. We are using the automations: Microsoft XML v4.0.DomDocument,Navision MS-Message Queue Bus addapter and Navision Communication Component version 2.CommunicationComponent.
When we write to the MS-MessageQueue, we receive the following error:
'The data at the root level is invalid. Line 1 position 1.

Any help is welcome.

Thanks.
Roelof de Jonghttp://www.wye.com

Comments

  • ara3nara3n Member Posts: 9,257
    edited 2006-06-25
    how does the xml document look like? save it to a file and post it here.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • DenSterDenSter Member Posts: 8,307
    I'd also like to see the code that you use to send the message.
  • pberbpberb Member Posts: 31
    I'm with Roelof on this trying to get this working. Here's the code we've put together:

    CREATE(MQBus);
    CREATE(CC2);
    CC2.AddBusAdapter(MQBus,1);
    MQBus.OpenWriteQueue('kiosk1\comcom2_queue',0,0);
    MQBus.SenderAuthenticationLevel := 2;
    OutMsg := CC2.CreateoutMessage('Message [url=queue://kiosk1]queue://kiosk1[/url]\RMS-requests');
    Outs := OutMsg.GetStream;
    //Outs.WRITE('Hello World!');
    Outs.WRITE('<?xml version="1.0"> <NAME>Hello World!</NAME>');
    OutMsg.Send(0);

    It occured to me that perhaps the reason Roelof was getting his error message is because the text he was trying to send wasn't in XML format, so I commented-out the text and attempted to change it to XML. However, now I'm getting the following error:

    "This is an unexpected token. The expected token is 'NAME'. Line 1, position 20."

    Is there a way to see exactly what format the message queue is expecting its in-stream data?

    Thanks for the help on this guys.
  • ara3nara3n Member Posts: 9,257
    change it to this
    Outs.WRITE('<NAME>Hello World!</NAME>');
    

    This should work.

    To verify that you xml document is correct. save it in a text file with .xml extension and open it in internet explorer. If it doesn't open, then you have a problem. If it does you are good to go.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • pberbpberb Member Posts: 31
    Changing the code to Outs.WRITE('<NAME>Hello World!</NAME>'); gives the error message:

    "Cannot deserialize the message passed as an argument. Cannot recognize the serialization format."

    Saving <NAME>Hello World!</NAME> to a text file called test.xml and opening it with Internet Explorer displays the text:

    <NAME>Hello World!</NAME>
  • DenSterDenSter Member Posts: 8,307
    postion 20 is the space, have you tried it without that?
  • DenSterDenSter Member Posts: 8,307
    Also, make sure that your messge queue is a non transactional one, the BA doesn't know how to deal with a transactional queue. The BA also does not know how to handle double byte character streams (like unicode).
  • pberbpberb Member Posts: 31
    Thanks for the suggestions DenSter, but yes, have tried it without the space -- still get the unexpected token error. Have also tried the message queue as both a transactional and non-transactional one. No difference (same errors). ](*,)
  • DenSterDenSter Member Posts: 8,307
    Then the only suggestion I have is to make sure that both the client and NAS and the database server are installed from the same product cd (uninstall everything and reinstall everything from the same cd). A different buld number can screw things up, even though the BA is not mentioned in the change log.
  • pberbpberb Member Posts: 31
    Yes -- client, NAS, and db server were installed from the same product CD (version 4.0 SP2). I've also tried installing hotfix 272944_intl_i386_zip.exe overtop, without any difference.
  • DenSterDenSter Member Posts: 8,307
    Try it without the xml version declaration. It might be the question mark. I copied the following from the http://www.w3.org website (the keepers of the XML standard):
    <?xml version="1.0"?><greeting>Hello, world!</greeting>
    

    Notice that in your example, you only have a question mark before the xml declaration. You should have one at the end of the declaration as well. It should also work (Like Ara3n suggests) without the declaration, so that would be this:
    <greeting>Hello, world!</greeting>
    
Sign In or Register to comment.