by community-syndication | Aug 15, 2006 | BizTalk Community Blogs via Syndication
Tired of havng incredibly long xpath statements when using the “xpath” keyword in
your orchestration expression shapes? (They are generally long because of the
xml namespace issues, unless your documents do not use namespaces. When namespaces
are in play, “local-name()” tends to overwhelm your actual path content.)
For BizTalk 2006, we can take advantage of the fact that System.Xml 2.0 added the
ability for documents to supply namespace mappings themselves when doing xpath work
– without the need for manually populating and using a XmlNamespaceManager instance,
as was the case for .Net 1.x. Note that XPathNavigator now (as of .net 2.0)
has a SelectSingleNode method which can accept an implementation of the new IXmlNamespaceManager
interface (which XPathNavigator itself implements.) This means that the ‘xmlns:someprefix=someuri’
declarations in your instance document can actually be used automatically, such that
your xpaths can use the same prefixes when issuing a select. .Net 1.x had no such
mechanism.
So, in whatever “utility” class you have sitting around to help you out when doing
orchestration work, add the following static method. (I generally put such things
outside of a namespace – that way they are a bit more concise inside the orchestration
expression editor.) In high-performance scenarios, may want to measure the performance
of this approach vs. the built-in xpath keyword. Recall that messages can be
passed as XmlDocument instances, so your expression window might have: myString =
XmlUtility.GetXPathStringResult(myMessage,”/spf:someparent/spf:somechild”);
public static string GetXPathStringResult(
XmlDocument document,
string xpath)
{
XPathNavigator nav = document.CreateNavigator();
// (so namespace mappings are in scope when we select)
nav.MoveToChild(XPathNodeType.Element);
XPathNavigator node = nav.SelectSingleNode(xpath, nav);
return node.Value;
}
by community-syndication | Aug 14, 2006 | BizTalk Community Blogs via Syndication
This is something I ran into tonight while testing a few things which I thought other
people might be aware of. If you’re creating arbitrary message parts in a multi-part
message in a BizTalk orchestration, and you’re loading your part’s data from
a Stream directly, be aware that you can only use a MemoryStream and not any
arbitrary Stream implementation.
This will happen either if you call LoadFrom() on your new XLANGPart instance or if
you call AddPart() to the XLANGMessage instance with the constructor that takes both
an object (the stream you want to load the message to) and a string (the part name)
overload.
The problem lies in that both of these methods eventually call into the GenericLoadFrom()
method in the Microsoft.XLANGs.Core.Part class, which basically does the following:
else if (source is Stream)
{
value1
= new Value(source as Stream);
}
Which in turns calls this:
public Value(Stream s)
{
if (
s == null )
{
throw new ArgumentNullException(“s”);
}
if (
!s.CanRead )
{
throw new ArgumentException(“!s.CanRead”);
}
if (
!(s is ICloneable)
)
{
MemoryStream stream1
= s as MemoryStream;
if (
stream1 == null )
{
throw new ArgumentNullException(“s
as MemoryStream”);
}
byte[]
buffer1 = stream1.GetBuffer();
s
= new ReadOnlyBufferStream(buffer1,
(int)stream1.Length);
}
IRefCountedStreamFactory
factory1 = new ReplayableStreamStreamFactory(s);
this._assignRewriter(factory1);
}
As you can see, the problem arises if you have an arbitrary Stream that is not clonable
or is not a MemoryStream, such as a lowly FileStream.

by community-syndication | Aug 14, 2006 | BizTalk Community Blogs via Syndication
I got an email from a great guy Andrew (based
in NZ) alerting me to a cool tool by Richard
Seroter.
That will go and give your rules the ‘once over’ plus alot more!!!
Check it out here
Thanks Richard!!! (and thanks Andrew)
by community-syndication | Aug 14, 2006 | BizTalk Community Blogs via Syndication
From my colleague Bill Ticehurst [MSFT]:
Hi all,
A beta release of Service Pack 2 for BizTalk Server 2004 is now available
from the Connect site. To obtain this beta perform the following steps:
– Go to http://connect.microsoft.com/
– Sign in with your Passport account (you need to do this step for it to be
visible)
– Click on Available Connections
– On the second table on the page you should see “BizTalk Server 2004 SP2
beta”
If you download and install this service pack then feedback on any issues or
problems encountered would be greatly appreciated (that’s what beta is for
right!). The email address for feedback is [email protected] .
Positive feedback will also be of value and is appreciated.
Thanks and regards,
– Bill Ticehurst [MSFT]
by community-syndication | Aug 14, 2006 | BizTalk Community Blogs via Syndication
For those of you currently deploying Commerce Server 2007, Microsoft has recently released their new Commerce Server 2007 Microsoft Operations Manager 2005 Pack better known as a MOM Pack!
If you’re already using MOM 2005, this is a great way to pro-actively monitor your Commerce Server applications. If you’re not using MOM 2005, this is a great reason to start!
PS: This post was written using the beta Windows Live Writer application. Not too bad for a beta!
Technorati Tags: Commerce Server
by community-syndication | Aug 14, 2006 | BizTalk Community Blogs via Syndication
Microsoft has recently released their Microsoft Commerce Server Technical Overview document packed full of excellent information for those of you evaluating Commerce Server 2007.
Technorati Tags: Commerce Server
by community-syndication | Aug 14, 2006 | BizTalk Community Blogs via Syndication
During the same recent
BizTalk POC I mentioned previously, I had the occasion to try and store rich HTML in a BizTalk schema for use in
a Microsoft InfoPath RichTextBox field. I had to work a little magic, and thought I’d share that here.
The first thing I had to do was build a schema containing a field that would work with InfoPath. The RichTextBox wouldn’t work
with just any old string. What I did was build a node (Docs) containing an “Any” element that
had Lax content processing, and most importantly, a namespace of http://www.w3.org/1999/xhtml.
Once I saved that schema and created a new InfoPath form which utilized it, you’ll see that the data type of Docs is now
equal to XHTML.
Now I could use that field as a RichTextBox. Why does that matter? Well, I wanted to store valid hyperlinks in the field that the
form viewer could then click on. These links are to the binary docs processed in the
earlier blog post. As you can see here, the RichTextBox
allows you to store all kinds of HTML formatted-data.
So now that I had my form and schema, I had to populate that XML element with valid HTML. So, in my orchestration, after I receive
each binary document (e.g. Word, Excel, PDF) from the inbound web service, I store the binary document in SharePoint, and use a helper
component to create a hyperlink pointing to the document’s new location. I used the code below to create a StringBuilder holding
each document hyperlink …
public void AddDocToList(string docName)
{
StringBuilder addressString = new StringBuilder();
addressString.Append(“<a href=”);
//WSSSite is a global variable pointing to the SharePoint doc library
addressString.Append(@”‘” + WSSSite + “/” + docName + ” ‘>”);
addressString.Append(docName);
addressString.Append(“</a>”);
addressString.Append(“<br />”);
sb.Append(addressString.ToString());
}
I also have a helper method called GetDocList which, when all binary docs have been received, takes the StringBuilder and
turns it into an XmlElement. That code is also simple and looks like this …
public XmlElement GetDocList()
{
XmlDocument tempDoc = new XmlDocument();
tempDoc.LoadXml(“<span>” + sb.ToString() + “</span>”);
return tempDoc.DocumentElement;
}
In my orchestration, I call this GetDocList method and set its return value to the XPath node in my XML document. Now when
the user opens up the InfoPath form to review the current activities, they have a nice, hyperlink-enabled list of all supporting
documentation. Of course you could also use this for an ASP.NET viewer, not just Microsoft InfoPath.
Technorati Tags: BizTalk
by community-syndication | Aug 13, 2006 | BizTalk Community Blogs via Syndication
An interesting thing happened on this project the other day, I wanted to call a WebSite (i.e. do a HTTP GET, then grab the HTML Response) just to make sure that it’s up and running.
It wasnt a webservice call, just a standard HTTP GET and HTML is returned (bit like
going to the Cricket sites, to see the current scores! 🙂
I created an Orchestration with a
msgResponse = Microsoft.XLANGs.BaseTypes.Any (this was coming back from the
WebSite call)
I then sent it straight back to the caller – using PassThru pipelines where ever needed,
as this message had HTML and not XML, so no XML inspection could be done.
As the goal posts moved, I then needed to Inspect the HTML Response for a certain
Version value within the HTML Response.
I thought “How do I do anything with a Message type of ‘Any’?“
1. Could I just send it back out to disk, a folder…when I open the resulting file
it appears all there.
2. Transform it into something more meaningful??
3. Send it to a helper class for further processing?
My problem was that the response was a HTML message and not a XHTML Response.
I even threw in a helper method from within an expression type to try and get the
type.
e.g. EventLog.WriteEntry(“I got ” + Type.GetType(msgResponse))
One of the problems I had was that I couldnt declare a helper method of
public static string GetMessageAsString(Microsoft.XLangs.Any msg) {…..}
The compiler jumps up and down and does nasty things to you!
What is the type of ‘Any’ in C# is the 64 million dollar question.
We know that all common Orchestrations Messages can be passed through as an XLANGMessage with
it’s parts + properties. All good.
(I tried this, it failed miserably)
After sheer determination and having an overloaded helper method with 10 different
possible types (I was racking my brain from XLANGMessage, to BTXMessage, to Object….etc) the
type that relates the ‘ANY’ element is XLANGPart as follows:
public static string RetrieveMessageAsString(XLANGPart pt)
{
StreamReader rdr = new StreamReader((Stream)pt.RetrieveAs(typeof(Stream)));
string s = rdr.ReadToEnd();
return(s);
}
NOTE: This doesnt deal with different byte encodings, but is easy enough to implement.
by community-syndication | Aug 12, 2006 | BizTalk Community Blogs via Syndication
Microsoft hasannounced that Host Integration Server 2006 July CTP (Community Technology Preview) is now available. The July CTP has two different versions available:
%u00b7 Microsoft Host Integration Server 2006%u00b7 Network Integration; SNA APIs, SNA Clients, Session Integrator, Enterprise SSO, Data Providers for DB2 and Host Files%u00b7 Microsoft BizTalk Adapters for Host Systems %u00b7 HIS 2006 features%u00b7 […]
by community-syndication | Aug 11, 2006 | BizTalk Community Blogs via Syndication
For anyone following my second BTS Diary and wondering whats going on with the prolonged silence, do not fear. Theres a lot to come.
I’ve been in the planning stage for a rather sizeable project, the second phase of my current integration project. This part will stretch over a couple of years at least and should get me poking into the furthest recesses of Biztalk 2004/2006. The immediate piece of work is in integrating 3 or 4 systems and passing documents securely through webservices building on the architecture of the integration hub we started implementing a few months ago. Theres definitely going to be a fair amount of WSE involved so I picked up the MS Press Web Services Security Patterns p&p book on Amazon recently. Its so much easier to read than printing off a 1000 page PDF.The architecture in its current draft is beginning to appear a bit like an ESB with a whole of lot routing, distribution trees and dynamism built in.
Speaking of ESB, check out Brian Loesgen’s blog for some work he did recently on a ESB system involving Biztalk 2004. Theres some really cool stuff that he’s posted in terms of things to consider and how to educate developers in using the stuff you build. There was also quite a bit of a furore in the integration world recently when apparently a tech forum witnessed heated debate on the subject of ESB between some MS folk and Sonic folk. Ah!! nothing like a good fight to warm the heart !!
I’ve also been trying to get my head round some of the material on the SOA Blueprints that have been floating around the net. Theres some publicly available material on OASIS which is very interesting. You can also download the MS implementation of the Generico blueprint somewhere on MSDN , (cant remember the URL offhand). Im chewing the fat now on distinguishing Identity Services, Directory Services and Security Services and trying to see whats the best way to position them and their relationship to each other.