Saturday, 15 November 2008

Hi all

I have often wondered why the built-in functoids doesn't encompass an If-Then-Else functoid. The Value Mapping functoid only has an If-Then-part and not the Else-part.

This is the first of two blog posts. This post will explore how to solve the issue with the built-in functionality of BizTalk. The next post will be about creating a custom functoid to do the job instead and the issues that come with this task.

So, using the built-in functionality:

Imagine this input schema:

IfThenElseInputSchema

And imagine this output schema:

IfThenElseOutputSchema

My goal, now is to create a map that will map the value of the "ifJan" element to the destination IF the "qualifier" element equals the word "Jan" and otherwise the value of the "ifNotJan" element should be mapped.

So basically, given this input:

<ns0:IfThenElseInput xmlns:ns0="http://IfThenElse.IfThenElseInput">
  <qualifier>Jan</qualifier>
  <ifJan>ifJan</ifJan>
  <ifNotJan>ifNotJan</ifNotJan>
</ns0:IfThenElseInput>

I want this output:

<ns0:IfThenElseOutput xmlns:ns0="http://IfThenElse.IfThenElseOutput">
  <field>ifJan</field>
</ns0:IfThenElseOutput>

And given this input:

<ns0:IfThenElseInput xmlns:ns0="http://IfThenElse.IfThenElseInput">
  <qualifier>NotJan</qualifier>
  <ifJan>ifJan</ifJan>
  <ifNotJan>ifNotJan</ifNotJan>
</ns0:IfThenElseInput>

I want this output:

<ns0:IfThenElseOutput xmlns:ns0="http://IfThenElse.IfThenElseOutput">
  <field>ifNotJan</field>
</ns0:IfThenElseOutput>

Using a map and the built-in functoids, that would look like this:

 IfThenElseMap_Functoids

Basically, you need one value mapping functoid for each possible value to pass on, and a logical functoid for each value as well, to use in the value mapping functoid. The "String Concatenate" functoid is just my way of returning the string to use for the qualifier - in this case: "Jan".

You can also do it using one scripting functoid like this:

IfThenElseMap_Scripting_XSLT

where the scripting functoid is an "Inline XSLT Call Template" scripting type, and the script looks likes this:

<xsl:template name="IfThenElse">
  <xsl:param name="qualifier" />
  <xsl:param name="ifJan" />
  <xsl:param name="ifNotJan" />
  <xsl:element name="field">
    <xsl:choose>
      <xsl:when test="$qualifier='Jan'">
        <xsl:value-of select="$ifJan" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$ifNotJan" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:element>
</xsl:template>

Now... IF my good friend Henrik Badsberg is reading this, then by now he is screaming: "USE A BLOODY C# SCRIPTING FUNCTOID!!!!!" :-)

This, naturally is also an option:

IfThenElseMap_Scripting_CSharp

with an "Inline C#" script containing this script:

public string IfThenElse(string qualifier, string ifJan, string ifNotJan)
{
  if (qualifier == "Jan")
    return ifJan;
  else
    return ifNotJan;
}

Both scripting solutions can be altered to accept the output of a logical functoid as the first input. Just change the string "Jan" to "true" in the scripts, and change the name of the parameter if you want.

Now then... I am not a big fan of either of these three options. Generally, I avoid scripting functoids when I can because it is difficult for a new developer to know what is happening when he opens the map because he will have to open up all scripting functoids and find out (and remember) what they do. Also, I am not really a big fan of the first solution either. First of all, there are too many functoids, and it can messy if this solution is needed several times in a map. Secondly, you get a warning every time you compile, because you have two inputs to one element.

You can find my project with the three working maps here.

In my next post, I will look into creating a custom functoid that does the job and I can tell you right now; That isn't as easy as I had imagined...

--
eliasen

Saturday, 15 November 2008 21:49:40 (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
Monday, 10 November 2008

Hi all

In almost all multiple server installations of BizTalk I have encountered, there has been issues with MSDTC. MSDTC is Microsofts product for handling distributed transactions, meaning transactions that span multiple servers. BizTalk uses this in high scale, when running transactions against SQL Server, to maintain consistency in BizTalks databases.

All issues with MSDTC are solvable - sometimes it is just hard to figure out what is wrong.

First of all, always use the DTCTester tool at http://support.microsoft.com/kb/293799 to test your MSDTC installation. If this tool reports no errors and you are still having issues, then most likely, MSDTC isn't the cause of your issues.

If something is wrong with MSDTC, I have encountered four major issues:

  1. MSDTC doesn't run on either of the server. Solve this by starting MSDTC. Steps to start MSDTC (Note, that the MMC snapin is buggy, and it might appear that the "Component Services" node has no children... but it does, trust me :-) ):
    1. Go to "Administrative Tools" => "Component Services"
    2. Go to "Component Services" => "Computers" => "My Computer"
    3. Right click "My Computer" and choose "Start MS DTC".
      start_msdtc
  2. MSDTC isn't configured for network access on both servers. Solve this in "add/remove windows components" here:
    install_msdtc_network_access
  3. The two servers have the same MS DTC ID. This ocurs if both servers are clones of the same server or if one of the ervers is a clone of the other server. Usually, when cloning servers, sysprep is used to clear out those errors, but in case it hasn't been used, here is how you fix it:
    1. Run "msdtc -uninstall" from a command prompt
    2. reboot
    3. Run "msdtc -install" from a command prompt
    4. reboot
  4. You can't ping the servers by hostname, which is required. This basically means, that from both servers, you need to be able to ping the other server by hostname - pinging by IP address isn't enough. If you can't ping by hostname, you have two options:
    1. Get the network administrator to update your DNS
    2. Enter new information into the hosts file in c:\windows\system32\drivers\etc

Hope this helps.

--
eliasen

Monday, 10 November 2008 19:28:38 (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
Wednesday, 12 December 2007

So...

People sometimes ask, what is the difference between catching System.Exception and the General Exception in a Catch Exception shape in the orchestration designer in BizTalk.

Off course, an obvious difference is, that with the General Exception, you don't get an object with properties to investigate. But then it seems that the General Exception is useless... surely there is a point to it?

Well, I was curious about this myself, so I investigated a bit, and found this post. So basically, I think the catch of the general exception in BizTalk 2006 is a left over from BizTalk 2004. In BizTalk 2004 it made sense, since you actually have exceptions thrown at you that didn't derive from System.Exception. That is no longer possible in .NET 2.0 - they just haven't removed it from the designer - probably just to be backwards compatible.

That's it...

--
eliasen

Wednesday, 12 December 2007 19:53:15 (Romance Standard Time, UTC+01:00)  #    Comments [4]  | 
Thursday, 22 November 2007

Hi

Recently, I ran into a peculiar problem, which really had me fooled a long time.

Basically, I had a BizTalk Server 2006 R2 solution running. It consisted of 10 assemblies. One of the orchestrations in each of 9 of the assemblies was exposed as a web service, all using complex types - no strings, ints and so on.

And then there was the system, that was to call my web services. I had no saying over that system. We started calling the first web service. Everything went ok. Then they implemented code to call the second web service, everything OK... all was well (except some minor things here and there) for the first eight web services.

But at the ninth web service, strange things started to happen.

Basically, the other system would call my web service, IIS would return http 200 OK, but still, no data came into BizTalk. I had NOTHING in group hub page, nothing in HAT, nothing in the eventlog, NOTHING! IIS log said: I received a post on this url and responded with 200 OK - that's it - nothing more.

Really weird - I mean... where did the XML go? Why were there no errors? So we installed YATT, which is an http sniffer tool, that would be able to tell us what was exatly sent across the wires. Basically, what we found out was, that allthough the sender might have send 13000 bytes, the sniffer only reported maybe 10500 bytes. So we started investigating the network. The two servers were on the same subnet, one hop away from eachother. So no servers on the route could mingle with the traffic.

I decided that I would write my own little C# test program, that would call the web service and see if that failed as well. It didn't. I ended up calling the web service succesfully with more than 100k (I didn't bother to try anything higher than that.)

But it turned out, that the sniffer must have a bug - it reported all sorts of different numbers, when using my test program, and none were correct. Apparently, it wasn't created to handle large packets, but just a few kilobytes. So we installed wireshark instead (get it from sourceforge). Now THAT is a nice tool! Totally professional (and free), and it showed us everything that came in and out - no limitations.

So we did a test with my tool, and a test with the other system, and tried comparing the http headers, the soap action, and so on. It turned out, that all the other web services, when called by the other system, returned http 202 Accept and not http 200 OK. And when my test program called the web service, it got the http 202 Accept.

We ended up discovering what the issue was. The other system (programmed in .NET) wasn't calling my web services the "right way". They were sending everything using httprequests. Now, this is a perfectly legal way of doing it, but it really requires that you know what you are doing. I mean: They added a header to the httprequest for the SOAPAction, and then they built up XML with the soap envelope, soap body, elements for the web method and inside that the actual XML. This was just a string that they sent using httprequest.

The answer ended up being that the XML that the other system was sending me had invalid data in elements of type xsd:date. So basically, the XML couldn't be deserialized into the object that my web method on the web service was expecting. Therefore, the web method was never called, and therefore there was no data in biztalks log, the eventlog or anywhere else.

So, I have learned two things from this:

1. You should always accept the help your programming environment gives you. If the programmer of the other system had added a web reference to the web service and built XML and deserialized it into the object that was the parameter, he would have gotten an exception at runtime, that he could debug. The way he did it meant that we got NO errors at all - the data just disappeared (which I think .NET shouldn't do. Some sort of warning somewhere would have been nice.)

2. When debugging, don't trust the tools you download you to help debugging :-)

I hope this can help someone.

--
eliasen

Thursday, 22 November 2007 00:34:20 (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
Sunday, 21 October 2007

Hi

I just thought I would share my experiences from the first BizTalk 2006 R2 I have installed and configured.

It was on two different boxes - one for SQL Server and one for BizTalk. Domain groups were created beforehand, as well as a service account for the services. So everything should be in place.

Installation went fine, naturally, but the configuration wouldn't let me configure Group and Runtime. I checked the logs, off course, and the first error was this one:

[09:14:15 Info ConfigHelper]  is not a local entity.
[09:14:15 Error ConfigHelper] d:\depot2300\mercury\private\common\configwizard\confighelper\service.cpp(729): FAILED hr = 80070421

[09:14:15 Warning ConfigHelper] The account name is invalid or does not exist, or the password is invalid for the account name specified.
[09:14:15 Warning ConfigHelper]  Failed to validate service credentials for account: %1

So it had to be something about the credentials I have specified. So I unconfigured, reconfigured, being very carefully to enter the correct credentials - same error. I tried again, with extra extra focus on not mistyping anything. Same error.

Then I searched some more in the log file, and found this:

2007-09-25 09:16:49:0441 [INFO] WMI Deploying 'C:\Program Files\Microsoft BizTalk Server 2006\Microsoft.BizTalk.GlobalPropertySchemas.dll'
2007-09-25 09:16:49:0723 [WARN] AdminLib GetBTSMessage: hrErr=80070002; Msg=The system cannot find the file specified.;
2007-09-25 09:16:49:0723 [WARN] AdminLib GetBTSMessage: hrErr=c0c02560; Msg=Failed to read "KeepDbDebugKey" from the registry.
The system cannot find the file specified.;

But the file actually existed. Then I searched the log file some more, and found this:

2007-09-25 09:16:49:0863 [INFO] WMI Error occurred during database creation; attempt to rollback and delete the partially created database'hcpr-hd-axa-01\BizTalkMgmtDb'
2007-09-25 09:16:49:0863 [INFO] WMI Calling CDataSource.Open() against hcpr-hd-axa-01\master
2007-09-25 09:16:49:0879 [INFO] WMI CDataSource.Open() returned
2007-09-25 09:17:09:0942 [WARN] WMI Rollback failed.  Could not delete database.
2007-09-25 09:17:09:0942 [ERR] WMI Failed in pAdmInst->Create() in CWMIInstProv::PutInstance(). HR=c0c025b3
2007-09-25 09:17:09:0942 [ERR] WMI WMI error description is generated: Exception of type 'System.EnterpriseServices.TransactionProxyException' was thrown.
2007-09-25 09:17:09:0942 [INFO] WMI CWMIInstProv::PutInstance() finished. HR=c0c025b3
[09:17:09 Error BtsCfg] d:\depot2300\mercury\private\mozart\source\setup\btscfg\btswmi.cpp(358): FAILED hr = c0c025b3

[09:17:09 Error BtsCfg] Exception of type 'System.EnterpriseServices.TransactionProxyException' was thrown.
[09:17:09 Error BtsCfg] d:\depot2300\mercury\private\mozart\source\setup\btscfg\btscfg.cpp(1769): FAILED hr = c0c025b3

This error pointed to some transaction error, so I downloaded and ran dtctester and it turned out my MSDTC settigns were not good enough. I spend the better part of a day looking for this. What really had me confused was that the SSODB was created fine - the BRE-DB was created fine... and the BizTalkMgmtDb database was sometimes created just fine. I mean... sometimes it would create the BizTalkMgmtDB database and fail during creation of the MessageBox. Other times it would fail on the Management database. So seing as two databases were created just fine, I really didn't think there were any issues with DTC.

BUT, this just goes to show; Before starting a multibox installation of BizTalk, ALWAYS run dtc tester first - just to be sure :-)

--
eliasen

Sunday, 21 October 2007 20:02:05 (Romance Daylight Time, UTC+02:00)  #    Comments [5]  | 
Sunday, 14 October 2007

Hi

The other day I published an orchestration of mine as a web service. Not a big deal. Then, I needed to export the MSI for my application, so I could install it on the test server. Now THAT was a Big Deal! :-)

I got this one:

A really silly restriction on a quite normal Windows Server 2003 R2 - as you can see, the entire path of a file, including the filename, must be less than 260 characters long. And the path itself must be less than 248 characters long.

This had me stunned for a moment, until I took a closer look at what file creation was the issue. It turns out, that the issue was with creating temporary files in c:\documents and settings\administrator\local settings\temp. Yes, I am logged in as administrator. No, I wouldn't normally do that. Quit asking these questions, and let me finish the post! Right. Then I got clever, if I might say so myself (nobosy else is saying it, so I suppose I have to do it myself :-) )... Turns out that the temporary files are created in the %TMP% (NOT the %TEMP% one...) directory. So what to do? Simple - change the %TMP% environment variable to point at c:\tmp in stead of c:\documents and settings\administrator\local settings\temp. That's what I did, and it worked. I got my MSI file.

BUT... Well... You know that sometimes you do something that is like peeing in your pants? At first it is warm, but then it just gets cold and nasty? Well, this is like that. Because when I then took the MSI file to the test server and tried to install it (not the import part, but the install part), I got the exact same error. The default installation path is C:\Program Files\Generated by BizTalk\ - which is also a rather long path. So in order to install my application, I ended up installing it to c:\biz. Now having to tell your customer that they can't install the application to a path longer than 5 characters really isn't an option.

So my clever and very nice workaround to just set the TMP environment variable to c:\tmp in order to generated the MSI file really wasn't all that clever, since the installation wasn't acceptable at all. Had the issue just been my own developers box, I wouldn't have minded... but now I have to go rename all artefacts anyway. Bugger!

So basically, this post is written for people looking for a workaround for the error they get with long filenames/paths. My suggestion: Rename your artefacts, and don't wet your pants! :-)

--
eliasen

Sunday, 14 October 2007 21:52:42 (Romance Daylight Time, UTC+02:00)  #    Comments [0]  | 
Sunday, 07 October 2007

Hi

Well, some people have their BizTalk vNext wishlist on their blog. I'd like to add a couple of requests to the growing list :-)

  1. For development purposes, it would be really nice to be able to rightclick a receive location that is disabled and choose "Execute". If for instance I have a SQL adapter receive location that is supposed to poll every minute, then I don't want to have to quickly disable the receive location once it has been fired. I want to keep it disabled, so data wont go through my system when I am not ready, and then just execute it whenever I am ready.
  2. Deployment of single assembly from VS.NET. If I have three projects in my solution: Schemas, Maps and Orchestrations, and both Maps and Orchestrations reference Schemas, then I can not deploy them all at the same time from VS.NET :-( Deploying Orchestrations will make VS.nET deploy Schemas as well - even if there are no changes to it. To deploy Schemas, the current Schemas assemblymust be undeplyed, and therefore, the Maps assembly must also be undeployed. So VS.NET will Undeploy Orchestrations, Undeploy Maps, Undeploy Schemas, Deploy Schemas, Deploy Orchestrations. This isn't acceptable, because Maps isn't deployed anymore. If I then deploy Maps, the same thing happens, only the Orchestrations gets undeployed and it isn't redeployed. To me, VS.NET should ONLY interfere like that if I deploy the entire solution. If I deploy just project, then just let me do so! Right now, I would have to let Orchestrations reference Maps even if it isn't necessary and then always deploy Orchestrations.
  3. Restart Host Instances only once. Right now, if I deploye my solution from VS.NET, and this solution has 10 proejcts that are all set to "Restart Host Instances" on deployment, then the host instances will get restarted 10 times. Would be nice if VS.NET could figure this out and only do it once.
  4. Specify the node that is body, when using enveloping and not just the parent. It makes great sense, that I can specify a node and all child elements are then submitted as seperate messages from the receive pipeline. This is how we can receive orders, invoices, etc. in the same XML. BUT, if I receive XML where I only need the Orders, then I would like to point at the Orders element so that is all I get. Right now I have to use standard enveloping, and implement logic to just delete the invoices, etc. Not really nice, I think.

That's it for now :-)

--
eliasen

Sunday, 07 October 2007 00:40:36 (Romance Daylight Time, UTC+02:00)  #    Comments [0]  | 

Hi

A guy on the newsgroups recently needed to create exactly 5 elements in the output of his map, no matter how many records appeared in the input.

Well, I am always looking for new things to try out, and frankly, my XSLT coding skills could be better, so I thought I'd give it a shot.

I created a project with the following input schema:

The schema is for an XML document, and has a header (1..1), a LoopingRecord (1..1) and a footer (1..1). The LoopingRecord has a Field5 element, that can appear at most 5 times.

The output schema looks like this:

This schema is for a flat file. It baiscally has the same signature as the input schema - exception being that the Field1 element has minOccurs=5. It MUST be present 5 times - this is a schema for a positional file.

The map is pretty simple:

Header and footer are mapped using regular mapping techniques. But the Detail-element is created using a custom scripting functoid.

The string concatenate functoid only has one input, the string "5". This is because I want to create exactly 5 elements in the ouput.

The custom scripting functoid is an "Inline XSLT Call TEmplate" scripting functoid with the following code:

<xsl:template name="CreateXElements">
   <xsl:param name="totalCount" />
      <Detail>
         <xsl:for-each select="/*[local-name()='InputRoot']/*[local-name()='LoopingRecord']/*[local-name()='Field5']">
            <DetailLoop>
               <Field1><xsl:value-of select="text()" /></Field1>
            </DetailLoop>
         </xsl:for-each>
         <xsl:variable name="countRecords" select="count(/*[local-name()='InputRoot']/*[local-name()='LoopingRecord']/*[local-name()='Field5'])" />
         <xsl:if test="$countRecords&lt;$totalCount + 1">
            <xsl:call-template name="BuildTheRest">
               <xsl:with-param name="counter"><xsl:value-of select="$countRecords + 1" /></xsl:with-param>
               <xsl:with-param name="totalCount"><xsl:value-of select="$totalCount" /></xsl:with-param>
            </xsl:call-template>
         </xsl:if>
      </Detail>
</xsl:template>
<xsl:template name="BuildTheRest">
   <xsl:param name="counter" />
   <xsl:param name="totalCount" />
      <DetailLoop>
         <Field1></Field1>
      </DetailLoop>
      <xsl:if test="$counter&lt;$totalCount">
         <xsl:call-template name="BuildTheRest">
            <xsl:with-param name="newCounter"><xsl:value-of select="$counter + 1" /></xsl:with-param>
         </xsl:call-template>
      </xsl:if>
</xsl:template>

Basically, I start by copying existing nodes to the destination. As I have explained in this post you need to use XSLT for the whole thing. You can't copy the existing nodes using the mapper and create the new nodes using XSLT. After the existing nodes have been copied, I create the new empty nodes, by recursively calling a template that will create a single element for me.

You can find my entire project here: CreateXNumberOfElements.zip (23.33 KB)

I hope this will come in handy for someone in the future.

--
eliasen

Sunday, 07 October 2007 00:09:42 (Romance Daylight Time, UTC+02:00)  #    Comments [4]  | 
Tuesday, 18 September 2007

Hi

An old collegue of mine asked me if there wasn't anyhow he could overwrite the folder of a send port using the FILE adapter, so that he could decide the entire path of a file that was to be written from within his orchestration.

After all, you can overwrite many things, like SMTP server to be used in the send port or the username and password for an FTP connection. So why not the file folder?

Well, I have investigated it a little bit, and I can't get around to making BizTalk do it.

I tried:

  1. Set the folder on the send port blank, and use the %SourceFileName% as filename and set its value (The FILE.ReceivedFileName property of the message) inside the orchestration. This isn't valid, since the folder path can not be empty.
  2. Set the folder to c:\ and set the FILE.ReceivedFileName property to be <directory> + "\\" + <filename>. This didn't work either. When writing the file, BizTalk strips all folder names from the FILE.ReceivedFileName value and just wrote the file with filename in c:\

Off course, you can use a dynamic port to do it, but this customer wanted to avoid seeing all those subscriptions in the subscription viewer.

So I don't see a way around it. And basically, when you know it works like this, it makes sense that the administrator who has decided what folder files go into also gets to decide that you can not overwrite this. Oh well, that's life.

Hope this helps someone at some point...

--
eliasen

Tuesday, 18 September 2007 22:29:23 (Romance Daylight Time, UTC+02:00)  #    Comments [0]  | 
Sunday, 16 September 2007

Well, I suppose we have all been there – in order to get the business process running, a specific element from a schema needs to be promoted in order to route on it, correlate on it, and so on.

 

Unfortunately, elements that can occur more than once can not be promoted. This, off course, makes perfectly sense, since the property can only hold one value, and how would BizTalk know which one of the many occurring elements to take the value from at runtime? So we agree with the limitation, but hope for a nice solution. :-)

 

If you try to promote a reoccurring element, you get this error when adding it to the list of promoted properties:

“This node can occur potentially multiple times in the instance document. Only nodes which are guaranteed to be unique can be promoted.”

 

Right. Now, some people have found the editor for the XPath describing the element that one wants to promote. If you have promoted some element, you can click on it like this:

Then you can click on the dot at the right of the line, and get into the editor like this:

 

Now, wouldn’t it be lovely, if you could just change this expression to include for instance an index on the reoccurring element? In my example from this screenshot, the “ReoccuringRecord” record can occur multiple times. So it would be nice, if I could just change the XPath to be like this:

 

/*[local-name()='ExampleRoot' and namespace-uri()='http://PromotingReoccuringElement.ExampleSchema']/*[local-name()='ReoccuringRecord' and namespace-uri()=''][1]/*[local-name()=’ElementWhereNumber1IsPromoted’ and namespace-uri()='']

 

By setting the “[1]” into the XPath, I state that I will be needing the first occurrence of the ReoccuringRecord and therefore, this XPath expression will always give me exactly one node. Unfortunately, the engine can not see this, so the error will be the same, only difference being that this error doesn’t occur until compile time:

 

Node "ElementWhereNumber1IsPromoted" - The promoted property field or one of its parents has Max Occurs greater than 1. Only nodes that are guaranteed to be unique can be promoted as property fields.

 

Bummer!

 

So how do we get this working? If I really need to promote a value that occurs in an element that might occur multiple times, I see four options:

 

  1. Map to a schema on receive port
  2. Custom pipeline component
  3. Orchestration to do it and then publish to MessageBox
  4. Call pipeline from orchestration

I will go these options in more detail here:

 

Option 1: Map to a schema on receive port.

When a map is executed on a receive port, some extra magic functionality is performed by BizTalk. After the map has been executed, the message is sent through some code that promotes properties that are specified inside the destination schema. If you execute a map inside an orchestration, this doesn’t happen.

 

So you can create a schema that has an extra field, in which you place the value that needs to be promoted. This element must not be able to occur multiple times. Promote this new field, and after the map on the receive port has been executed, you have your value promoted.

 

Option 2: Custom Pipeline Component.

It isn’t that difficult to create a custom pipeline component, that can promote a field for you. Your Execute method might look just like this:

 

public Microsoft.BizTalk.Message.Interop.IBaseMessage Execute(IPipelineContext pContext, Microsoft.BizTalk.Message.Interop.IBaseMessage pInMsg)

{

    pInMsg.Context.Promote("MyProp", "http://ReoccuringElement.PropertySchema", "MyValue");

    return pInMsg;

 }

 

Of course, you will probably want to load the body stream of the IBaseMessage somehow, in order to find the value inside the body to promote and then replace "MyValue" with the value form within the XML.

 

Just use the pipeline component inside a custom receive pipeline, and you are all set.

 

Option 3: Orchestration to do it and then publish to MessageBox

Create a intermediate orchestration, that gets the input message. Then, it should create a new message of the same type in a message assignment shape like this:

NewMessage = InputMessage;

NewMessage(*) = InputMessage(*);

NewMessage(MyNewProperty) = xpath(InputMessage, xpathexpression);

 

Then, use a direct bound port to publish the message to the MessageBox. In order for the new property to follow the message, you need to initialize a correlation set on the send shape that is based on this new property.

 

Let other orchestrations and send ports subscribe to this message and let then do their work.

 

Option 4: Call pipeline from orchestration

The last option is to call a receive pipeline from within your orchestration. This requires a new schema, that has a field for the value to be promoted, just as in option 1. Inside your orchestration, map the input message to this new schema, and call a receive pipeline with this new message as a parameter. Remember to promote the field in this new schema. There is an article on MSDN about calling a pipeline from within an orchestration, which can be found at http://msdn2.microsoft.com/en-us/library/aa562035.aspx

 

Upsides and downsides

In order to choose which way to go in a specific solution, several things need to be considered.

 

Basically, I'd go for option 1 almost anytime. This is because it is best practices to map anything incoming into a canonical schema anyway. So instead of promoting values inside all your partners schemas - schemas they might change, you should promote from within your own canonical schema.

 

Reasons not to choose option 1 include: The canonical schema also has a reoccurring element, so it hasn't provided extra functionality with regards to getting this specific value promoted. Or perhaps, we aren't using canonical schemas, because there was no time for this when the project was started.

 

If we can't go for number 1, I'd go for number 3. Number 2 requires programming of a pipeline component, which can be a bottleneck, unless done correct. Also, the pipeline component is a whole new component to maintain, document and test. Number 4 requires a new schema and therefore also a map to be built. If I am ready to do this, I'd go for number 1 instead.

 

If I don't like number 3, for unknown reasons, I'd go for option 2 - the custom pipeline component. Allthough it is custom code, and must be done right, and testet and everything... I still feel that creating a new schema and map in order to call the pipeline in option 4 is overkill, since I'd go for option number 1 instead, which would also require the new schema and map.

I hope this explains some details about this issue, and that it helps someone in the future.

--
eliasen

Sunday, 16 September 2007 23:22:51 (Romance Daylight Time, UTC+02:00)  #    Comments [0]  | 
Thursday, 23 August 2007

Hi

The other day, I suddenly found myself in a situation, where I needed to use the "Find message" functionality and HAT to find a message, and I needed to filter on a promoted property.

My problems started appearing, when there were no promoted properties to select in the Message properties filter view. I had chosen my schema, but still, the dropdowns for promoted properties were empty.

So I checked that tracking of both message bodies and promoted properties were enabled in the receive port. Yes, they were... so I started wondering what might be the cause of this. And then I though: Oh yeah, you need to enable tracking of these individually in HAT. But in HAT I couldn't find anywhere to enable this. That stunned me for a couple of minutes. Turns out, that was in BizTalk 2004 :-S

Whoops :-)

And the I remembered that I needed to do two things in order to get the tracking of promoted properties to work:

The first is to enable the tracking in the receive port:

And the second thing is to enable tracking of each specific promoted property - and now I remembered it isn't in HAT anymore, it is in BizTalk Server Administration for each schema. So open BizTalk Server Administration. Go to the application that has the schema, for which you need to track promoted properties. Go to the schemas collection of this application, double click on the appropriate schema, go to the tracking pane, and here you must select the properties to track.

I googled this a lot, but had great difficulty finding any information... that's the reason for this post.

I hope others will find it useful in the future.

Comments are welcome

--
eliasen

Thursday, 23 August 2007 21:46:55 (Romance Daylight Time, UTC+02:00)  #    Comments [4]  | 
Monday, 09 April 2007

Hi

I have just written a blog post about using the SQL Adapter Wizard and during my tests for this post, I found the cause of an error that I saw someone in the newsgroups ask about. So I will just post the answer here.

I got these errors when compiling my project, in which I have used the SQL Adapter Wizard twice to create a schema for me:

Error 1 illegal name-hiding: 'Orchestration_1' hides 'SQLAdapter.Orchestration_1' on line 101 C:\Projects\BTS 2006\BlogEntries\SQLAdapter\BizTalk Orchestration_1.odx 102 23 

Error 2 symbol 'Orchestration_1' is already defined; the first definition is in file C:\Projects\BTS 2006\BlogEntries\SQLAdapter\BizTalk Orchestration.odx on line 101 C:\Projects\BTS 2006\BlogEntries\SQLAdapter\BizTalk Orchestration_1.odx 102 23

It turns out, that when you use the SQL Adapter Wizard to automatically create schemas for you, then an orchestration is also created for you. Yes, I knew that, you say? Well, so did I :-) What I didn't know was that the Wizard is clever enough to give the two orchestrations different filenames, but stupid enough to give them both the .NET type name "Orchestration_1". So when compiling the project, you have two orchestrations with the same fully qualified typename, which off course will fail.

See this screenshot:

As you can see at the lower right vorner of the picture, the "BizTalk Orchestration_1.odx" has "Orchestration_1" as its typename. Well, "BizTalk Orchestration.odx" has the same.

"So I just change one of them, no problem", you say? Well, there is another problem... If you look at the port types and multi-part message types in each orchestration, they are also given the same names. So changing the typename of one of the orchestrations removes the compilation error, but it will just give you the next set of errors, as more things are given the same name, and therefor more illegal name-hiding is taking place. Se the post here about what you can do to rename things.

I hope this helps someone.

--
eliasen

Monday, 09 April 2007 23:40:56 (Romance Daylight Time, UTC+02:00)  #    Comments [1]  | 

Hi

When using the SQL Adapter wizard to generate schemas for updategrams, queries or calling stored procedures, the wizard will create an orhestration and a schema for you in your project. The orchestration is named BizTalk Orchestration.odx (or if this allready exists, then it will add _1, _2 and so on) and the xsd will be called SQLService_<chosen_rootnode_in_wizard>.xsd

These names are of course not useful in most scenarios, since most projects have naming conventions that must be followed. Moreover, the orchestration is often just annoying, since the database read/update usually must happen in an allready existing orchestration.

What you should do is this:

  1. Rename the xsd to follow your naming conventions
  2. Rename the typename of the schema to match the filename
  3. Open the automatically created orchestration, and:
    • Update the parts of the two created multi-part messages to point to the new typename of the schema
    • Rename the port type that is created to something meaningful
    • Rename the multi-part message types that are created to be more meaningful.
    • The last two steps are very important, if you plan to use the SQL Adapter more than once in the same orchestration, since otherwise you will get type names in both generated orchestrations that are the same. And this isn't allowed, off course.
  4. Cut and paste the port type and multi-part message types from BizTalk Orchestration.odx to the orchestration where you actually need them.
  5. Delete the BizTalk Orchestration.odx file, since it is no longer needed.

So basically, the automatically created names of things when using the SQL Adapter Wizard are useless. And also, the created orchestration is useless after moving the automatically created types away from it.

I hope this is useful for someone at some point.

--
eliasen

Monday, 09 April 2007 23:27:38 (Romance Daylight Time, UTC+02:00)  #    Comments [3]  | 
Sunday, 04 March 2007

Hi

I had post some time ago, which explained how to promote fields from a schema generated by the SQL Adapter. This post contains some information that could be useful for people searching the net for information about changing the records in the generated schema into elements. A search for those words wouldn't have my post in the top 1000 hits, though :-)

So I thought just to have this simple post with a title that will hopefully match what people search for, and let them find the information.

That's it :-)

--
eliasen

Sunday, 04 March 2007 22:01:32 (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
Sunday, 14 January 2007

Hi

Sometimes I run into this error, when deploying a BizTalk project from VS.NET: "An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"

I take a quick look at it, bang my head in the desk for doing it again, and then I perform the following steps:

  1. Rightclick on the project and choose Properties
  2. Go to "Configuration Properties" => "Deployment"
  3. Change the "Server" property to be the servername of the SQL Server you are deploying to
  4. Save changes
  5. Deploy again

This happens if you receive a copy of someone elses project - since the servername is listed in the projectname.btproj.user file that is a part of the project.

Hope someone else gets quickly past this hurdle now it has been blogged.

--
eliasen

Sunday, 14 January 2007 21:43:48 (Romance Standard Time, UTC+01:00)  #    Comments [4]  | 

Hi

I have just had a client who was upgrading from the BizTalk Accelerator for SWIFT 2.3SP1 to the 2006 Message Pack, and it didn't go as expected.

Basically, after upgrading, using the migration guide found at http://www.microsoft.com/downloads/details.aspx?FamilyID=5f0a2355-b17f-479c-9b14-f784d5da9a95&DisplayLang=en, it didn't work. A warning appeared in the eventlog when trying an MT541 document:

An exeption occured inside the rule engine instance executing policy "MT541_Master_Policy"... Now, the obvious errors were checked for - the policy WAS deployed and undeploying it gave a whole new error. So something must go wrong at runtime, evaluating the policy. The policy only consisted of a single rule, but this rule has plenty of actions. I tried removing the actions one at the time, in new versions of the policy, and finally found out that it wouldn't work until I had removed ALL the actions.

So, basically, something must be very wrong.

The solution ended up being doing some assembly binding.

The migration guide states that:

"You must configure the assembly bindings on all computers in your environment using .NET Framework 1.1. You do not need to configure the assembly bindings for computers using .NET Framework 2.0. "

BUT, it is wrong! When using BizTalk 2006, which, as we all know, is running under .NET 2.0, you STILL need to do the assembly binding. You just need to do it using the .NET 2.0 Configuration instead of the .NET 1.1 Configuration, as written in the migration guide.

After that, the error disappeared, but another one turned up:

Now I was really mad. This error looks just like the first one, it is just another policy that is going wrong. Anyway, this turned out to be a known bug... sort of: http://support.microsoft.com/default.aspx?scid=kb;EN-US;928259 - the KB article states that it is for the Accelerator for SWIFT 2.1 - but actually it is for the 2006 MEssage Pack and applies to BOTH 2.1 AND 2.3.

So I was really in for a difficult job here - having to go against the migration guide form Microsoft and installing a hotfix that wasn't for this version of the accelerator.

I had actually given up, and I started a support incident with Microsoft, so all these steps were done as suggested by the support guy. The support incident hasn't cost me anything, as you might guess :-)

I hope someone else can benefit from this at some point.

--
eliasen

Sunday, 14 January 2007 21:31:43 (Romance Standard Time, UTC+01:00)  #    Comments [3]  | 

Hi

I was trying to help someone in the BizTalk newsgroups, creating a flat file schema, and I ran into this very annoying error message: "Unable to match the data in the input stream.". I got the error message after having created the schema and trying to validate an instance, using VS.NET 2005.

I searched and searched...

  • Someone needed to set the "parser_optimization" to "complexity" - I had allready done that.
  • Someone else needed to set the "lookahead_depth to 0 - I had also tried that.
  • Someone needed to set the input type to "Native" instead of XML. Had that been my problem, I wouldn't have blogged about it - I'd be too embarassed :-)

No, the problem was that I had created parts of the schema using the flat file wizard. It had set one of my records to have "minOccurs" = 18 and "maxOccurs" = 18 as well. Since my test instance didn't have that many records in it, I got this error message. Changing the two 18's to the default 1 solved my problem.

I hope Microsoft considers this and perhaps in future releases find a better error description :-)

In order to test it, you can just download the working schema: Exolit_FlatFileSchema.xsd (91.59 KB) and the test instance: Instance.txt (.72 KB) - it will validate. But try to change the minOccurs and maxOccures of the "Invoices"-record to "18" - and revalidate.

Anyway... Hope this helps someone in the future.

--
eliasen

Sunday, 14 January 2007 13:41:33 (Romance Standard Time, UTC+01:00)  #    Comments [3]  | 
Friday, 05 January 2007

Hi

Should you ever run into this warning in the eventlog, when using the SQL Adapter for BizTalk:

your problem is that the SQL Adapter is receiving a result set instead of XML.

There are two possibilities:

  1. As we all know, when using the SQL Adapter to call a stored procedure, you must write "for xml auto, xmldata" (or some variant - I like the "elements" way of things) in your Stored Procedure in order to let the schema generator generate a schema for you. After the schema has been generated, you need to remove the ", xmldata" or else schema data will be returned every time the SP is called instead of real data. Anyway, sometimes people remove too much from the SP, ie. they remove the entire "for xml auto, xmldata" instead of just ", xmldata".
  2. Sometimes, someone forgets to write "for xml auto" after a select statement in the receive location.

Both will cause the above mentioned error.

Hope this has helped someone.

--
eliasen

Friday, 05 January 2007 23:07:27 (Romance Standard Time, UTC+01:00)  #    Comments [4]  | 
Friday, 22 December 2006

Hi

I have just played quickly with receiving flat files.

Often, people create a receive pipeline for each flat file messagetype that must be received. This is done because the flat file disassembler needs to know exactly which document schema is to be used to parse the incoming message, as opposed to the XML disassembler, which will find the schema at runtime. So instead of having several flat file disassemblers in one pipeline, often, many pipelines are created.

BUT, I'd just like to point out that with BizTalk 2006, you can change properties of the pipeline components on a per instance level. So double click on your receive location, click the ellipsis on the pipeline and go to the "DocumentSpecName" property of the flat file disassembler. Why they haven't called it "Document Schema" as it is called in the pipeline designer, I don't know!

Anyway, here you can specify which document schema this pipeline instance should use. You must specify the fully qualified .NET typename of the schema, however. And it is a textbox, not a drop down, as in the designer. You can get the .NET typename by clicking on the .xsd in solution explorer, and taking it from the "Fually Qualified Name" property.

Hope this was helpful

--
eliasen

Friday, 22 December 2006 21:47:24 (Romance Standard Time, UTC+01:00)  #    Comments [3]  | 
Sunday, 17 December 2006

Hi

When generating a schema based on the SQL Adapter, there are some options for manipulating the XML.

I always use the "for xml auto, elements" version, because I'm an "element-kind-of-guy". Others use the "for xml auto" for several reasons:

  1. It is the default
  2. Attributes create smaller XML
  3. They like attributes

None the less, I'm an "element-kind-of-guy" and I do what I want! :-)

Anyway, the schemas that are the result of this leave my schema with loads of records instead of elements, meaning that I can not promote the result to distinguished fields.

There is a way of changing this, though... allthough I really don't consider it to be a nice solution :-)

As an example, I have the following table in a database:

And I have this stored procedure to get the values:

CREATE PROCEDURE [dbo].[Get_eliasen]
AS
BEGIN
 -- SET NOCOUNT ON added to prevent extra result sets from
 -- interfering with SELECT statements.
 SET NOCOUNT ON;

    -- Insert statements for procedure here
 SELECT * from eliasen for xml auto, elements, xmldata
END

Basically, it returns all rows from the table. The schema generated from this stored procedure will look like this:

The "seqno", "field1", "field" and "field3" are records and not elements. If I want to change them to be elements instead, I need to open the XSD in a text editor and do this manually:

As an example, I will change the record "seqno" into an elements.

The original XSD looks like this:

<?xml version="1.0"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://eliasen.dk/SQLAdaterRecordsTest" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <msbtssql:sqlScript value="exec [Get_eliasen]" xmlns:msbtssql="http://schemas.microsoft.com/BizTalk/2003" />
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="SQLAdaterRecordsTestRequest">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="eliasen" xmlns:q1="http://eliasen.dk/SQLAdaterRecordsTest" type="q1:eliasenType" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="eliasenType">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="seqno" xmlns:q2="http://eliasen.dk/SQLAdaterRecordsTest" type="q2:seqnoType" />
      <xs:element name="field1" xmlns:q3="http://eliasen.dk/SQLAdaterRecordsTest" type="q3:field1Type" />
      <xs:element name="field2" xmlns:q4="http://eliasen.dk/SQLAdaterRecordsTest" type="q4:field2Type" />
      <xs:element name="field3" xmlns:q5="http://eliasen.dk/SQLAdaterRecordsTest" type="q5:field3Type" />
    </xs:choice>
  </xs:complexType>
  <xs:complexType name="seqnoType">
    <xs:simpleContent>
      <xs:extension base="xs:long" />
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="field1Type">
    <xs:simpleContent>
      <xs:extension base="xs:string" />
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="field2Type">
    <xs:simpleContent>
      <xs:extension base="xs:string" />
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="field3Type">
    <xs:simpleContent>
      <xs:extension base="xs:string" />
    </xs:simpleContent>
  </xs:complexType>
</xs:schema>

And I will change it into this:

<?xml version="1.0"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://eliasen.dk/SQLAdaterRecordsTest" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <msbtssql:sqlScript value="exec [Get_eliasen]" xmlns:msbtssql="http://schemas.microsoft.com/BizTalk/2003" />
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="SQLAdaterRecordsTestRequest">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="eliasen" xmlns:q1="http://eliasen.dk/SQLAdaterRecordsTest" type="q1:eliasenType" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="eliasenType">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="seqno" type="xs:long" />
      <xs:element name="field1" xmlns:q3="http://eliasen.dk/SQLAdaterRecordsTest" type="q3:field1Type" />
      <xs:element name="field2" xmlns:q4="http://eliasen.dk/SQLAdaterRecordsTest" type="q4:field2Type" />
      <xs:element name="field3" xmlns:q5="http://eliasen.dk/SQLAdaterRecordsTest" type="q5:field3Type" />
    </xs:choice>
  </xs:complexType>
  <xs:complexType name="field1Type">
    <xs:simpleContent>
      <xs:extension base="xs:string" />
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="field2Type">
    <xs:simpleContent>
      <xs:extension base="xs:string" />
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="field3Type">
    <xs:simpleContent>
      <xs:extension base="xs:string" />
    </xs:simpleContent>
  </xs:complexType>
</xs:schema>

So what have I done?

  1. I Found the definition of the record "seqno". It was based on the type "q2:seqnoType".
  2. I found where the "seqnoType" type was declared, and noted that it extended "xs:long".
  3. I changed the type of "seqno" from "q2:seqnoType" to be "xs:long".
  4. I removed the q2 namespace declaration from the seqno element, as it was no longer needed.
  5. I removed the "seqnoType" type declaration, as it was no longer needed.

That's it. Save the XSD and reload it in your schema editor - you will get this:

But it sure would be nice to have the option of just changing it in the properties of an elements in the schema editor...

Hope this helps someone.

EDIT on the 4'th of march 2007: Remember also that the record just below the root node must be set as "maxOccurs=1" instead of unbounded. Otherwise, you can not promote the fields below the record, obviously.

--
eliasen

Sunday, 17 December 2006 23:42:35 (Romance Standard Time, UTC+01:00)  #    Comments [4]  | 
Saturday, 09 December 2006

Hi

I ran into this issue today. It turned out that the error occured in an expression shape that used xpath to get a value from a message into a variable.

Having been using xpath expressions inside my orchestrations for a long time, I am really not used to having them fail on me :-) And this particular xpath expression was copied from the "Instance XPath" property of the element in the schema editor. So it shouldn't fail. I did add a "[1]" to the xpath because I needed to access the first element of a re-occuring element, but still - not something I hadn't done plenty of times before.

Actually, it took quite some time before I discovered what was wrong. My expression was:

DeliveryDate = xpath(OrderMessage, "/*[local-name..........");

and I needed to change it to

DeliveryDate = xpath(OrderMessage, "string(/*[local-name..........)");

Again, something I have done a million times... this time I just forgot it. And honestly, I really don't think the error message gives a very good idea of what is wrong...

Hope this gets indexed and someone later on will find it helpful :-)

--
eliasen

Saturday, 09 December 2006 23:24:28 (Romance Standard Time, UTC+01:00)  #    Comments [13]  | 

Hi

On my current project, I ran into a small issue. In my orchestration, I created a record in a table in a database. The stored procedure that created the record also returned the ID of the record. This ID was to be emailed to a trading partner in the body of an html email. The trading partner could reply, and I needed to correlate on the ID of the record in the database.

But how to do that? The body of the email is one long rawstring with the ID embedded in the HTML.

Off course, there was the obvious way; Just use a property that is never used in some property schema. I happen to know that my solution will never actually use the POP3.Subject property, and therefore I can use it for my purposes. So when I create the Message to be sent out by email to the trading partner, I put the ID inside the POP3.Subject property. When the message is sent, I initialize a correlation set that is based on this single property. I have then also promoted some element of the reply from the trading partner to the same property, and this works just great.

BUT, I am not a fan of misusing properties like that. I find it a bit ugly. So I looked for alternatives, and then I found the /dev/null adapter written by BizTalk MVP Tomas Restrepo. Baiscally, the adapter discards anything it receives. Tomas writes that it can be used to subscribe to anything in order to avoid getting the "No subscribers found" errors, but I found another use for it.

So I created a dummy schema that only had one element in it and promoted that element to a property of my own property schema. I also promoted the appropriate element from the reply from the trading partner to the same property. In my orchestration, I then created a correlation set based on this property, and I added a send port that sends out an instance of the dummy schema just after sending out the email to a port using the /dev/null adapter. The message doesn't go anywhere, but the correlation set gets initialized and I can follow it later on in my orchestration.

See my solution at CorrelationAfterSMTPSend.zip (94,37 KB)

Remember that you must download and install the /dev/null adapter before trying this.

And see the solution without using Tomas' adapter here: CorrelationAfterSMTPSendWithoutDevNull.zip (78,18 KB)

Pros and cons... Well, the first obvious solution is much simpler, as it doesn't require a dummy schema, it doesn't require a property schema and the orchestration doesn't need to create and instance of the dummy schema and send it out. On the other hand, it really isn't pretty to use the properties like that.

The second solution requires installing an adapter, registering it, and all the legwork described above. But the solution uses my own properties and the POP3.Subject property can be use later on, should it be necessary.

Oh well, use whichever you like best :-)

Hope this was helpful to someone.

 

Updated on the 10'th December 2006:

Well, had I taken the time to think it over again before writing the blog entry, I would have realized that my first obvious approach, which is using the POP3.Subject property doesn't actually have to use an existing property in an existing property schema. I could just as easily have created my own property schema and used that instead.

The reason I abandoned this approach was, that after creating the property schema and creating a property inside the property schema, to which I promoted fields in the schemas, I couldn't assign values to it in message assignment shapes. The property just didn't show up using intellisense in the message assignment shapes.

So I went ahead and used the POP3-Subject property instead. BUT, I discovered that I can actually assign values to my own properties. I just need to change a property of the property element in the property schema. The property element needs to be marked as "MessageContextPropertyBase" in the "Property Schema Base" property of the property element in the property schema.

So, I have abandoned the /dev/null adapter, although I liked the idea :-) And am now using my own property. The best of the two worlds! :-)

--
eliasen

Saturday, 09 December 2006 23:17:36 (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
Tuesday, 05 December 2006

Hi

Updated at the bottom with a solution.

I have this very weird problem. I have created a functoid, but silly, as I am, I created an icon for it that was way to big. So I wanted to remove the functoid from the toolbox and deploy another functoid instead.

This turned out to be quite a difficult task. I have removed the functoid from GAC and I have removed it from the "Mapper Extensions" folder of the BizTalk installation folder. I have then reset the toolbox. The functoid is STILL there. Actually, I can do whatever I want, even boot the server, but the functoid stays in the toolbox. If I move my mouse over it in the toolbox, VS.NET 2005 will crash very hard, so this isn't desirable :-) If I am very quick, I can go to the functoid, right click on it and delete it from the toolbox. Yiepee, it is gone. BUT, resetting the toolbox makes the functoid reappear :-(

Another guy has the same problem, and at this moment, a support incident with Microsoft is being evaluated. Microsoft have reproduced the behaviour, they claim, so I am awaiting the answer to this peculiar problem any time now.

I will post the solution here, off course.

Update with a solution posted on 9'th December 2006:

Solution 1:

Log on to Windows, using a username other than that, under which this error occurs. The ser must have administrative priviledges.

Right click on "My Computer", Select Properties, Advanced Tab, User Profiles -> Settings and delete the profile that is experiencing the problem.

Logout, and login as the user that had the problem. The problem should now be gone.

This solution has a great drawback, though - the profile is deleted (duh!) This means that alll your settings for all kinds of programs are removed and you need to recreate them. For instance, VS.NET 2005 thinks it is the first time it is started the next time you start it.

Solution 2:

Microsoft stated another solution that should work, but this one I haven't tested:

  1. Ungac the Assembly
  2. Remove the Assembly from Mapper Extension Folder.
  3. Choose Items on the Toolbox and Unselect the offending items
  4. Then do a Reset Toolbox

--
eliasen

Tuesday, 05 December 2006 21:59:06 (Romance Standard Time, UTC+01:00)  #    Comments [3]  | 

Hi

A guy on the microsoft.public.biztalk.something newsgroup is having problems splitting an incoming flat file into several files. The dataformat he has is this:

HH06SGLN00084CR
31102006~06~Miss~ABD~DEF GHI ~ZZZZZ~F~31111111~~BD46A~233435~NUTRITION & FOOD SCIENCE~1~88888888~ AN ADDRESS SOMEWHERE~AB18ZZ~AAAA33333333T~04444.00~01200.00~00000.00~00000.00~F~Y~P~Y~N~N~N~
01112006~06~Miss~ASODIFN~DSFJ ~BSODIFJSDF~F~55555555~~Q190E~444444~ENGLISH & POPULAR CULTURE~1~66666666~ ANOTHER ADDRESS ~CF51NT~EEEE94857463H~01200.00~01200.00~00000.00~00000.00~F~Y~F~Y~Y~N~N~
TT000024

The first line is a header, with identifier "HH". The last line is the trailer with identifier "TT". In between are many body lines, one per line.

He would like to create schemas for the header, the body and the trailer and use them in a custom receive pipeline, using the flat file disassembler to split it up, so he gets one XML document per body line.

Unfortunately, this doesn't seem to be doable. What seems to happen is that when parsing the document, first the header schema is used. It describes a single line, and this line in the incoming file is then parsed. Then, the body schema is used for parsing the rest of the incoming document. Since the body lines don't have tag identifiers, though, it seems that BizTalk will continue to parse the document, and this includes parsing the last line, which is the trailer. BizTalk doesn't know when to stop parsing for body lines. Therefore, this error appears in the eventlog:

-- BEGIN ERROR
Source: "Flat file disassembler" Receive Port: "ReceiveFlatFile" URI: "C:\Projects\BTS 2006\NewsgroupHelp\BodyWithoutTagIdentifierFlatFile\Instances\In\*.txt" Reason: Unexpected data found while looking for:
'~'
The current definition being parsed is BodyRoot. The stream offset where the error occured is 404. The line number where the error occured is 4. The column where the error occured is 0.
-- END ERROR

Baiscally, the flat file disassembler can't find the ~ character on the last line, which isn't supposed to be there, since this line is the trailer. So BizTalk gives up and fails.

What I have come up with isn't actually pretty, but it does seem to work :-)

I have created a schema for the entire flat file. And I have created a schema for the entire flat file without the trailer. Then, I created a schema for the header, and a schema for the body. I have made heavily use of the flat file schema wizard, because there are many elements in the body lines :-)

Then, I created a map between the two main schemas, effectively removing the trailer from the input.

I also created three custom pipelines:

  1. A pipeline for receiving the complete flat file
  2. A pipeline for sending out the flat file without its trailer
  3. A pipeline for splitting the flat file without trailer into several body documents, using the header- and body schemas.

So the solution is:

Let BizTalk read in the complete flat file, and use a map on the receive (or send) port to convert it into the same structure without the trailer. Then output it to a file. Let another receive location pick the new file up, and use the pipeline with body- and header schemas to split it up into several documents.

Pitfalls are: Remember to use different combinations of rootnode and target namespaces for each schema. After copying a schema it is easy to forget to change it. Also, change the .NET typename of the schema after copying it. The compiler will remind you of that if you forget it, though :-)

I really wanted to not use a flat file for the intermediate step and use XML instead, but I couldn't get it to work. I would have to have a schema for the output and another schema for the input, which was an envelope with an "Any"-element inside it, and these two schemas would need to have the same rootnode and target namespace. So I dropped it, and stayed with the flat file, allthough I hated it :-)

My .NET project can be found here: BodyWithoutTagIdentifierFlatFile.zip (99,28 KB)

I hope this has been of some help. The conclusion basically is that it can't be done, splitting an incoming flat file up using header, body and trailer schemas, if the body doesn't have a tag identifier.

UPDATE on 5'th December 2006: Greg Forsythe has another solution to the problem, which he has written in the newsgroup. I quote:

-- BEGIN QUOTE

There is another way of doing this:
Create a document schema with an optional trailer record.
This will debatch each record, with the last document having a trailer
record. This can be removed/ignored in the first map

--  END QUOTE

I haven't tried it, but it makes sense, and why didn't I think of that?

--
eliasen

Tuesday, 05 December 2006 00:14:35 (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
Sunday, 05 November 2006

Hi

A guy on the microsoft.public.biztalk.orchestration newsgroup has asked about looping around elements inside an orchestration, and I thought I'd just write some lines about the issue here, for everybody to see in the future.

The problem is, that he has the following document structure:

<Employees>
<Employee title="mgr">
</Employee>
<Employee title="vp">
</Employee>
<Employee title="ceo">
</Employee>
</Employees>

And he wants to do something with each employee, based on what the title is. As I see it, there are two options:

  1. Loop through the Employee-elements inside the orchestration
  2. Use an envelope to split the incoming Employees-message into several Employee-messages

Suggestion 1

I have proposed the following two schemas:

 for the big message that arrives and  for the individual Employee. Note, that I have promoted "title" as a distinguished field.

I then create an orchestration, that takes an instance of the Employees schema as input, and loop around the employees. The orchestration looks like this:

It receives the incoming message, and then initializes a couple of variables. The first expression shape, named "Initialize Loop variables" contains the following three lines:

empCount = xpath(InputMessage, "count(/*[local-name()='Employees' and namespace-uri()='']/*[local-name()='Employee' and namespace-uri()=''])");
counter = 1;
counterStr = "1";

Basically, I get the number of employee-elements, and initialize the counter. The stringcounter is used to build xpath expression later, as you will see.

Then, I loop. The loop condition is "counter <= empCount" - so I want to loop as long as there are employees.

Inside the scope, I have declared a message employeeMessage, which is of the type of a single employee.

In the message assignment shape, I do this:

EmployeeMessage = xpath(InputMessage, "/*[local-name()='Employees' and namespace-uri()='']/*[local-name()='Employee' and namespace-uri()=''][" + counterStr + "]");

It takes the employee from the big incoming message that corresponds to the counter and assigns it to the message that is to be constructed.

In the next expression shape, I just write the content of the distinguished field "title" of the employee to the eventlog.

And in the final expression shape, I increment the counter variables:

counter = counter + 1;
counterStr = System.Convert.ToString(counter);

So by doing this, I am looping over the employees inside the employees-message, and I have access to all the values inside the single employee. I didn't have to have schema number 2, describing a single employee, I could have just used xpath all the way down, or maybe declare an XmlNode variable to hold the employee-element instead. But I like this solution better.

Another option I have now is that I can add a decision shape, and based on the title value, I can call different orchestrations, that will handle a specific employee-type. Or perhaps I could just send the employee message to a direct-bound send port and have other orchestrations subscribe to the employee message type. This would require the title to be a promoted property instead of a distinguished field, though, in order to route on it.

Suggestion 2

I propose using an XML Envelope to split the incoming file into several employee-messages and let the orchestration handle them individually.

To do this, I have created two schemas:

 for the envelope and  for the employee. Note: I have changed the names of the root nodes in both schemas. Naturally, in real life you wouldn't do this. The only reason I did this is to be able to have both my examples deployed at the same time. If I hadn't done it, I would have had multiple schemas deployed with the same combination of target namespace and root node, which we all know is BAD. On the schema for the envelope, I have clicked on the "<Schema>"-node and in the properties windows, I have set "Envelope" to "Yes". Then, I clicked on the "EmployeesEnvelope"-node and in the properties window, I set the "Body XPath" property to point at the "EmployeesEnvelope"-element.

Then, I created an orchestration, that takes an employee as the input - not the employees-type, but the single employee. It looks like this:

So here I have a much smaller, simpler, and faster orchestration than the one from suggestion 1.

After the solution is deployed, I create a receive location, and remember to use the default XMLReceive pipeline. The disassembler stage will look at the incoming message, determine the message type, see it is an envelope, split the message into smaller messages, and publish them individually with their own message type.

If I need different orchestrations depending on the value of the title attribute, I can promote it to a promoted property instead of a distinguished field, and add it to a filter on the receive shape in each orchestration.

Examples:

I have my two samples here: LoopAroundEmployee.zip (68,66 KB) and here: LoopAroundEmployeeEnvelope.zip (48,64 KB)

I hope this has been useful for someone. If you have any questions, just ask.

--

eliasen

Sunday, 05 November 2006 14:04:11 (Romance Standard Time, UTC+01:00)  #    Comments [13]  | 
Monday, 23 October 2006
Hi!

Recently a couple of different question askers at the microsoft.public.biztalk.something newsgroups have been asking questions about how to expose a BizTalk orchestration that takes an System.Xml.XmlDocument as input and also returnes a System.Xml.XmlDocument.

Basically, it is straight forward:
  1. You define two messages in your orchestration as being of the type "System.Xml.XmlDocument"
  2. You add a receive shape that accepts one of the messages
  3. You add a construct shape that constructs the return message
  4. You add a send shape that sends the output message
  5. You add a public request-response port and connect the receive- and send shapes to this port.
  6. You publish the orchestration using the Web Services Publishing Wizard.
A couple of issues:
  1. If you are deploying the web service to the same web site as your Windows SharePoint Services is running on, you have to exclude the path to the new web service, so that WSS wont try to take over the calls to the web service. This is done like this:
    • Administrative Tools
    • SharePoint Central Administration
    • Configure Virtual Server Settings
    • Choose the web site you have extended with WSS and to which you now want to deploy a web service
    • Define Managed Paths
    • Under "Add new Path", add your path and click "excluded path" and "OK"
  2. The virtual directory that is created by the wizard must run under an application pool that is running under a user that is a member of the "BizTalk Isolated Host Users". Otherwise you will get a SOAP exception when trying to call the web service.
And another thing that someone had dificulty with: When writing a small application to test the published web service, he got an error that said:
Compilation error:

            Error    1    The best overloaded method match for
'UNTTest.ws.UntypedWebService_Orchestration_That_Receives_and_Sends_XML_InputOutputPort.SendXMLAndGetAnswer(ref
System.Xml.XmlNode)' has some invalid arguments    C:\Documents and
Settings\simon.brooks\My Documents\UNTTest\Form1.cs    25    13    UNTTest

            Error    2    Argument '1': cannot convert from 'ref
System.Xml.XmlDocument' to 'ref System.Xml.XmlNode'    C:\Documents and
Settings\simon.brooks\My Documents\UNTTest\Form1.cs    25    41    UNTTest

Basically, the web service doesn't take an XmlDocument as a parameter, as one would have expected, but an XmlNode instead.

So after creating an XmlDocument to send to the web service, define an XmlNode object, and set it to point to the DocumentElement property of the XmlDcoument, and send that instead.
Like this:
            XmlDocument xmldoc = new XmlDocument();
            xmldoc.LoadXml("<rootnode><element1>value1</element1></rootnode>");
            XmlNode node = xmldoc.DocumentElement;
            WebserviceReference ws = new WebserviceReference();
            ws.Operation_1(ref node);

I hope this helps.

My sampel BizTalk project can be found here: UntypedWebService.zip (102.58 KB)

Should you have any comments, feel free to post them.

--
eliasen
Monday, 23 October 2006 00:01:48 (Romance Daylight Time, UTC+02:00)  #    Comments [0]  | 
Friday, 13 October 2006

Hi

Every now and then, I come across the need of adding a node to the output of a BizTalk map.

Now, if I just want to add some node which isn't dependent on the input, I can just use a custom scripting functoid which is an XSLT template that just craeted the node for me, like this:

Use the "Inline XSLT Call Template" instead, if you need parameters to your XSLT.

BUT, sometimes I need to add a node to a list of existing nodes. One example of this I came across was the need to have a log inside the XML structure that was updated every time BizTalk touched the document. So there would be a structure inside the XML like this:

<TheLog>
<LogEntry>This is the first log entry and it was added by Jan</LogEntry>
<LogEntry>This is the second entry and it was added by BizTalk</LogEntry>
</TheLog>

So BizTalk needed to add a line to TheLog when BizTalk mapped the document.

Another example is a guy on the microsoft.public.biztalk.general newsgroup that needs to add an OrderItem to an existing list of OrderItems.

To do this, I have only found one solution, which is a custom xslt script that does the whole thing.

My example input schema:

My example output schema:

In both schemas, the "Order"-element can occur multiple times.

The map looks like this:

Basically, just one scripting functoid. Note that no links go from the source document. The scripting functoid is a "Inline XSLT" type, and the source is this:

<xsl:for-each select="//Orders/Order">
<xsl:element name="Order">
<xsl:element name="Ordernumber"><xsl:value-of select="Ordernumber" /></xsl:element>
<xsl:element name="OrderAmount"><xsl:value-of select="Amount" /></xsl:element>
</xsl:element>
</xsl:for-each>

<xsl:element name="Order">
    <xsl:element name="Ordernumber">400</xsl:element>
    <xsl:element name="OrderAmount">40</xsl:element>
</xsl:element>

Basically, the for-each creates line in the output according to the input XML document. And the xsl:element after the for-each creates the new node.

You can find my BizTalk 2006 project here: AddingANode.zip (16,89 KB) - it should work with BizTalk 2004 as well.

I hope this has helped someone. Comments are welcome.

--

eliasen

Friday, 13 October 2006 23:26:57 (Romance Daylight Time, UTC+02:00)  #    Comments [3]  | 

Hi

A user in the microsoft.public.biztalk.general newsgroup has a challenge he'd like solved.

Basically, he has this structure:

<Root>
  <Employee>
     <EmployeeID>1</EmployeeID>
     <JobsAssigned>10</JobsAssigned>
  </Employee>
  <Employee>
     <EmployeeID>2</EmployeeID>
     <JobsAssigned>5</JobsAssigned>
  </Employee>
  <Employee>
     <EmployeeID>3</EmployeeID>
     <JobsAssigned>8</JobsAssigned>
  </Employee>
</Root>

And he needs to find the EmployeeID of the employee that has the least jobs assigned to him/her. In this case, he needs the value "2".

This is a case, where the "Cumulative Minimum" functoid can be used.

So, I have this input schema:

and I have this fictitious output schema:

To do the task, I use this map:

Basically, I just map the fields, and then I make sure the "MinValues"-record is only created when the JobsAssigned value is equal to the cumulative minimum of the JobsAssigned.

The "Cumulative Minimum" functoid will return the smallest number of all the numbers it is given as input.

So, given the above mentioned input instance, the output of this map will be:

<ns0:OutputRoot xmlns:ns0="http://CumulativeMinimum.OutputSchema">
<MinValues>
  <Employee>2</Employee>
  <JobsAssigned>5</JobsAssigned> 
</MinValues>
</ns0:OutputRoot>

which, luckily, was what we needed :-)

Given an instance with more than one Employee hacing the same number of JobsAssigned and if this number is the minimum, the map will actually create a node for each.

As I don't know more of what the question-asker wants, I will let this be enough for now. Should it not be ok to return more than one EmployeeID in the output, the map will need to be changed.

I hope this has helped someone.

You can find a BizTalk 2006 project here: CumulativeMinimum.zip (4,51 KB)

The same will work for BizTalk 2004 - I just haven't been bothered creating the example. Let me know if you need it.

--

eliasen

Friday, 13 October 2006 22:23:30 (Romance Daylight Time, UTC+02:00)  #    Comments [0]  | 
Sunday, 24 September 2006

Hi

A colleague of mine, Morten la Cour Thomsen, who is "MCTS: BizTalk Server 2004" AND "MCTS: BizTalk Server 2006" discovered something strange the other day. In fact, it is so strange, that I thought I'd share it here on my blog.

Morten was on a project, where he had taken over another persons BizTalk solution. Unfortunately for Morten, the other guy had decided to put all artefacts into one single assembly. That's right - all schemas, all maps, pipelines, orchestrations.. the works! Just one big assembly.

This turned out to be quite a problem for the company that had this solution, since versioning any single artefact meant versioning the whole thing. That is also why they until now didn't version anything. Should something need to be changed in the big assembly, four steps were performed:

  1. Stop all receive locations
  2. Make the change in the artefact that needed changing
  3. Wait until all long running transactions have stopped
  4. Deploy the new assembly on top of the old one, leaving all versionnumbers the same

Mortens job was to create a better architecture, since it really wasn't ok with the customer to have to stop receiving new messages until all orchestrations had stopped.

One of the steps Morten came across was that he actually at some point needed to call an orchestration that was inside this big assembly. The orchestration that Morten needed to call was being called from other orchestrations inside the assembly, so it was ready to be called (no activate receive shape, etc.). The only problem for Morten was, that the orchestration, off course, was internal to the assembly. Morten could reference the assembly, but he couldn't call the orchestration from within an "Call Orchestration"-shape.

But that's when Morten tried something that I would never have thought of trying: He had the source code for the big assembly. And he had the keyfile that had been used to sign it. So he changed the orchestration to be public, recompiled the big assembly, referenced the newly compiled assembly, added the former internal orchestration to his "Call Orchestration"-shape and compiled his own assembly.

He now deployed his own assembly, but left the old big assembly in place.

Now he had the old big assembly, which still had the internal orchestration inside it. And he had another deployed assembly, which was compiled against the source code with a public orchestration. The big assembly was never redeployed!

But it worked! Mortens orchestration is now calling the internal orchestration of the other assembly, simply because it was compiled against a public orchestration and the signature of the deployed big assembly matches the signature of his newly compiled big assembly.

Very weird, indeed. And it probably isn't meant to do that...

I have a sample solution for BizTalk 2004 you can look at right here: InternalOrchestration.zip (132 KB)

And two sample projects for BizTalk 2006 right here: Calling Internal Orchestration.zip (146,46 KB)

In both cases, the code reflects the internal orchestration AFTER it has been set to public. What you want to do is to

  1. Set the type to "internal" on the called internal orchestration.
  2. Build and deploy the assembly with the internal orchestration.
  3. Test it to see that it works.
  4. Try to build the other assembly. It will fail because of the internal orchestration.
  5. Set the type to "public" on the called orchestration.
  6. Build and deploy the second assembly WITHOUT redeploying the first assembly.
  7. Test it to make sure it works.

So, basically, now you have a way of calling an internal orchestration, as long as you have the source code for it and the key to sign it.

Hope this is useful for someone.

--

eliasen

Sunday, 24 September 2006 23:07:52 (Romance Daylight Time, UTC+02:00)  #    Comments [2]  | 
Saturday, 16 September 2006

Hi

A guy (I think it is a guy, anyways :-) ) on the microsoft.public.biztalk.orchestration newsgroup has a problem with this issue. And since I had the issue myself a long time ago, and always wanted to write a quick blog entry about it, this seemed like a perfect time for it :-)

A quick note: This issue appears on both BizTalk 2004 and BizTalk 2006.

So basically, the problem is: When compiling a BizTalk project, you get the "'projectname.orchestrationname': cannot resolve imported 'service'" error. This occurs when you are compiling a project that has an orchestration inside it, that calls another orchestration in another project that again calls an orchestration in a third project. Confused? I bet! I will give you details, screenshots and explanations in just a few lines.

The quick answer is: The project you are trying to compile must reference the third project.

BUT, to the long answer:

I have created a solution with three projects:

  • ProjectA with ABCSchema.xsd and OrchestrationA.odx
    • Orchestration A does this
      • Receive a message of type ABCSchema.xsd
      • Initialize a string variable to receive the value from a distinguished field in ABCSchema
      • Write the value to the eventlog
      • Call OrchestrationB
  • ProjectB with OrchestrationB.odx
    • Orchestration B does this:
      • Receive the string parameter from OrchestrationA
      • Write the value to the eventlog
      • Call OrchestrationC
  • ProjectC with OrchestrationC.odx
    • Orchestration C does this:
      • Receive the string parameter from OrchestrationB
      • Write the value to the eventlog

Screenshots:

The (very small) schema:

OrchestrationA:

OrchestrationB:

OrchestrationC:

No hokus pokus at all!

In order to call OrchestrationC from OrchestrationB, I added a reference to ProjectC from ProjectB. Both ProjectB and ProjectC compile just fine.

In order to call OrchestrationB from OrchestrationA, I add a reference to ProjectB from ProjectA, but ProjectA wont compile. I get this error:

The famous "cannot resolve imported 'service'" error.

BUT, referencing ProjectC from ProjectA solves this issue, and I can compile just fine.

Actually, the error description indicates it. When compiling ProjectA, it can't import the "ProjectC.OrchestrationC" service. But often, you are maybe compiling the entire solution, and you just see that the file in quesion is projectb.dll. But the error just states that ProjectA cannot import ProjectC.OrchestrationC, which it needs to according to projectb.dll.

Should anyone think that it is really silly that ProjectA needs to reference a dll that another dll references and that this breaks all nice architectures, I would agree. If someone gives me a set of 20 dll's that make up a nice solution he/she has made, and I need to call an orchestration in one of them, then I also need to reference all the dll's that this one dll references, assuming there are internal "Call Orchestration"s between these dll's. I will need to know how these dll's reference eachother in order to reference one of them. Really silly, indeed.

I don't know why they have made it like this, but they have.

I hope this post helps others.

Should you have comments, please don't hesitate... My three projects can be found here: A_calls_B_calls_C.zip (137,08 KB)

--

eliasen

Saturday, 16 September 2006 14:00:22 (Romance Daylight Time, UTC+02:00)  #    Comments [4]  | 
Thursday, 07 September 2006

Hi

Today, I had the pleasure of helping a fellow BizTalk guy on the microsoft.public.biztalk.general newsgroup. He has a schema which showed up with lots of root elements in the schema editor. He wanted to fix that, but how?

The "problem" is well known if you for instance use schemas created by InfoPath 2003. They will look something like this:

There are lots of elements that appear to be the root node. Now, I know that "myFields" is the actual root node that I want to use, but it sure isn't easy to see. What I want shown is this:

And if I create an instance of this schema, I will get this:

<ns0:CustomerName xmlns:ns0="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-09-07T18:24:45">CustomerName_0</ns0:CustomerName>

But that isn't what I wanted. I wanted this:

<ns0:myFields ns1:anyAttr="anyAttrContents" xmlns:ns1="http://www.w3.org/XML/1998/namespace" xmlns:ns0="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-09-07T18:24:45">
  <ns0:CustomerName>CustomerName_0</ns0:CustomerName>
  <ns0:OrderLines>
    <ns0:OrderLine ns0:ID="ID">
      <ns0:Description>Description_0</ns0:Description>
      <ns0:Quantity>100</ns0:Quantity>
      <ns0:ItemID>100</ns0:ItemID>
    </ns0:OrderLine>
    <ns0:OrderLine ns0:ID="ID">
      <ns0:Description>Description_0</ns0:Description>
      <ns0:Quantity>100</ns0:Quantity>
      <ns0:ItemID>100</ns0:ItemID>
    </ns0:OrderLine>
    <ns0:OrderLine ns0:ID="ID">
      <ns0:Description>Description_0</ns0:Description>
      <ns0:Quantity>100</ns0:Quantity>
      <ns0:ItemID>100</ns0:ItemID>
    </ns0:OrderLine>
  </ns0:OrderLines>
</ns0:myFields>

So, how do I achive this?

Well, the answer is quite simple, really... although it does involve manually editing the schema file (the .xsd file).

What you want to do is add a BizTalk specific annotation to the schema to let BizTalk Schema Editor know which node is to be treated as the root node.

So my schema looked like this:

<xsd:schema xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-09-07T18:24:45" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-09-07T18:24:45" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:attribute name="ID" type="my:requiredString" />
  <xsd:element name="myFields">
... and a whole bunch more

and I edited it and now it looks like this:

<xsd:schema xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-09-07T18:24:45" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-09-07T18:24:45" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:annotation>
    <xsd:appinfo>
      <b:schemaInfo is_envelope="no" version="1.0" root_reference="myFields" displayroot_reference="myFields" xmlns:b="http://schemas.microsoft.com/BizTalk/2003">
      </b:schemaInfo>
    </xsd:appinfo>
  </xsd:annotation>
  <xsd:attribute name="ID" type="my:requiredString" />
  <xsd:element name="myFields">


So under annotations under appinfo, I added a BizTalk specific schemaInfo element, which describes which node to treat as the root node.

Clever and simple. But remember that you need to do this editing every time a new version of the schema needs to be used.

You can find my schemas here:

myschema.zip (,78 KB)

and here:

correctedmyschema.zip (,88 KB)

 

I hope this helps someone.

--

eliasen

Thursday, 07 September 2006 23:17:51 (Romance Daylight Time, UTC+02:00)  #    Comments [2]  | 
Tuesday, 22 August 2006

Hi

Today I ran into a problem configuring the WSS Adapter for BizTalk 2006. In the configuration wizard I just couldn't choose a web site for the adapter that would satisfy the configuration wizard. I got this error:

And I was pretty tired of it :-) Especially because I was sure WSS was installed on this web site, the web site was extended with WSS and everything should have been ok.

Anyway, some searching on the net gave me a hint as to what was going on. I found an article on topxml.com that helped me. In short, I had installed Windows Sharepoint Services on a web site I had created for this purpose, but I had forgotten to make sure the web site was running ASP.NET 2.0 before installing WSS. This made WSS run on .NET 1.1 and BizTalk 2006 has a requirement that it must run under .NET 2.0.

So in order to register ASP.NET 2.0 with IIS and upgrade my WSS installation to use .NET 2.0, I ran the following two commands:

"c:\windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe" -i

"c:\program files\common files\Microsoft Shared\web server extensions\60\BIN\STSADM.exe" -o upgrade -url http://localhost:4242 -forceupgrade

The :4242 is because my WSS web site is configured to run on this port.

After this, there were no problems, and I could then configure the WSS adapter. I didn't need to restart the configuration wizard - I just had to select the default web site and then select my WSS Site again.

Hope this helpes someone. Should you have comments, please go ahead.

--

eliasen

Tuesday, 22 August 2006 16:37:56 (Romance Daylight Time, UTC+02:00)  #    Comments [3]  | 

Theme design by Jelle Druyts