Hi -
I'm hoping someone has seen this incident before. I am adding a new notification to my BN setup but every time I send notification lines to the BN app I get the following error in the event log (which keeps repeating):
============================================
Event Type: Error
Event Source: MessageBusAgent
Event Category: None
Event ID: 0
Date: 5/25/2006
Time: 8:54:09 AM
User: N/A
Computer: CAKNAV01
Description:
Unknown error!
System.Xml.XmlException: There are multiple root elements. Line 11, position 2.
at System.Xml.XmlTextReader.ParseRoot()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlValidatingReader.ReadNoCollectTextToken()
at System.Xml.XmlValidatingReader.Read()
at System.Xml.XmlLoader.LoadCurrentNode()
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
at Microsoft.BusinessSolutions.Integration.MessageBusAgent.Agent.PublishEvents()
=============================================
I have verified that the XML code is well-formed and the new template format follows the same form and layout of the NAV-supplied templates.
Additionally, how can I stop the "MessageBusAgent" from repeatedly generating the same error message over and over in the Event Log?
Any help is greatly appreciated! ](*,)
Mike Opatrny
0
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
My XML code is below. Thanks in advance for the help.
============================================
<?xml version="1.0" encoding="utf-8" ?>
<Templates>
<Template>
<Description>"Looks for checks that have been issued but have not been posted"</Description>
<LicenseKeys>
<NavisionGranuleId>
</NavisionGranuleId>
</LicenseKeys>
<NotificationScheme Name="Unposted Checks in Payment Journal"><Components Id="Signable"><EventComponent Name="EventComponent"><Properties><BusinessEntityName>Checks not Posted</BusinessEntityName><BusinessEntitySchema><xs:schema xmlns:tns="urn:odin-businesssolutions-microsoft-com:navision:io:Checks_x005F_x0020_not_x005F_x0020_Posted" targetNamespace="urn:odin-businesssolutions-microsoft-com:navision:io:Checks_x005F_x0020_not_x005F_x0020_Posted" xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:element name="Gen._Journal_Line"><xs:complexType><xs:sequence><xs:element minOccurs="1" maxOccurs="1" name="Journal_Template_Name" type="xs:string" /><xs:element minOccurs="1" maxOccurs="1" name="Line_No." type="xs:integer" /><xs:element minOccurs="1" maxOccurs="1" name="Account_Type" type="xs:integer" /><xs:element minOccurs="1" maxOccurs="1" name="Document_Type" type="xs:integer" /><xs:element minOccurs="1" maxOccurs="1" name="Amount" type="xs:decimal" /><xs:element minOccurs="1" maxOccurs="1" name="Debit_Amount" type="xs:decimal" /><xs:element minOccurs="1" maxOccurs="1" name="Credit_Amount" type="xs:decimal" /></xs:sequence><xs:attribute name="MBS_Navision_URL" type="xs:string" use="required" /></xs:complexType></xs:element></xs:schema></BusinessEntitySchema><EventName>Checks not Posted</EventName></Properties></EventComponent><MessageComponent Name="MessageComponent"><Properties><Body><xsl:stylesheet xmlns:format="urn:schemas-microsoft-com-businesssolutions-business-notification:formatting" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="text" /><msxsl:script language="C#" implements-prefix="format" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><![CDATA[ public string AsDate(string value, string cultureId){
if(value == null || value == "") return "";
try {
return Format(XmlConvert.ToDateTime(value), "d", cultureId);
} catch(FormatException) {
return value;
}
}
public string AsTime(string value, string cultureId){
if(value == null || value == "") return "";
try {
return Format(XmlConvert.ToDateTime(value), "T", cultureId);
} catch(FormatException) {
return value;
}
}
public string AsDateTime(string value, string cultureId){
if(value == null || value == "") return "";
try {
return Format(XmlConvert.ToDateTime(value), "g", cultureId);
} catch(FormatException) {
return value;
}
}
public string AsDecimal(string value, string cultureId){
if(value == null || value == "") return "";
try {
return Format(XmlConvert.ToDecimal(value), "n", cultureId);
} catch(FormatException) {
return value;
}
}
private string Format(IFormattable value, string format, string cultureId) {
System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo(cultureId);
return value.ToString(format, culture);
}
public string Space() {
return " ";
}
public string NewLine() {
return "\n";
}]]></msxsl:script><xsl:template match="/">Check in the amount of $<xsl:value-of select="format:AsDecimal(/Gen._Journal_Line/Amount, 'en-US')" /> has not posted</xsl:template></xsl:stylesheet></Body><BodyDesignTimeHtml><design>Check in the amount of $<SPAN class="mergeField" onresizestart="return false" contentEditable="false" onbeforeeditfocus="return false" format="Decimal" bindingNamspaces="" binding="/Gen._Journal_Line/Amount" functoid="MergeField">Amount</SPAN> has not posted</design></BodyDesignTimeHtml><Culture>en-US</Culture><From>busnotify@elg.com</From><Subject><xsl:stylesheet xmlns:format="urn:schemas-microsoft-com-businesssolutions-business-notification:formatting" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="text" /><msxsl:script language="C#" implements-prefix="format" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><![CDATA[ public string AsDate(string value, string cultureId){
if(value == null || value == "") return "";
try {
return Format(XmlConvert.ToDateTime(value), "d", cultureId);
} catch(FormatException) {
return value;
}
}
public string AsTime(string value, string cultureId){
if(value == null || value == "") return "";
try {
return Format(XmlConvert.ToDateTime(value), "T", cultureId);
} catch(FormatException) {
return value;
}
}
public string AsDateTime(string value, string cultureId){
if(value == null || value == "") return "";
try {
return Format(XmlConvert.ToDateTime(value), "g", cultureId);
} catch(FormatException) {
return value;
}
}
public string AsDecimal(string value, string cultureId){
if(value == null || value == "") return "";
try {
return Format(XmlConvert.ToDecimal(value), "n", cultureId);
} catch(FormatException) {
return value;
}
}
private string Format(IFormattable value, string format, string cultureId) {
System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo(cultureId);
return value.ToString(format, culture);
}
public string Space() {
return " ";
}
public string NewLine() {
return "\n";
}]]></msxsl:script><xsl:template match="/">Unposted Checks in Payment Journal</xsl:template></xsl:stylesheet></Subject><SubjectDesignTimeHtml><design>Unposted Checks in Payment Journal</design></SubjectDesignTimeHtml></Properties></MessageComponent><FilterComponent Name="FilterComponent"><Properties><Filter><Lines><FilterLine /></Lines><Query><Expression></Expression><Namespaces /></Query></Filter></Properties></FilterComponent><RecipientsComponent Name="RecipientsComponent"><Properties><AllowExternalRecipients>False</AllowExternalRecipients><ExternalRecipients /><SignUpDescription>Check has been printed but has not posted</SignUpDescription><SignUpPermissions /><SignUpTitle>Uposted Checks</SignUpTitle></Properties></RecipientsComponent></Components><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI="#Signable"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue>v7dKKf5tRAqzRVDWFZ843q0NNFE=</DigestValue></Reference></SignedInfo><SignatureValue>CSDA5RtqbnYDdH2YrslbP4v04mIqluBRQ+8zTdnxHy29KHs4PIOAIjXj6+29eVyaT7I2xwdEpp1jg3M+HHl1RvnVmm9xQT8WBfq8/ShaF/F4NI/sONIyegufSzp3GL40zElxBWhOkM+Q0/WNlGG6eIBtK5ZzPTEdUvceW3kH2Ds=</SignatureValue><KeyInfo><KeyValue xmlns="http://www.w3.org/2000/09/xmldsig#"><RSAKeyValue><Modulus>4VQSzmSDJ3zZ/df6ONZu3GsbrwjZvFeVbv7I8CSZATNjausnWeNdsJaI/OzNZR0IxHbRD+pasU04l+R8EOhM7aDV/D3osX3x9befeGgZo9RGLTTX59Khwur037jrXa92MhnonLkIY7wYhFRGGCQ1Y9b1tS9dcPrk6V40K+Qk1Hs=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue></KeyInfo></Signature></NotificationScheme>
</Template>
</Templates>
==============================================
In your xmlport are you filtering correct what record your are sending?
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
The format follows that of the template examples and the BN side is able to see the XMLport object. BN was used to generate the initial xml code to which I added the template header/footer lines.
As far as filtering goes, I am generating a single notification line to send through the XMLport.
- Mike :?
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I'd be happy to e-mail the xml file to you. It's basically the same info that I had included in the earlier thread.
I had to research and found out that Root element can have attributes. So you are ok on that part.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I was able to get my problem resolved. Thanks for your help. Apparently, the MessageBusAgent was continually looping through a series of malformed messages I had generated early last week. The BN app was never able to receive the well-formed messages I submitted a few days later. It just kept repeating the ones it had over and over.
I got help from MS to stop the messages from repeating in the event viewer. Once I cleared the messages, the new notification worked. I cleared the messages by doing the following, per MS:
1. When you send a notification from Navision. The messages are written in a folder on the client machine. The folder is your Isolated Storage, usually “Documents and Settings\bcox\Local Settings\Application Data\IsolatedStorage” + some auto generated rubbish folders.
2. The messages are picked up and sent to the BusinessNotificationsMessageBus web service.
3. The web service places them in the messageStore table on the SQL server.
4. The NS$BusinessNotificationInstance picks up the message from the messageStore table. It then places the message in the SQL server's transmissionLog table and sends out mails. Each mail is placed in the Business Notification Log in the Event Log.
Check the IsolatedStorage folder (you may have to dig through a few layers of directories. Also delete the records in the transmission log table in the Business Notification database.