Tue, Jan 26 2010 3:01 PM Vincent Scheel

BizTalk: Two versions of a schema side by side and using them in orchestrations

Schema versioning in BizTalk is always a difficult thing to do. When small changes are done on a schema (for a new solution), but this schema is already in use by a solution which is currently in production, you have to be very careful.

BizTalk defines the schema type of a message by the combination: targetnamespace#rootnode to make a MessageType unique (for example: http://mynamespace.com/#MyRootNode). This will define the type of the message and is also used in subscriptions.

If you deploy two schemas with the same MessageType in different assemblies and you try to receive an instance with this MessageType, BizTalk will give you a routing failure telling you it is not able to determine the exact MessageType (the MessageType is found multiple times in the database).

Suppose you have schema X in DLL Y version 1.0.0.0 and you fix a bug (change a nodes’ default value for example) for a new version of a solution, and increase DLL Ys version to 1.0.1.0. If you deploy this new version of DLL Y side by side with an old version, BizTalk is smart enough to see that it is a newer version and will use this newer version of schema X for received messages with this MessageType. No routing failure! This works excellent in a message-only scenario.

So far, so good. If you use the MessageType in a receive shape in an orchestration, this orchestration has a subscription on this MessageType. That is what you expect and see in the ‘View subscriptions’ panel of the Administration Console:

As you can see, there is no assembly version shown here! But since the orchestration is developed with a certain version of a schema, the actual orchestration code does expect a certain version of the schema for the received instance. Meaning that the subscription will work, but the orchestration can’t use the message, because it was typed as the 1.0.1.0 version and the orchestrations expects the 1.0.0.0 version. This will generate an error in the Administration Console as follows:

Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'VersioningTestBTProjOrchv1000.BizTalk_Orchestrationv0100(e0f5b7e2-7e31-550e-1022-af218b9002bc)'.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: 8b5f3dd1-42b6-4bb0-b7a4-ecd87ced4813
Shape name: Receive_1
ShapeId: 4747131a-9c71-46e6-a99a-319053adcfe7
Exception thrown from: segment 1, progress 3
Inner exception: Received unexpected message type 'VersioningTestProject.Schemas.SchemaIncoming_v0100, VersioningTestProject, Version=1.0.1.0, Culture=neutral, PublicKeyToken=b5c9ca1ed57903d0' does not match expected type 'VersioningTestProject.Schemas.SchemaIncoming_v0100, VersioningTestProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b5c9ca1ed57903d0'.
       
Exception type: UnexpectedMessageTypeException
Source: Microsoft.XLANGs.Engine

BizTalk does not automatically know for which orchestration to use the old version and for which the new version. You could say that BizTalk should be smart enough to see that an orchestration obviously expects the older version and cast the message to the correct version before feeding it to the orchestration. But this might lead to unforeseen behaviour and probably is not done this way to avoid errors.

There is an easy fix for this problem. You probably have a different receive location for the newer version of the schema, since the old version is running side by side. You can tell BizTalk to cast a received message to a certain version of the schema. This way it will not automatically cast the message to the latest version, but it will cast it to your specified version. This can be done on the XMLReceive pipeline as follows:

1 – Open the XMLReceive pipeline properties:

2 – Enter the fully qualified name of the type you are going to receive as the DocumentSpecNames property.

The name should look like: ‘FullSchemaTypeName, FullAssemblyName’ (for example: VersioningTestProject.Schemas.SchemaIncoming_v0100, VersioningTestProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b5c9ca1ed57903d0). This information can be found by double clicking the deployed schema in the BizTalk Administration Console.

Voila, now BizTalk will cast your message to the specified version and your old orchestration will run just fine

Of course this only works if you have separate receive locations for all versions and you can use the XMLReceive pipeline (or any other pipeline containing the XML dissambler component), but it might just help you out. (Only tested in BizTalk Server 2006 R2)

Filed under: , , , , , ,

# re: BizTalk: Two versions of a schema side by side and using them in orchestrations

Wednesday, June 16, 2010 10:36 PM by Amit

hi,

i have one application withy version 1, i have modified application and created version 2. both version are calling same web service but different methods in it. i deployed both versions. version 2 is working fine but when version 1 orchestration pick up the message and send to the web service and getting response message it throws error message saying that /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;} Microsoft.XLANGs.Core.UnexpectedMessageTypeException: Received unexpected message type.

the total error message is

Microsoft.XLANGs.Core.UnexpectedMessageTypeException: Received unexpected message type 'LSC.FundingData.Import.DLF.Orchestrations.SSoADataImportService.Reference+AdultSSoAData, LSC.FundingData.Import.DLF.Orchestrations, Version=2.0.0.0, Culture=neutral, PublicKeyToken=82632b94b069a919' does not match expected type 'LSC.FundingData.Import.DLF.Orchestrations.SSoADataImportService.Reference+AdultSSoAData, LSC.FundingData.Import.DLF.Orchestrations, Version=1.0.1.0, Culture=neutral, PublicKeyToken=82632b94b069a919'.

  at Microsoft.XLANGs.Core.XMessage._verifyPublisherSchema()   at Microsoft.XLANGs.Core.XMessage.FetchProperties()   at Microsoft.BizTalk.XLANGs.BTXEngine.BTXPortBase.ReceiveMessage(Int32 iOperation, Envelope env, XLANGMessage msg, Correlation[] initCorrelations, Context cxt, Segment s)   at LSC.FundingData.Import.DLF.Orchestrations.DLFAdultFundingDataImport.segment6(StopConditions stopOn)

  at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)

Microsoft.XLANGs.Core.UnexpectedMessageTypeExceptionScoped@

DLFAdultFundingDataImport.??__scope34

DLFAdultFundingDataImport.??__scope33

DLFAdultFundingDataImport.DLFAdultFundingDataImport

20d2d333-4794-4976-a37d-21544dfe0587

as per my understanding when orchestration sends message to webservice and getting reply back from web service there are two subscriber for response one is version 1 orch adn second is version 2 orch and by default it is picking up by the second version orch.

if that is right can you help me to solve this?

# re: BizTalk: Two versions of a schema side by side and using them in orchestrations

Friday, June 18, 2010 9:27 AM by Vincent Scheel

Hi Amit,

What you describe is explained by the fact that the receive pipeline automaticly casts the received message to the latest version of the schema. In your case the solution mentioned in my article is not going to work, since you also receive messages of the new type on the same port. Setting the old schema as the DocumentSpecNames property would cause to cast all received messages to the old version (including messages of the new type).

I would suggest creating two sollicit-response ports. One with the DocumentSpecNames property on the receive pipeline set to your old schema version and one with the new version of the schema. You should bind the old version of the orchestration to the send port with the old schema set and the new version of the orchestration to the send port with the new schema set in de receive pipeline.

Hope this helps!

Kind regards,

Vincent Scheel

IT-grator

# re: BizTalk: Two versions of a schema side by side and using them in orchestrations

Thursday, October 27, 2011 8:21 PM by Siraj

Hi,

Is it possible to use a single biz talk map to handel XML's of different versions?

# re: BizTalk: Two versions of a schema side by side and using them in orchestrations

Friday, October 28, 2011 3:52 AM by ice maker machine

Wow! This blog looks exactly like my old one! It's on a completely different topic but it has pretty much the same page layout and design. Superb choice of colors!

# re: BizTalk: Two versions of a schema side by side and using them in orchestrations

Friday, October 28, 2011 10:38 AM by Vincent Scheel

Dear Siraj,

The situation you suggested was one I had not tested yet. This morning I have tried this in the following way:

Created a project with:

Two schema's in a schema project: input and output - assembly version 1.0.0.0. Both schema's had two child elements: NodeA and NodeB.

One mapping in a map project (version 1.0.0.0): map from schema input to schema output.

I deployed the above artifacts and created a standard File receive to File send test setup, with the map on the ReceivePort.

Then I edited the schema's, adding NodeC and changed the assembly version to 1.0.1.0. I deployed this new schema assembly (note: I did not deploy a new version of the Map project!).

When I removed the map from the receive port and stopped the send port, I could see the message was casted to the new assembly version: 1.0.1.0 by the XmlDisasembler on the ReceivePort.

Then I readded the map to the receive port and tried it again. The outgoing message on the send port was of the OLD assembly version: 1.0.0.0. The map did execute as before.

So it seems that the map does not check the assembly version of an input message (which makes sense, because there is no reference to a assembly version in the entire .btm map file). However, because the assembly of the map references the old version of the schema dll, it does create an output message of the old version.

Hopefully that answered your question! Thank you for visiting my blog!

Regards,

Vincent Scheel

IT-grator

# re: BizTalk: Two versions of a schema side by side and using them in orchestrations

Friday, November 09, 2012 12:44 PM by Darren

Hi Vincent i have the following issue and im wondering about the best way to resolve this. Basically i have a biztalk application installed and this application has two receive locations, two receive ports and two send ports.

One set of ports are for live and one set of ports are for pre-production

The problem is they both run off the same underlying schemas and maps.

I have had to update the schemas and maps to add additional elements and my issue is they want to test this in pre-prodcution but obviously if i import the new dll's the live application will also pick these up.

What is the best solution to keep the live application still up and running pointing to the old dll's(schemas and maps) and allow the users to test the new pre-production version on the new version of dll's (maps and schemas).

Thanks

# re: BizTalk: Two versions of a schema side by side and using them in orchestrations

Monday, February 18, 2013 12:49 PM by Vincent Scheel

Hi Darren,

My apologies for the late reaction. To solve your problem you would use the solution in the blogpost on the OLD receive pipelines. By doing so, the new ports will cast to the new schema's and the old ports will be forced to use the old version.

Good luck!

Kind regards,

Vincent Scheel

IT-grator

# re: BizTalk: Two versions of a schema side by side and using them in orchestrations

Wednesday, February 20, 2013 2:12 PM by Carsten

Hi Vincent,

Thanks - this helped me.

Just thought i'd mention - I recently had this problem and your solution initialy did not work for me. I got an error with - "There was a failure executing the response(receive) pipeline ... No Disassemble stage components can recognize the data"

As it turned out the problem was that I had two root elements in my schema - and I hadn't specified which one I wanted in "DocumentSpecNames". I had a xxxRequest and xxxResponse element. So I had to add +xxxResponse to get the type name from the Schema name. That may be elementary for others, but it frustrated me for an hour or so...

Regards

Carsten

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Please add 4 and 8 and type the answer here: