The notification could not be formatted.
i've developed custom formatter component transform complex xml documents, , following error when trying use it:
<notificationservicesevent>
<description>
the notification not formatted.
</description>
<context>
<eventparameters>
<instancename>nhsdinstance</instancename>
<applicationname>nhsd</applicationname>
<distributor id>1</distributor id>
<distributor name>nhsddist1</distributor name>
<distributor work item id>4</distributor work item id>
<notificationclassname>nhsdvalidationnotifications</notificationclassname>
<notification id>7</notification id>
</eventparameters>
</context>
<description>
request permission of type system.security.permissions.strongnameidentitypermission, mscorlib, version=1.0.3300.0, culture=neutral, publickeytoken=b77a5c561934e089 failed.
</description>
<instance>nhsdinstance</instance>
<applicationname>nhsd</applicationname>
<component>distributor</component>
<componentdetails>
distributorname: nhsddist1
</componentdetails>
<thread>284</thread>
</notificationservicesevent>
after extensive googling, i'm still pretty none wiser.
the dll created using v1.0.3705, which, i'm guessing @ root of problem.
i've included dll code, think possibly has bearing too.
using system;
using system.collections;
using system.collections.specialized;
using system.globalization;
using system.io;
using system.net;
using system.text;
using system.xml;
using system.xml.xsl;
using system.xml.xpath;
using microsoft.sqlserver.notificationservices;
using microsoft.sqlserver.notificationservices.common;
namespace contentformatter
{
public class complextransformation : icontentformatter
{
private bool initialised;
private string xsltbasedirectorypath;
private string xsltfilename;
private string xmlbasedirectorypath;
private string xmlfilename;
private bool digest;
private bool disableescaping;
private nsotherlogger logger;
public complextransformation()
{}
public complextransformation(string instancename)
{
this.xsltbasedirectorypath = null;
this.xsltfilename = null;
this.xmlbasedirectorypath = null;
this.xmlfilename = null;
this.initialised = false;
this.disableescaping = false;
string logtext = nsstringresource.getlocalestring(nslocalestringenum.xsltformattercomponentname);
this.logger = new nsotherlogger(instancename, logtext);
}
public void initialize(stringdictionary arguments, bool digest)
{
if (!this.initialised)
{
if (!arguments.containskey("xsltfilename"))
{
throw new nsexception(nseventenum.xsltfilenametagmissing);
}
if (!arguments.containskey("xsltbasedirectorypath"))
{
throw new nsexception(nseventenum.xsltbasedirectorypathtagmissing);
}
if (!arguments.containskey("xmlfilename"))
{
throw new nsexception("input xml path tag missing");
}
if (!arguments.containskey("xmlbasedirectorypath"))
{
throw new nsexception("input xml base directory path tag missing");
}
this.xsltbasedirectorypath = arguments["xsltbasedirectorypath"];
this.xsltfilename = arguments["xsltfilename"];
this.xmlbasedirectorypath = arguments["xmlbasedirectorypath"];
this.xmlfilename = arguments["xmlfilename"];
if (arguments.containskey("disableescaping"))
{
try
{
this.disableescaping = bool.parse(arguments["disableescaping"]);
}
catch (exception exception1)
{
nseventparameters parameters1 = new nseventparameters();
parameters1.addparameter(nseventparamenum.xsltdisableescapingvalue, arguments["disableescaping"]);
throw new nsexception(nseventenum.xsltdisableescapingvalueinvalid, parameters1, exception1);
}
}
this.digest = digest;
this.initialised = true;
}
}
public string formatcontent(string subscriberlocale, string devicetypename, recipientinfo recipientinfo, hashtable[] rawcontent)
{
string xmllocation = this.xmlbasedirectorypath + this.xmlfilename;
string xsltlocation = this.xsltbasedirectorypath + this.xsltfilename;
rendervariables(xmllocation);
string outputxhtml = null;
try
{
outputxhtml = this.transform(xmllocation,xsltlocation);
}
catch (exception formatexception)
{
nsexception thrownexception = formatexception nsexception;
if (thrownexception == null)
{
thrownexception = new nsexception(nseventenum.xsltformatterunknownerror, formatexception);
}
this.logger.logerror(thrownexception);
throw thrownexception;
}
return outputxhtml;
}
private void rendervariables(string variable)
{
// create writer , open file
textwriter tw = new streamwriter(@"c:\dump.txt");
// write line of text file
tw.writeline(variable);
// close stream
tw.close();
}
public void close()
{
}
public string transform(string xmlpath, string xslpath)
{
string nullstring = null;
xpathdocument xpathdocument;
xsltransform xsltrans;
// create output stream
stringbuilder docstringbuilder;
textwriter doctextwriter = null;
try
{
// read xml
xpathdocument = new xpathdocument(xmlpath);
// create new xsltransform object.
xsltrans = new xsltransform();
// load stylesheet.
xsltrans.load(xslpath);
// create output stream
docstringbuilder = new stringbuilder();
doctextwriter = new stringwriter(docstringbuilder);
xsltrans.transform(xpathdocument,null,doctextwriter);
}
catch (xsltexception transformexception)
{
nseventparameters eventparameters = new nseventparameters();
eventparameters.addparameter(nseventparamenum.xslttransformfile, nullstring);
throw new nsexception(nseventenum.xsltinvalidtransform, eventparameters, transformexception);
}
finally
{
doctextwriter.close();
}
// push result
return docstringbuilder.tostring();
}
}
}
any idea on resolution?
joe
http://www.microsoft.com/technet/community/newsgroups/dgbrowser/en-us/default.mspx?dg=microsoft.public.sqlserver.notificationsvcs&lang=en&cr=us&mid=d77ead49-868b-4f0f-987f-a69f56d5f0e2
SQL Server > SQL Server Notification Services
Comments
Post a Comment