Error writing a xml content with MSMQ

jcruz
Member Posts: 3
Hi everyone,
I'm trying to send a xml file content to a MSMQ that will be read by a C# application. The NAV code set a Item record filter by "Service Item Group" and than use u XMLPort to get the data generated. For now, i've simplified the code just to print the xml content, and i'm getting this error: The length of the text string exceeds the size of the string buffer when i try to print it (MESSAGE), and the same ocurrs when i try to send the content to a MSMQ
Here's the code:
CREATE(XMLDom);
Item.SETFILTER ("Service Item Group",'ACESSDIV');
TestFile.CREATE('C:\XML_Item.xml');
TestFile.CREATEOUTSTREAM(TestStream);
XMLPORT.EXPORT(123456701,TestStream,Item); //Use any codeunit for test porpose folks...
TestFile.CLOSE;
XMLDom.load('C:\XML_Item.xml');
MESSAGE(XMLDom.xml); // *** HERE'S OCCUR THE ERROR ***
CLEAR(XMLDom);CLEAR(Item);
Automation Variables:
XMLDom Automation 'Microsoft XML, v6.0'.DOMDocument
Item Record Item
TestFile File
TestStream OutStream
Can anyone solve this error?
I'm trying to send a xml file content to a MSMQ that will be read by a C# application. The NAV code set a Item record filter by "Service Item Group" and than use u XMLPort to get the data generated. For now, i've simplified the code just to print the xml content, and i'm getting this error: The length of the text string exceeds the size of the string buffer when i try to print it (MESSAGE), and the same ocurrs when i try to send the content to a MSMQ

Here's the code:
CREATE(XMLDom);
Item.SETFILTER ("Service Item Group",'ACESSDIV');
TestFile.CREATE('C:\XML_Item.xml');
TestFile.CREATEOUTSTREAM(TestStream);
XMLPORT.EXPORT(123456701,TestStream,Item); //Use any codeunit for test porpose folks...
TestFile.CLOSE;
XMLDom.load('C:\XML_Item.xml');
MESSAGE(XMLDom.xml); // *** HERE'S OCCUR THE ERROR ***
CLEAR(XMLDom);CLEAR(Item);
Automation Variables:
XMLDom Automation 'Microsoft XML, v6.0'.DOMDocument
Item Record Item
TestFile File
TestStream OutStream
Can anyone solve this error?

Nunca discutas com um idiota em público...podem não distinguir quem é quem...
0
Comments
-
IF the XMLDom.xml is larger than 1024 you will have problems.0
-
What about importing XML files bigger then 1024 characters? Does that give a problem too?Roelof de Jonghttp://www.wye.com0
-
Navision imports without any problems large XML files.
The problem happens if you try to store a string value lager than the specific string value.
For example if you try to save a customer name larger than 30 chars and Navision by default only stores 30 chars0 -
Then I have another question. I try to import an XML SalesOrder with multiple SalesLines in a DOM. I can read the SalesHeader and the first SalesLine. But how can I read the next SalesLine in a DOM.Roelof de Jonghttp://www.wye.com0
-
Are you reading using a dataport or using Automation?
If you are using automation can you show me a sample of you code?0 -
I am using an automation.
Here is a piece of my code. The loop basically starts at the 'WHILE DO' line. I copied this more or less from a standard Navision function in CodeUnit 6226, function 'Sales'.
WITH XMLDOMManagement DO BEGIN
XMLNode := XMLDocIn.documentElement;
DataLineArea := '/po:ProcessPurchaseOrder/po:DataArea/po:PurchaseOrder/po:Line/po:';
IF FindNodes(XMLNode,DataLineArea+'Line',XMLNodeList) THEN BEGIN //to find PO-Line node
//XMLNodeList.reset();
//XMLNode:= XMLNodeList.nextNode();
WHILE NOT ISCLEAR(XMLNode) DO BEGIN //not looping. Need to fix that.
IF FindNode(XMLNode,DataLineArea+'OrderItem/po:Description',XMLNodeFound) THEN
IF STRLEN(XMLNodeFound.text) > 0 THEN
EVALUATE(SheetLine.Description,XMLNodeFound.text);
.
.
.
XMLNode:= XMLNodeList.nextNode();
END;
END;
END;
The code is working but only for the first SalesLine Node. The next SalesLineNode is not being read.Roelof de Jonghttp://www.wye.com0 -
In that codeunit you have code to iterate nodes
... IF FindNode(XMLRootNode,'ROLES',XMLNodeFound) THEN BEGIN IF NOT FindNodes(XMLNodeFound,'ROLENO',XMLNodeList) THEN EXIT ELSE FOR I := 0 TO XMLNodeList.length - 1 DO BEGIN TempWebPortalUserRoles."Web Portal Role Code" := XMLNodeList.item(I).text; IF NOT TempWebPortalUserRoles.INSERT THEN; END END ELSE ...
0 -
It's the MESSAGE that kills it. The XMLDOM is perfectly capable of holding more than 1024 characters, because that's not a string but an object in memory. It's when you try to access the entire string of the variable when NAV chokes.0
-
Nunomaia,
Is this the solution for my salesline next read problem in a DOM? I'm confused.
If so, can you explain how it works?Roelof de Jonghttp://www.wye.com0 -
FindNode returns a simles Node (First Line)
FindNodes return all the lines.0 -
I tried this option but it failed.
It looks like I have a problem with the XMLNodeList. For some reason it doesn't return an node list although it finds the first salesLine node in the XML file.Roelof de Jonghttp://www.wye.com0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 320 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