|
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Caching;
using System.Web.Services;
using System.Xml;
namespace PersistStoreMessage
{
/// <summary>
/// Summary description for Service1.
/// </summary>
public class Persist : System.Web.Services.WebService
{
public Persist()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}
#region Component Designer generated code
//Required by the Web Services Designer
private IContainer components = null;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
#endregion
[WebMethod]
public bool PersistMessage(string messageId, XmlDocument xDoc)
{
try
{
this.Context.Cache.Add(messageId, xDoc, null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.High, null);
EventLog.WriteEntry("Web Service - PersistStoreMessage", "Data written to cache.\nMessage ID: " + messageId + "\n xDoc: " + xDoc.InnerXml);
return true;
}
catch
{
return false;
}
}
[WebMethod]
public XmlDocument RetrieveMessage(string messageId)
{
try
{
XmlDocument xDoc = (XmlDocument) this.Context.Cache[messageId.ToString()];
this.Context.Cache.Remove(messageId);
return xDoc;
}
catch
{
return new XmlDocument();
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Naveen has done his Masters (M.S.) in Computer science, has started his career programming the mainframes and now has more than a decade of programming, development and design experience. Naveen has a sharp eye and keen observation skills. Naveen has worked for several companies and strived hard to build large scale business applications and bringing better solutions to the table.
Quite recently Naveen has built a fairly complex integration platform for a large bank. His hobbies include training, mentoring and research. Naveen spends his free time visiting National Parks nationwide.
Naveen has developed the BizTalk Control Center (BCC)
http://biztalkcontrolcenter.codeplex.com