Biz(Talk)2

Talk, talk and more talk about BizTalk

Mocking an Http Request-Respose port

I occasionally want to be able to mock a Request-Response port, inthe event the target database is down, or I’m working locally.

The following ASP.NET snippet will allow me to point a two-way Send port at a local ASP.NET page, and gives me complete control over the mocked data I send back:

 
protected void Page_Load(object sender, EventArgs e)
 
{
 

String req = new System.IO.StreamReader(Request.InputStream).ReadToEnd();

Debug.WriteLine(req);

FileStream outputFile = File.OpenRead(@”c:\temp\HttpListener\COPA_extract.xml”);

string extract = new StreamReader(outputFile).ReadToEnd();

//Write out the string to Response

Response.Write(extract);

// Need to call Response.End() or we get the standard Http DOCTYPE tags, etc
Response.End();
 

 

}

 

July 29, 2009 Posted by Brett | BizTalk | , | No Comments Yet

Debugging BizTalk instances – which one to attach to?

A good hint from Michael.

Determine the Process Id of a specific BTNTSVC.exe instance using the following command line:

tasklist /svc /fi "imagename eq btsntsvc.exe"

July 28, 2009 Posted by Brett | Uncategorized | | No Comments Yet