Schema Validation in BizTalk 2010

Post on 14-Dec-2014

919 views 2 download

Tags:

description

XMLschemas are not validated by default in BizTalk receive pipelines. However, you can configure OOTB components to do so. This slide deck shows two different ways you can achieve this, discussing the pros & cons of each method.

Transcript of Schema Validation in BizTalk 2010

www.briztalk.org

Schema Validation

in BizTalk 2010

Validating Messages in a Receive Pipeline

Dan ToomeyMCPD, MCTS, MCT

Brisbane BizTalk User Group Leaderhttp://mindovermessaging.com/

www.briztalk.org

XML Validation in BizTalk• Pipeline schema validation is not enabled

by default• XmlReceive pipeline only validates Message

Type, not content• BTS.MessageType == <targetNamespace>#<rootNodeName>

• Document must be well-formed XML

• Two ways to validate in a receive pipeline:• Use XmlReceive pipeline and set instance

properties to validate document• Create a custom pipeline and add an

XmlValidator component

www.briztalk.org

Using the XmlReceive Pipeline• Set the following pipeline instance

properties on the receive port:

www.briztalk.org

Using the XmlReceive Pipeline• Set the following pipeline instance

properties on the receive port:• DocumentSpecNames

www.briztalk.org

Using the XmlReceive Pipeline• Set the following pipeline instance

properties on the receive port:• DocumentSpecNames• ValidateDocument

www.briztalk.org

Specifying Document Spec Names• Each schema must be listed as a Fully

Qualified Name (FQN)

BrizTalk.SchemaValidation.Request1,BrizTalk.SchemaValidation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=917e3a9ed61ea472

www.briztalk.org

Specifying Document Spec Names• Each schema must be listed as a Fully

Qualified Name (FQN)• Use a pipe (“|”) character to delimit

multiple schemasBrizTalk.SchemaValidation.Request1,BrizTalk.SchemaValidation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=917e3a9ed61ea472 | BrizTalk.SchemaValidation.Request2,BrizTalk.SchemaValidation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=917e3a9ed61ea472

www.briztalk.org

Specifying Document Spec Names• Source the FQN from the schema

properties in the BizTalk AdministrationConsole

www.briztalk.org

Using the XmlReceive Pipeline

PROS:• No custom

components required• Can be configured by

an administrator

CONS:• Getting

DocumentSpecNames correct can be tricky

• Schema validation function is hidden

• Problems if two or more schemas share the same target namespace

www.briztalk.org

Using the XmlReceive Pipeline

PROS:• No custom

components required• Can be configured by

an administrator

CONS:• Getting

DocumentSpecNames correct can be tricky

• Schema validation function is hidden

• Problems if two or more schemas share the same target namespace

http://mindovermessaging.com/2013/07/29/duplicate-namespace-issue-with-schema-validation-in-pipeline-components/

www.briztalk.org

Using a Custom Pipeline• Create a new receive pipeline using the

Pipeline Designer • Drag an XmlDisassembler component to

the Disassemble stage• Drag an XmlValidator component to the

Validate stage• Build & deploy the solution• Select the custom pipeline in the receive

location

www.briztalk.org

Using a Custom Pipeline

PROS:• Don’t have to specify

fully-qualified names of the schemas

• Dedicated pipeline makes validation feature obvious

• Better handling of multiple schemas sharing same target namespace

CONS:• Requires component

development & deployment

www.briztalk.org

Summary• Schema validation is an optional

pipeline feature that must be explicitly enabled• Two methods:• Using instance properties on the

XmlReceive pipeline• Creating a custom pipeline to host an

XmlValidator component

www.briztalk.org

Brisbane BizTalk User Group

https://www.facebook.com/BrisbaneBizTalkUserGroup@briztalk