MSMQ / Communication Component Stream Error
timgrant
Member Posts: 15
Hi,
Can someone help me if possible? We have a system were the existing code for v4.0.3.23305 build works except for a bug where data with an & (ampersand) value in a field removes the remainder of the data after the & in the field. We know that nassql build 4.0.3.26565 fixes this exe bug, but when sending messages back out of Navision using this new build again we get the errors:
"The Stream has returned a write error." and then
The call to member Send Failed. MSMQBusAdapter.MSMQBusAdapter.1 returned the following message: There is insufficient memory to perform the operation on the stream.
A sample of the code is here:
B2BSetup.GET;
IF ISCLEAR(MQBus) THEN
CREATE(MQBus);
IF ISCLEAR(Cc2) THEN
CREATE(Cc2);
IF ISCLEAR(OutMsg) THEN
CREATE(OutMsg);
IF ISCLEAR(XMLDoc) THEN
CREATE(XMLDoc);
Cc2.AddBusAdapter(MQBus,1);
MQBus.OpenWriteQueue(B2BSetup."MSMQ Acknowledgement",0,0);
OutMsg := Cc2.CreateoutMessage('Message [url=Queue://']Queue://'[/url] + B2BSetup."MSMQ Acknowledgement");
OutS := OutMsg.GetStream;
B2BMessageHeader2.RESET;
B2BMessageHeader2.SETRANGE(Type,B2BMessageHeader.Type);
B2BMessageHeader2.SETRANGE(MessageID,B2BMessageHeader.MessageID);
B2BMessageHeader2.SETRANGE(MessageGUID,B2BMessageHeader.MessageGUID);
B2BMessageHeader2.SETRANGE(TrackingGUID,B2BMessageHeader.TrackingGUID);
CASE B2BMessageHeader.MessageID OF
B2BSetup."New Order Ack.",
B2BSetup."New Customer Ack":
BEGIN
TempB2BSetup.INIT;
TempB2BSetup."Temp BLOB".CREATEOUTSTREAM(OutS2);
CLEAR(XMLSendAck);
XMLSendAck.SETTABLEVIEW(B2BMessageHeader2);
XMLSendAck.SetMessageID(B2BMessageHeader.MessageID);
XMLSendAck.SETDESTINATION(OutS2);
XMLSendAck.EXPORT;
TempB2BSetup.CALCFIELDS("Temp BLOB");
IF TempB2BSetup."Temp BLOB".HASVALUE THEN BEGIN
TempB2BSetup."Temp BLOB".CREATEINSTREAM(InS2);
XMLDoc.load(InS2);
// Write Log
B2BLog.INIT;
B2BLog.MessageGUID := B2BMessageHeader.MessageGUID;
B2BLog.TrackingGUID := B2BMessageHeader.TrackingGUID;
B2BLog.Type := B2BLog.Type::Ack;
B2BLog."Created by" := USERID;
B2BLog."Created at" := CURRENTDATETIME;
B2BLog.MessageID := B2BMessageHeader.MessageID;
B2BLog."File Content".CREATEINSTREAM(InS2);
XMLDoc.save(InS2);
XMLDoc.save(OutS);
OutMsg.Send(0);
B2BLog.INSERT;
END;
END;
END;
Many Thanks in advance to anyone who can come up with a solution.
...
The answer was to clear the automation variables first.
Can someone help me if possible? We have a system were the existing code for v4.0.3.23305 build works except for a bug where data with an & (ampersand) value in a field removes the remainder of the data after the & in the field. We know that nassql build 4.0.3.26565 fixes this exe bug, but when sending messages back out of Navision using this new build again we get the errors:
"The Stream has returned a write error." and then
The call to member Send Failed. MSMQBusAdapter.MSMQBusAdapter.1 returned the following message: There is insufficient memory to perform the operation on the stream.
A sample of the code is here:
B2BSetup.GET;
IF ISCLEAR(MQBus) THEN
CREATE(MQBus);
IF ISCLEAR(Cc2) THEN
CREATE(Cc2);
IF ISCLEAR(OutMsg) THEN
CREATE(OutMsg);
IF ISCLEAR(XMLDoc) THEN
CREATE(XMLDoc);
Cc2.AddBusAdapter(MQBus,1);
MQBus.OpenWriteQueue(B2BSetup."MSMQ Acknowledgement",0,0);
OutMsg := Cc2.CreateoutMessage('Message [url=Queue://']Queue://'[/url] + B2BSetup."MSMQ Acknowledgement");
OutS := OutMsg.GetStream;
B2BMessageHeader2.RESET;
B2BMessageHeader2.SETRANGE(Type,B2BMessageHeader.Type);
B2BMessageHeader2.SETRANGE(MessageID,B2BMessageHeader.MessageID);
B2BMessageHeader2.SETRANGE(MessageGUID,B2BMessageHeader.MessageGUID);
B2BMessageHeader2.SETRANGE(TrackingGUID,B2BMessageHeader.TrackingGUID);
CASE B2BMessageHeader.MessageID OF
B2BSetup."New Order Ack.",
B2BSetup."New Customer Ack":
BEGIN
TempB2BSetup.INIT;
TempB2BSetup."Temp BLOB".CREATEOUTSTREAM(OutS2);
CLEAR(XMLSendAck);
XMLSendAck.SETTABLEVIEW(B2BMessageHeader2);
XMLSendAck.SetMessageID(B2BMessageHeader.MessageID);
XMLSendAck.SETDESTINATION(OutS2);
XMLSendAck.EXPORT;
TempB2BSetup.CALCFIELDS("Temp BLOB");
IF TempB2BSetup."Temp BLOB".HASVALUE THEN BEGIN
TempB2BSetup."Temp BLOB".CREATEINSTREAM(InS2);
XMLDoc.load(InS2);
// Write Log
B2BLog.INIT;
B2BLog.MessageGUID := B2BMessageHeader.MessageGUID;
B2BLog.TrackingGUID := B2BMessageHeader.TrackingGUID;
B2BLog.Type := B2BLog.Type::Ack;
B2BLog."Created by" := USERID;
B2BLog."Created at" := CURRENTDATETIME;
B2BLog.MessageID := B2BMessageHeader.MessageID;
B2BLog."File Content".CREATEINSTREAM(InS2);
XMLDoc.save(InS2);
XMLDoc.save(OutS);
OutMsg.Send(0);
B2BLog.INSERT;
END;
END;
END;
Many Thanks in advance to anyone who can come up with a solution.
...
The answer was to clear the automation variables first.
0
Answers
-
In XML you cannot add & because it is reserved, and you can read more about it here
http://xml.silmaril.ie/authors/specials/
So in your xmlport you need to check if there is an & and if yes you need to add
amp;
For example
<CustName>Barnes & Noble</CustName>
shoudl change
<CustName>Barnes & Noble</CustName>0
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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 250 Dynamics CRM
- 102 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
