Thursday, December 11, 2008

Schema without root error

I try to find common structures in xml schemas and place those types in a base schema that other schemas include or import, depending on namespace.

Today I did "as usual" but the project did not compile. "Unable to find root element" was the error.

I thought maybe something is changed in 2006 R2 and tried changing "Schema Type" to "Property". Then it compiled! Hmm, what was the connection? I tried changing it back to "Default" and that worked to!!

I am confused, something did get cleaned out by doing the switch, but I still do not know what.

Friday, November 21, 2008

HowTo: XmlNode, Clone and InsertBefore

If we have a XmlDocument named "doc" and you want to Clone and Insert the Clone before the original:

// Select your XmlNode
XmlNode myOriginal = doc.FirstChild; // Use the code to select your XmlNode

// Clone the XmlNode
XmlNode myClone = myOriginal.Clone();

// Insert the clone before the original
myOriginal .ParentNode.InsertBefore(myClone , myOriginal );

// The XmlNode you call InsertBefore from must be parent to the parameter refChild.

Wednesday, November 19, 2008

View tracked policies

It was not easy to find how to view tracked policies.

Eventually I found something in the documentation, under "Properties Pages";

"You can view tracked rules and policies during runtime using Health and Activity Tracking (HAT). In HAT, right-click the orchestration that the policy is called from, and then click Follow this link to view the Policy execution details for this Orchestration Instance to view the details on the tracked policies."

That was not complete information though.

Of course you need to turn on tracking:

  • Turn on tracking (In BTS Admin under "Applications/All Artifacts/Policies" or a specific Application". Remember that you track a specific policy version! So on updates you need to activate tracking again.
  • Send a message that invokes the policy

Now the link in HAT is visible, but you have to right-click and choose "Message Flow" first, was not mentioned in documentation, then you see the link.

Monday, October 27, 2008

Convert BAM definition xml from 2004 to 2006

I needed to use a BAM definition xml from 2004 in a 2006 environment.

I did not find any conversion tool so I compared it to a definition from 2006.

The 2 diffenrences I found was namespace and DisplayName.
  1. Change namespace to: http://schemas.microsoft.com/BizTalkServer/2004/10/BAM
  2. Remove prefix on that namespace
  3. Remove xml instance namespace (xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance")
  4. Remove all attributes named "DisplayName"

Done!

Friday, October 03, 2008

"Internal SOAP Processing failure"

Do not run "Web publish wizard" before deploying the BizTalk-assembly it depends on.

Why? Because your assembly have not got a PublicToken yet and the wizard will create a web service wich invoke BizTalk with incorrect parameter.

This:
string bodyTypeAssemblyQualifiedName = "x.y.z, x.y, Version=1.0.0.0, Cult" +
"ure=neutral, PublicKeyToken=null";

Instead of:
string bodyTypeAssemblyQualifiedName = "x.y.z, x.y, Version=1.0.0.0, Cult" +"ure=neutral, PublicKeyToken=bc6f029b1f97f4c8";

There can be a lot of reasons you get the error, "Internal SOAP Processing failure", but in my case it was the reason above.

Since the defult receive pipeline is PassThrough you might miss import error descriptions. In my case switching to XmlReceive made me discover that the pipeline could not find the schema assembly. Then I realized the PublicToken was "null".

Friday, September 26, 2008

Insert code block in Visual Studio 2005

It's a bit embarrassing to say that I have not understood how this worked until now...

In ReSharper you have had the possibility to write a keyword, for example "foreach" and then the tool fills in the rest.

This function exists in VS 2005 also, but since it's not that intuitive (you get a tooltip saying "foreach code snippet", but not how to) I have not used it. Today I tested using Tab and nothing happened, until I didi it again. Then it worked just like ReSharper.

1) Starting to write:














2) First Tab

3) Second Tab

Then you Tab between the colored areas and fill them with your values. Finish by pressing Enter, then you end up between the braces.


Saturday, February 23, 2008

Intellisense for xml in Visual Studio

When writing xml it is nice to have Intellisense. If your xml correspond to a xml schema that is no problem in Visual Studio 2005.



Just click somewhere in your open xml document and the Property pane will change to Xml document properties. There you click in "Schemas" to browse for your schema.



Then you´ll have Intellisense for the xml.