Error while sending an XML document from Navision to MSMQ
subhaster
Member Posts: 64
Hi Everyone !
I am getting a strange error , when I am trying to send a XML document from Navision to MSMQ. here is my code :-
And the error message that I am getting is :-
Can anyone please suggest me a solution ?
Thanks in advance.
I am getting a strange error , when I am trying to send a XML document from Navision to MSMQ. here is my code :-
CLEAR(CC2);
CLEAR(MqBUS);
CREATE(CC2);
CREATE(MqBUS);
CC2.AddBusAdapter(MqBUS,1);
MqBUS.OpenWriteQueue('.\Private$\fromnavision',0,0);
OutMsg := CC2.CreateoutMessage('Message queue://');
IF ISCLEAR(XmlDom) THEN
CREATE(XmlDom);
XMLDOMManagement.SetNormalCase;
XMLProccesingInst := XmlDom.createProcessingInstruction('xml','version=''1.0'' encoding=''utf-8''');
XMLCurrNode := XmlDom.appendChild(XMLProccesingInst);
CLEAR(XMLCurrNode);
XMLCurrNode := XmlDom.createElement('ResponseXml');
XmlDom.appendChild(XMLCurrNode);
IF vEntity='SellToCustomerNo' THEN
BEGIN
Customer.FIND('-');
REPEAT
XMLCurrNode2 := XMLCurrNode.ownerDocument.createNode('element', 'Entity', '');
XMLCurrNode2.text:='SellToCustomerNo';
XMLCurrNode.appendChild(XMLCurrNode2);
IF XMLDOMManagement.AddElement(XMLCurrNode,'Values','','',XMLCurrNode)>0 THEN EXIT;
ParentNode := XmlDom.createElement('Value');
XMLCurrNode.appendChild(ParentNode);
Node := XmlDom.createElement('Code');
Node.text:=Customer."No.";
ParentNode.appendChild(Node);
Node := XmlDom.createElement('Description');
Node.text:=Customer.Name;
ParentNode.appendChild(Node);
UNTIL Customer.NEXT=0;
END;
OutS := OutMsg.GetStream();
OutS.WRITE(XmlDom.xml);
OutMsg.Send(0);
And the error message that I am getting is :-
Length of the text string exceeds the size of the string buffer
Can anyone please suggest me a solution ?
Thanks in advance.
Subhasish Chakraborty,
Systems Analyst,
MBS Dynamics.
Systems Analyst,
MBS Dynamics.
0
Comments
-
turn on the debugger and see where it stops. My guess you are passing a string that is longer then 250 characters.
I suggest using xmlports0 -
Hi Rashed !
I cannot turn the debugger on as I am using the NAS to detect the output. Also the project where I am using this code , is using only XML Doms , not XML Ports.
What I am tying to is to fill up a combo box in a front end (designed in .net), which on getting loaded is generating an Xml file hthat is detected by the NAS . This XML contains informations regarding a request to Navision to supply all the customers in an XML format . The codeunit which I have designed is doing this.....it is generating an XML file forwarded to MSMQ, which is going to picked up by a web service, which parses the XML to decode the customfer nos and fill up the comobo box. But I am getting the error the moment I am sending the XML Document to MSMQ. The XML document is really a very big one, as it contains a huge list of customers .
Can you suggest me , how can O come around this problem.Subhasish Chakraborty,
Systems Analyst,
MBS Dynamics.0 -
Hi Rashed !
I cannot turn the debugger on as I am using the NAS to detect the output. Also the project where I am using this code , is using only XML Doms , not XML Ports.
What I am tying to is to fill up a combo box in a front end (designed in .net), which on getting loaded is generating an Xml file hthat is detected by the NAS . This XML contains informations regarding a request to Navision to supply all the customers in an XML format . The codeunit which I have designed is doing this.....it is generating an XML file forwarded to MSMQ, which is going to picked up by a web service, which parses the XML to decode the customer nos and fill up the combo box. But I am getting the error the moment I am sending the XML Document to MSMQ. The XML document is really a very big one, as it contains a huge list of customers .
Can you suggest me , how can I come around this problem ?Subhasish Chakraborty,
Systems Analyst,
MBS Dynamics.0 -
OutS := OutMsg.GetStream();
//Your issue is line bellow.
OutS.WRITE(XmlDom.xml);
you need to changeit.
XmlDom.save(OutS);
OutMsg.Send(0);0 -
Hi Rashed ,
thanks a lot........ it worked !!! \:D/Subhasish Chakraborty,
Systems Analyst,
MBS Dynamics.0 -
you are welcome.0
-
Rashed,
it worked , but still it is giving a strange error..... in MSMQ I am getting only a pert of it . Say for example, if there are 90 customers in my customer table, in MSMQ I am getting a XML of only 6 customers out of it ! Can you suugest me , how can I come around this ?Subhasish Chakraborty,
Systems Analyst,
MBS Dynamics.0 -
hmm
I don't know enough about message queue to know the exact cause. This must be a memory setup limit somewhere. try to google it.0 -
Thx to ara3n - you just saved my day (and evening...)Regards,
Henrik Frederiksen, Denmark0 -
You are welcome. As far as partial xml file make sure you add xmldom.async := false0
-
Hmmm..ok?
How about changing the codepage - is that possible (from UTF-8 to UTF-16 for instance)?Regards,
Henrik Frederiksen, Denmark0 -
frede wrote:Hmmm..ok?
How about changing the codepage - is that possible (from UTF-8 to UTF-16 for instance)?
You are referring to Encoding not codepage. Yes it's possible to change the codepage, asumming the xml file is in that encoding.0 -
Pardon my french...
...Yes, I was talking about the encoding (XML is new to me(!))....
How can I easily do this...I am trying to use a "aEncConv"-program from
http://dynamicsuser.net/blogs/nunomaia/ ... ter-2.aspx
Don't know if there is an easier way than to start saving files to disc and then load again...?
Thx in advance for your time...Regards,
Henrik Frederiksen, Denmark0
Categories
- All Categories
- 75 General
- 75 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
