schema validation in biztalk 2010

14
www.briztalk.or g Schema Validation in BizTalk Validating Messages in a Receive Pipeline Dan Toomey MCPD, MCTS, MCT Brisbane BizTalk User Group Leader http:// mindovermessaging.com/

Upload: daniel-toomey

Post on 14-Dec-2014

919 views

Category:

Technology


2 download

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

Page 1: 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/

Page 2: Schema Validation in BizTalk 2010

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

Page 3: Schema Validation in BizTalk 2010

www.briztalk.org

Using the XmlReceive Pipeline• Set the following pipeline instance

properties on the receive port:

Page 4: Schema Validation in BizTalk 2010

www.briztalk.org

Using the XmlReceive Pipeline• Set the following pipeline instance

properties on the receive port:• DocumentSpecNames

Page 5: Schema Validation in BizTalk 2010

www.briztalk.org

Using the XmlReceive Pipeline• Set the following pipeline instance

properties on the receive port:• DocumentSpecNames• ValidateDocument

Page 6: Schema Validation in BizTalk 2010

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

Page 7: Schema Validation in BizTalk 2010

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

Page 8: Schema Validation in BizTalk 2010

www.briztalk.org

Specifying Document Spec Names• Source the FQN from the schema

properties in the BizTalk AdministrationConsole

Page 9: Schema Validation in BizTalk 2010

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

Page 10: Schema Validation in BizTalk 2010

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/

Page 11: Schema Validation in BizTalk 2010

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

Page 12: Schema Validation in BizTalk 2010

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

Page 13: Schema Validation in BizTalk 2010

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

Page 14: Schema Validation in BizTalk 2010

www.briztalk.org

Brisbane BizTalk User Group

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