biz talk 2

Upload: hari-mohan

Post on 10-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 Biz Talk 2

    1/35

    Copyright 2007 Sapient Corporation 1

    Introduction To BizTalk Server 2006

    BizTalk Server

  • 8/8/2019 Biz Talk 2

    2/35

    Copyright 2007 Sapient Corporation 2

    What is BizTalk

    Xml Schemas

    BizTalk ComponentsArchitecture Overview

    Adapters

    PortsReceive PortsSend Ports

    PipeLines

    ReceviePipeLine

    SendPipeLine

    Stages

    Messages

    Messages Delivery Patterns

    Subscriptions

    Message Box

    Demo

    Mappings

    Functoids

    How to use Functoids

    Business Process

    OrchestrationShapes / Activity

    A Simple Orchestration.

    AGENDA

  • 8/8/2019 Biz Talk 2

    3/35

    Copyright 2007 Sapient Corporation 3

    What is a BizTalk Server

    "It's a messaging system for enterprise architecture." "BizTalk allows you to connect different entities to one central location."

    It allows you to Integrate Various Applications Through Adapters.

    "It gives you a method of processing live messages.

  • 8/8/2019 Biz Talk 2

    4/35

    Copyright 2007 Sapient Corporation 4

    Xml Schema

    XML Schema is a World Wide Web Consortium (W3C) standard for defining the

    structure and content of XML documents. In short, this means that you can define howan XML document should look and what types it should conform to; it is a form of datacontract.

    BizTalk is driven by messages, which, in most cases, are based on an XML schema thatmust be deployed to BizTalk.

    This schema defines an element called Person that contains a complex type, which, inits simplest form, is a collection of subelements (like a class in object-orientedrogramming). Two further elements with differing data types have been defined withinthis complex type.

  • 8/8/2019 Biz Talk 2

    5/35

    Copyright 2007 Sapient Corporation 5

    Xml Schema Continued

    The following is the XML document that conforms to this schema:

    Lucy

    5

    Defining the schema in this way enables you to enforce how you expect

    data to be encoded or represented. This schema can be given to anyconsumers of your application to ensure that they respect this contract andit enables them to communicate with you easily.

    Creating BizTalk Schemas

  • 8/8/2019 Biz Talk 2

    6/35

    Copyright 2007 Sapient Corporation 6

    BizTalk Key Components

  • 8/8/2019 Biz Talk 2

    7/35

    Copyright 2007 Sapient Corporation 7

    Architecture Overview

  • 8/8/2019 Biz Talk 2

    8/35

    Copyright 2007 Sapient Corporation 8

    Messages

    Messages are the lifeblood of every BizTalk solution.

    If you can save it, send it, or serialize it, then it can be a message that isusable to the BizTalk system.

  • 8/8/2019 Biz Talk 2

    9/35

    Copyright 2007 Sapient Corporation 9

    Message Delivery Patterns

    Scatter-gatherPrice Bidding Example.

    Request-reply

    HL7 Messaging Example.

    Publish-subscribe

  • 8/8/2019 Biz Talk 2

    10/35

    Copyright 2007 Sapient Corporation 10

    Adapters

    Adapters provide connectivity for BizTalk to and from the outside world.

    Adapters work with a transport and have no underlying knowledge of the data that will be sent orreceived. They receive a byte stream from the wire and feed the BizTalk engine.

    In the receive case, the adapter is responsible for listening or polling for data and wrapping thatdata in a BizTalk message.

    In the case of listening, it may listen on a endpoint (or URL) for incoming data and will

    communicate with the remote system.

    In the polling scenario, the behavior will typically involve periodically checking an endpoint for newdata that needs to be received into BizTalk.

    In the send case, the adapter is responsible for receiving messages from the BizTalkMessageBox and transmitting them to the remote system, using their associated transport orprotocol.

    Once an adapter has received the message, its then responsible for passing that message to theBizTalk Messaging Engine for processing. The Messaging Engine will process the message in apipeline after receiving a message and before sending a message.

  • 8/8/2019 Biz Talk 2

    11/35

    Copyright 2007 Sapient Corporation 11

    Xml Schema Continued

    Context PropertiesContext properties are used extensively by BizTalk adapters.

    An example of a context property is the filename of a file that BizTalk hasretrieved from a filesystem using the File adapter. The File adapter writes thefilename into the context during processing; this can then be accessed viapipeline components and BizTalk orchestrations.

    Batching

    Batching is an optimization within the engine, enabling a receive location toprocess multiple units of work as part of the same batch, thereby reducing thenumber of BizTalk MessageBox roundtrips required and enabling asynchronousprocessing for messages

    In-Box Adapters

    JD Edwards EnterpriseOne

    JD Edwards OneWorld XE

    ODBC Adapter for Oracle Database

    PeopleSoft

    SAP

  • 8/8/2019 Biz Talk 2

    12/35

    Copyright 2007 Sapient Corporation 12

    Xml Schema Continued

    SubscriptionsOnce a message has been processed by the adapter and associated pipeline, itneeds to be routed to an interested party. A BizTalk orchestration or send portcan register its interest in a specific message via subscriptions.

    MessageBoxOnce the message has passed from the adapter and through the pipeline, the

    BizTalk Message Agent,which runs as part of a BizTalk host instance, isresponsible for evaluating who has subscribed to this message and committing itinto the BizTalk MessageBox.

    The MessageBox is the heart of any BizTalk solution in that without it nothingwould work. All inbound and outbound messages, along with orchestrationexecution, dehydration, rehydration, and message tracking, rely on the BizTalkMessageBox.

    HostsA BizTalk hostis a logical representation of a runtime process. Each host maycontain a combination of Receive or Send adapters (and their associated receiveand send ports) or orchestrations.

  • 8/8/2019 Biz Talk 2

    13/35

    Copyright 2007 Sapient Corporation 13

    Orchestration

    OrchestrationThe most basic definition of a BizTalk orchestration is that it is a collection of codethat can be used to process data.

    BizTalk orchestrations enable you to implement a business process using a visual design toolcalled the Orchestration Designer.

    The orchestration is compiled into .NET code and, ultimately, into a .NET

    assembly;leverages the .NET side-by-side (SxS) functionality, which allows multipleversions of an orchestration to be deployed at any time.

    An orchestration can be created either by a message that it subscribes to or bybeing invoked by another orchestration.

    In the case of an orchestration subscribing to a message, the orchestration musthave a Receive shape at the top.

  • 8/8/2019 Biz Talk 2

    14/35

    Copyright 2007 Sapient Corporation 14

    BizTalk PipeLines

    PipelinesPipelines provide the ability to perform data processing and validation operations on incomingand outgoing messages.

    Incoming messages use receive pipelines, and outgoing messages use send pipelines.

    BizTalk provides four pipelines in-boxThe following pipelines are available on the receive side:

    XmlReceive The XmlReceive pipeline contains the XML Disassembler pipelinecomponent.

    PassThruReceive The PassThruReceive pipeline contains no pipelinecomponents.

    And the following pipelines are available on the send side:

    XmlTransmit The XmlTransmit pipeline contains the XML Assembler

    component.PassThruTransmit The PassThruTransmit pipeline contains no pipelinecomponents.

  • 8/8/2019 Biz Talk 2

    15/35

    Copyright 2007 Sapient Corporation 15

    BizTalk PipeLines

    Receive Pipeline stagesDecode:- In the Decode stage any processing required to enable the

    message to be processed by subsequent stages is performed. Common

    examples are decryption or decompression, which must be performed

    before, say, disassembly or validation.

    Disassemble:- Depending on the component, the Disassemble stage will beresponsible for identifying the type of message, conversion to XML, as

    required, or splitting up a message into separate, discrete messages.

    Validate:- The Validate stage is responsible for performing message

    validation. This is typically used to validate an XML message against an

    XML schema.

    Resolve Party:- The Resolve Party stage is used to identify the sender of

    the message, typically using an X509 Certificate or the Windows user,

    which is supplied by the adapter.

  • 8/8/2019 Biz Talk 2

    16/35

    Copyright 2007 Sapient Corporation 16

    BizTalk PipeLines

    Send Pipeline stagesPre-Assemble:- In the Pre-Assemble stage any processing required to enablethe message to be processed by subsequent stages is performed. This stage isoften used to make any last-minute changes to an XML, message before itsconverted to a flat file by the Assemble stage.

    Assemble:- The Assemble stage is the opposite of the Disassemble stage in thatit is responsible for converting the message from XML, typically to a differentformat such as a flat file. Its also possible to assemble multiple messages intoone output message.

    Encode:- The Encode stage is used to perform any final changes to a message.

    Typically, these include encoding, encryption, or compression.

  • 8/8/2019 Biz Talk 2

    17/35

    Copyright 2007 Sapient Corporation 17

    Xml Schema Continued

    PortsA port is essentially a container of locations where you can obtain data.

    Aportis a logical container for the physical receive location.

    Receive Port Structure

    Send Port Structure

  • 8/8/2019 Biz Talk 2

    18/35

    Copyright 2007 Sapient Corporation 18

    Xml Schema Continued

    Groups allow you to take a single, outbound message and send it tomultiple ports. One port may be a file drop, another a SQL databaseupdate, and a third may be a call to a web service.

  • 8/8/2019 Biz Talk 2

    19/35

    Copyright 2007 Sapient Corporation 19

    File Adapter

    The File adapter is arguably one of the most frequently used adapters that BizTalk provides. As the name

    implies, it can monitor a filesystem directory for files matching a configured extension to arrive.

    The File adapter works in two modes. After detecting a new file, the File adapter places a lock on it to

    ensure that another thread or machine doesnt try to process the file at the same time. It maintains the

    lock until the file has passed through the pipeline and has been successfully written to the MessageBox.

    Alternatively, it can be configured to rename the file to prevent another process from picking up the file

    while it is being processed.

    If the MessageBox persistence of the message is successful, the file is deleted from the filesystem.

    Conversely, if an error occurs during adapter or pipeline processing, the file is returned to the filesystem

    and will be processed again. In the case where it was renamed, it will be renamed to its original name.

  • 8/8/2019 Biz Talk 2

    20/35

    Copyright 2007 Sapient Corporation 20

    Xml Schemas Demo

  • 8/8/2019 Biz Talk 2

    21/35

    Copyright 2007 Sapient Corporation 21

    BizTalk Server - PART II

    Continued

  • 8/8/2019 Biz Talk 2

    22/35

    Copyright 2007 Sapient Corporation 22

    Orchestration.

    OrchestrationThe most basic definition of a BizTalk orchestration is that it is a collection of codethat can be used to process data.

    BizTalk orchestrations enable you to implement a business process using a visual design toolcalled the Orchestration Designer.

    The orchestration is compiled into .NET code and, ultimately, into a .NET

    assembly;leverages the .NET side-by-side (SxS) functionality, which allows multipleversions of an orchestration to be deployed at any time.

    An orchestration can be created either by a message that it subscribes to or bybeing invoked by another orchestration.

    In the case of an orchestration subscribing to a message, the orchestration musthave a Receive shape at the top.

  • 8/8/2019 Biz Talk 2

    23/35

    Copyright 2007 Sapient Corporation 23

    Orchestration

    ActivationBy a message arriving in the MessageBox to which an orchestration hassubscribed. This is called an activating receive.

    Following an invocation from another orchestration.

  • 8/8/2019 Biz Talk 2

    24/35

    Copyright 2007 Sapient Corporation 24

    Orchestration.

    Activating Receive

    The first scenario, when an orchestration is created following a messages arrival,is the most common method and is called an activating receive because amessages arrival activates a new instance of an orchestration.

    An activating receive is created by dragging a Receive shape onto anorchestration as the first shape. You cannot have an activating receive in anyother position within an orchestration, because that cannot be used to activatethe orchestration. You would be trying to start the orchestration when it hadalready been started.

  • 8/8/2019 Biz Talk 2

    25/35

    Copyright 2007 Sapient Corporation 25

    Orchestration

    InvokedThe second scenario is when an orchestration is created from anotherorchestration. This is configured by dragging a Call Orchestration or StartOrchestration shape onto the orchestration design surface.

    Invoking orchestrations in this way is typically used when refactoringorchestrations; if you have the same core business process logic duplicated in

    multiple places, its easier to place it in one shared orchestration.

    Ex: Auditing Mechanism, Payment Processing.

    Persistence Points

    BizTalk itself has been designed to be entirely stateless at the BizTalk Serverlayer.This stateless model is achieved by persisting the in-memory representationof an orchestration and any associated messages in SQL Server, which acts as adurable store. The engine does this in an intelligent manner rather than persistingthe entire orchestration each time. It will persist only the parts that it needs to.

  • 8/8/2019 Biz Talk 2

    26/35

    Copyright 2007 Sapient Corporation 26

    Orchestration.

    Persistence Points ContinuedMessages and orchestrations are always processed within the scope of a SQLtransaction. So if a BizTalk Server were to suffer a power outage, for example, amessage being consumed by an orchestration while in memory would not be lost.Instead, the transaction (and hence any orchestration state or messages) wouldbe rolled back to its last good state that was persisted in the BizTalkMessageBox.

    Orchestrations also persist their state at various points during execution,effectively creating a checkpoint. This checkpointing (referred to aspersistence

    points) is crucial to provide resilience against failure.

    Give a scenario

    Uses .Net Serialization Concepts

    Following things incur a persistence point during orchestration execution:

    Send shape

    Start Orchestration shapeEnd of a long-running scope

    Receive, Delay, and Suspend shapes

    End of Orchestration

  • 8/8/2019 Biz Talk 2

    27/35

    Copyright 2007 Sapient Corporation 27

    Orchestration.

    DehydrationExplain with Scenarios.

  • 8/8/2019 Biz Talk 2

    28/35

    Copyright 2007 Sapient Corporation 28

    Orchestration.

    VersioningBizTalk leverages the .NET side-by-side capability by utilizing the Global

    Assembly Cache (GAC).

    The GAC enables multiple versions of .NET assemblies to be deployed side byside. Because an orchestrations is compiled into a .NET assembly, it canleverage this feature. So, if you have an orchestration already deployed and haveinstances of this orchestration dehydrated, you can modify the orchestration,

    update the version number, and deploy to your BizTalk servers.After this new version has been deployed, you will see both versions in the GAC.When one of the dehydrated orchestrations wakes up, it will continue to use theoriginal .NET assembly version, not the new version. Any new activations of thisorchestration (i.e., not orchestrations rehydrating) will use the new orchestrationversion deployed as part of the new assembly.

  • 8/8/2019 Biz Talk 2

    29/35

    Copyright 2007 Sapient Corporation 29

    Orchestration.

    Port BindingSpecify Later, which enables you to bind your logical ports to physical receive orsend ports at deployment time, which is advisable in almost all cases

    Specify Now, which enables you to configure the physical port at development time,which is effectively hard-coding your configuration. This is not advisable, becauseany configuration changes will require the orchestration to be recompiled anddeployed.

    Direct port binding enables you to loosely couple orchestrations together or looselycouple orchestrations from the message source. This approach is particularly usefulwhen you want to implement a publish-and-subscribe messaging architecture

    Direct binding has three types: direct to message box, self correlating, and partner ports.

    Used to route message between the message box and Orchestrations without usingbindings or from one Orchestration to another Orchestration

    Orchestrations with direct bound ports are not bound to physical ports at deployment timebut instead rely on messages arriving from other receive ports or being created from other

    orchestrations at runtime.

  • 8/8/2019 Biz Talk 2

    30/35

    Copyright 2007 Sapient Corporation 30

    Orchestration.

    Distinguished Field and Promoted

  • 8/8/2019 Biz Talk 2

    31/35

    Copyright 2007 Sapient Corporation 31

    Orchestration.

    Correlation

  • 8/8/2019 Biz Talk 2

    32/35

    Copyright 2007 Sapient Corporation 32

    Orchestration.

    Correlation Setyouve been asked to construct a routing application that will facilitate an externalauthorization process for purchases over $1,000. Youll have an inboundmessage that you accept on an input port. Based on the dollar value of the priceelement, youll either send the message straight to a final send port or youll directit to an external authorization process. If the message is sent for approval, youwant the orchestration to pause and wait for the same message to return beforeit continues processing,To accomplish that, youll need to create what is knownas a correlation set.

    a correlation set allows you to declare that a promoted property will be used foridentification on any related messages that leave and return to the orchestration.Portions of the orchestration must subscribe to this correlation set so that theBizTalk engine is able to differentiate between an original message and one that

    is a continuation of work previously done.

  • 8/8/2019 Biz Talk 2

    33/35

    Copyright 2007 Sapient Corporation 33

    Orchestration.

    Consuming a WebService

    The BizTalk orchestration retrieves the XML purchase order (PO) message filefrom the receive location In folder.

    The orchestration passes the XML PO message as a string to the Web service.

    The Web service receives the XML PO message string, converts it to acorresponding XML invoice message string, and returns it as a string to thecalling orchestration.

    The orchestration writes the invoice message to an .xml file in the Out folder.

    In the middle of the orchestration, a Send shape and a Receive shape areconnected to a port named POWebServicePort. This is where the orchestrationmakes a synchronous Web method call to the external Web service through arequest-response port, specifying to send the message first.

    The logical request-response port is bound with a physical Solicit-Response sendport. When calling the external Web service, you must make sure that the Webmethod name you are calling matches the Operation name on

    the port, or you will receive a SOAP exception.

  • 8/8/2019 Biz Talk 2

    34/35

  • 8/8/2019 Biz Talk 2

    35/35

    Copyright 2007 Sapient Corporation 35