Error when trying to save XML to BLOB
ehs
Member Posts: 34
I have created a single instance codeunit based on the "Say Hello to the World" article but when I try to add functionality that should save imported xmls to a BLOB field I get an error message which says: "You could not stream to BLOB" and then "This message is for C/AL programmers: The call to member save failed. msxml3.dll returned the following message: The xml-document must have an element on top level.
I am using the freeware application QReader MSMQ Viewer v2.0.0 to send a very simple xml message to the message queue:
<?xml version="1.0">
<string>Hello, world!</string>
I have also tried just with this as the text sent:
<string>Hello, world!</string>
The codeunit in Navision looks like this:
OnRun()
MessageQueueNameIn := 'localhost\private$\test_in';
MessageQueueNameOut := 'localhost\private$\test_out;
CREATE(XMLDom);
CREATE(MQBus);
CREATE(CC2);
CC2.AddBusAdapter(MQBus,1);
MQBus.OpenReceiveQueue(MessageQueueNameIn,0,0);
CC2::MessageReceived(VAR InMessage : Automation "''.IDISPATCH")
InMsg := InMessage;
InS := InMsg.GetStream();
XMLDom.load(InS);
IF TempDoc.FIND('+') THEN
TempDoc."No." := TempDoc."No." + 1
ELSE
TempDoc."No." := 1;
TempDoc.INIT;
TempDoc.INSERT;
TempDoc."XML Document".CREATEINSTREAM(InS);
XMLDom.save(InS);
TempDoc.MODIFY;
And the variables are created like this (I have also tried with different versions of the XMLDOM automations):
Name DataType 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
XMLDom Automation 'Microsoft XML, v3.0'.DOMDocument
XMLNode Automation 'Microsoft XML, v3.0'.IXMLDOMNode
OutMsg Automation 'Navision Communication Component version 2'.OutMessage
OutS OutStream
TempDoc Record O2 XML Document Queue
Is the error related to the C/AL code or should I use another xml example og another application to send the xml to the MSMQ to make sure it is received in the Queue as an XML and not a text ?
I am using the freeware application QReader MSMQ Viewer v2.0.0 to send a very simple xml message to the message queue:
<?xml version="1.0">
<string>Hello, world!</string>
I have also tried just with this as the text sent:
<string>Hello, world!</string>
The codeunit in Navision looks like this:
OnRun()
MessageQueueNameIn := 'localhost\private$\test_in';
MessageQueueNameOut := 'localhost\private$\test_out;
CREATE(XMLDom);
CREATE(MQBus);
CREATE(CC2);
CC2.AddBusAdapter(MQBus,1);
MQBus.OpenReceiveQueue(MessageQueueNameIn,0,0);
CC2::MessageReceived(VAR InMessage : Automation "''.IDISPATCH")
InMsg := InMessage;
InS := InMsg.GetStream();
XMLDom.load(InS);
IF TempDoc.FIND('+') THEN
TempDoc."No." := TempDoc."No." + 1
ELSE
TempDoc."No." := 1;
TempDoc.INIT;
TempDoc.INSERT;
TempDoc."XML Document".CREATEINSTREAM(InS);
XMLDom.save(InS);
TempDoc.MODIFY;
And the variables are created like this (I have also tried with different versions of the XMLDOM automations):
Name DataType 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
XMLDom Automation 'Microsoft XML, v3.0'.DOMDocument
XMLNode Automation 'Microsoft XML, v3.0'.IXMLDOMNode
OutMsg Automation 'Navision Communication Component version 2'.OutMessage
OutS OutStream
TempDoc Record O2 XML Document Queue
Is the error related to the C/AL code or should I use another xml example og another application to send the xml to the MSMQ to make sure it is received in the Queue as an XML and not a text ?
0
Answers
-
It seems that the QueueReader does not send the message as XML to the message queue.
I tried to use a different application which is sending the xml to the MSMQ and with the same C/AL code it works just fine :-)0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 329 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions