Title: XML Interoperability
1XML Interoperability
- Brian Loesgen
- Principal Engineer, Stellcom Inc
- bloesgen_at_stellcom.com
2Agenda
- Introduction
- Supporting multiple devices an XML view
- Overview of SOAP
- Case Study Distributed Message Monitor
- Overview of the BizTalk Initiative
- BizTalk Server components
3Introduction Whats in a Name?
4Interoperability Definition
The ability of any entity (enterprise, device,
application) to speak to, exchange data with, and
be understood by any other entity.
Loesgen Dictionary (2000)
5Type of Interoperability
- Supporting multiple devices
- Enterprise
- Inter-application
- Inter-process
- Inter-departmental
- Inter-enterprise (eg supply chain)
6Developing for Multiple Devices
- Problem definition
- Non-XML approach
- XML/XSLT approach
- Demo
- Code
Non XML approach
7Developing for Multiple DevicesLimitations of
Current Technologies
- Tightly coupled to the device
- Multiple code-bases
- Difficult to adapt to new devices
- Major development efforts for new devices
- Slow time to market
8e-Adaptable
9Benefits
- New devices mean new layers, not applications
- Reduced development effort
- Reduced complexity
- Old layers easily retired, with no impact
- Foundation for future growth
- Protects and leverages infrastructure investment
- Ready for the web-enabled belt buckle
10Translator Implementation from ASP
11Translator Implementation from ASP Part 1
- One example of what the translator may look like
(low volume) - lt_at_ LanguageVBScript gt
- lt
- Option Explicit
- Response.Expires -1
- Dim objSource, objStyle, msg
- Dim strSource, strDevice
- strSource request.querystring("source")
- if strSource "" then
- strSource "english"
- end if
- strDevice request.querystring("device")
- if strDevice "" then
12Translator Implementation from ASP Part 2
- Loading the source (data) document
- Set objSource Server.createObject("MSXML2.DOMDoc
ument") - objSource.async false
- objSource.load(Server.mappath(strSource))
- if objSource.parseError.errorCode ltgt 0 then
- msg "Error loading XML data file."
- msg msg "lthr color""red""gtDescription "
_ - objSource.parseError.reason
- msg msg "ltbrgtSource text " _
- objSource.parseError.srcText
- msg msg "ltbrgtAttempting to load " _
- Server.mappath(strSource)
- response.write msg
- response.end
- End if
13Translator Implementation from ASP Parts 3 and 4
- Loading the XSLT
- Set objStyle Server.createObject("MSXML2.DOMDocu
ment") - objStyle.async false
- objStyle.load(Server.mappath(strDevice)
".xsl") - if objStyle.parseError.errorCode ltgt 0 then
- msg "Error loading XSL file."
- msg msg "lthr color""red""gtDescription "
_ - objSource.parseError.reason
- msg msg "ltbrgtSource text "
objSource.parseError.srcText - msg msg "ltbrgtAttempting to load " _
- Server.mappath(strDevice ".xsl")
- Response.write msg
- Response.end
- End if
- Applying the Transformation
14SOAP - What is it?
- Simple Object Access Protocol
- XML-based RPC, RMI, XML DCOM
- Submitted to W3C as a note
- Supported by Microsoft, IBM, Sun, Lotus, others.
15Anatomy of a SOAP Message
16Sample SOAP Request
- SOAPAction HTTP Header is mandatory in an HTTP
SAOP Request
17Sample SOAP Response
18Sample SOAP Fault
19SOAP Case Study - Distributed Message Monitor
- Overview - Two key challenges in developing
distributed systems lie in making the appropriate
architectural decisions, and in debugging.
20Scenario
- In this scenario, a fictitious company has three
different offices that participate in a business
transaction - Sales office in San Diego
- Head Office in London
- Manufacturing facility in Hong Kong
21Nomenclature
- Messages are pieces of text emitted by message
poster, and are captured and distributed by the
Publisher - The Publisher is the VB COM object, which takes
messages posted to it and makes them available to
anyone that has subscribed to a Message of that
Class. This is also known as the MessageMonitor - Subscribers are entities that have registered for
a certain Class of Message - A Class is a grouping/categorization mechanism
for Messages
22Architecture Overview
23Component Breakdown
24Message Monitor Demo
25Message Pool XML Structure
26SOAP Listener 1Server-Side Binary Read
strMethodName request("HTTP_SOAPACTION") Set
xmldoc Server.CreateObject("Microsoft.XMLDOM") x
mldoc.asyncfalse xmldoc.load(Request)
27SOAP Listener 2SOAP Fault
Sub LogErrorDetails(xmldoc, strError) '// This
sub takes the passed xmldoc and replaces the
elements '// below ltSOAPBodygt with the
ltSOAP-ENVFaultgt message to tell '// the
calling app about the problem Dim oFault,
oBody Set oFault xmldoc.createElement("SOAP-ENV
Fault") oFault.appendChild(xmldoc.createElement(
"faultcode")).text "400" oFault.appendChild(xml
doc.createElement("faultstring")).text
_ "Application Error" oFault.appendChild(xml
doc.createElement("detail")).appendChild(
_ xmldoc.createElement("message")).text
strError Set oBody xmldoc.selectSingleNode("//
SOAP-ENVBody") oBody.replaceChild oFault,
oBody.firstChild End Sub
28SOAP Listener 3SOAPAction Header
'// Is there a SOAPAction header? If
Trim(strMethodName)"" Then LogErrorDetails
xmldoc, _ "This SOAP listener expects to get a
SOAPACTION header, and did not." Set objResponse
xmldoc Call EndPage() End If  intIndex
InStrRev(strMethodName, "") Â '// Is the
SOAPAction header the way we need it? If
intIndex0 Then LogErrorDetails xmldoc, _ "The
SOAP did not get a properly structured SOAPACTION
header." Set objResponse xmldoc Call
EndPage() End If  '// Extract the ProgID
name strProgID Left(strMethodName, intIndex -
1) Â '// Extract the method name strMethodName
Mid(strMethodName, intIndex 1)
29SOAP Listener 4Application Scope
If Not IsObject(Application("objMonitor"))
Then '// if the monitor object has not been
created yet, do so and give '// it application
scope Set objMonitor Server.CreateObject(strPro
gID) Set Application("objMonitor")
objMonitor If debugging Then a.writeline("Ass
igned Application variable") End If Else Set
objMonitor Application("objMonitor") If
debugging Then a.writeline("Application
variable already existed...") End If End
if  Set objMonitor Application("objMonitor")
30SOAP Listener 5Execution
If IsObject(objMonitor) then If debugging
Then a.writeline("Invoking objMonitor."
strMethodName "(xmldoc)") a.writeline("xmldoc
contains " xmldoc.xml "") End If  Set
objResponse eval("objMonitor." strMethodName
"(xmldoc)") Â If Not IsObject(objResponse)
Then LogErrorDetails xmldoc, _
typename(objResponse) _ "
Unexpected response received from, " _ "or
unable to reach destination"
strDestination Set objResponse xmldoc End
if Else '// Error condition the object could
not be created LogErrorDetails xmldoc, "Unable
to create class " strClass Set objResponse
xmldoc End if
31Message Pool 1Initialization
Private objSubscribers As MSXML2.DOMDocument30 P
rivate Sub Class_Initialize() Dim objNode
Set objSubscribers New MSXML2.DOMDocument30
Set objNode _ objSubscribers.createElement("su
bscribers") objSubscribers.appendChild
(objNode) End Sub Public Property Get xmlDoc()
As MSXML2.DOMDocument30 Set xmlDoc
objSubscribers End Property
32Message Pool SubscribeDoes Subscriber Exist?
Public Function subscribe(objXMLDoc As Variant)
As Variant Dim strSubscriber As String,
strClass As String Dim objNode As Variant,
objClassNode As Variant strSubscriber
objXMLDoc.selectSingleNode("//msubscriber").Text
strClass objXMLDoc.selectSingleNode("//mcla
ss").Text Set objNode objSubscribers.selectS
ingleNode( _ "/subscribers/subscriber_at_name'"
strSubscriber "'") If TypeName(objNode)
"Nothing" Then '// subscriber has not
been added yet, add 'em in... Set objNode
objSubscribers.createElement("subscriber")
Call objNode.setAttribute("name",
strSubscriber) objSubscribers.documentElem
ent.appendChild (objNode) End If ..
33Message Pool SubscribeSubscriber Registered
for this Class?
. If TypeName(objNode.selectSingleNode("//cl
ass_at_name'" strClass "' _ and ../_at_name'"
strSubscriber "'")) "Nothing" Then
'// subscriber is not registered for this class
yet Set objClassNode objSubscribers.crea
teElement("class") Call
objClassNode.setAttribute("name", strClass)
objNode.appendChild (objClassNode) End If
Set objNode Nothing Set objClassNode
Nothing Set subscribe createResponse(objXMLD
oc, "Subscriber" _ strSubscriber " has
been added for class" strClass "") End
Function
34Message Pool createResponseGenericizing the
Return Value
Private Function createResponse(objXMLDoc As
Variant, strMessage As String) _ As Variant
Dim objNewNode As Variant, objBody As Variant
Set objNewNode objXMLDoc.createElement("mresu
lt") objNewNode.Text strMessage Set
objBody objXMLDoc.selectSingleNode("//SOAP-ENVB
ody") objBody.replaceChild objNewNode,
objBody.firstChild Set createResponse
objXMLDoc End Function
35Message Pool Publish
Public Function publish(objXMLDoc As Variant) As
Variant Dim objNodeList As Variant,
objMessage As Variant, ele As Variant Dim
strMessage As String, strClass As String
strMessage objXMLDoc.selectSingleNode("//mmessa
ge").Text strClass objXMLDoc.selectSingleNod
e("//mclass").Text Set objNodeList
objSubscribers.selectNodes( _ "//class_at_name
'" strClass "'") For Each ele In
objNodeList Set objMessage
objSubscribers.createElement("message")
objMessage.Text strMessage Call
objMessage.setAttribute("time", Now)
ele.appendChild (objMessage) Next Set
objMessage Nothing Set ele Nothing
Set publish createResponse(objXMLDoc,
_ "Published message to " objNodeList.length
" subscribers") Set objNodeList
Nothing End Function
36Message Pool Publish example
37Message Pool Un-subscribeGetting a Reference
Public Function unsubscribe(objXMLDoc As
Variant) As Variant Dim strSubscriber As
String, strClass As String Dim objSubscriber
As Variant Dim objNode As Variant Set
objSubscriber objXMLDoc.selectSingleNode("//msu
bscriber") strSubscriber objSubscriber.Text
strClass objXMLDoc.selectSingleNode("//mcla
ss").Text Set objNode objSubscribers.selectS
ingleNode("//class_at_name'" _ strClass "'
and ../_at_name'" strSubscriber "'") .
38Message Pool Un-subscribeRemoving Subscription
. If TypeName(objNode) ltgt "Nothing" Then
If objNode.parentNode.childNodes.length gt 1
Then '// Subscriber is subscribed to
more than one class, '// remove just this
class. objNode.parentNode.removeChild
(objNode) Else '// Subscriber
is only subscribed to one class, '// remove
the subscriber also objNode.parentNode.parentNod
e.removeChild( _ objNode.parentNode)
End If End If Set objNode Nothing
Set objSubscriber Nothing Set unsubscribe
createResponse(objXMLDoc, _ "ltresult
gtSubscriber" strSubscriber _ " has
been unsubscribed for class" _ strClass
"lt/resultgt") End Function
39Message Pool getMessages
Public Function getMessages(objXMLDoc As
Variant) As Variant Dim strSubscriber As
String, strClass As String, objNodeList As
Variant Dim strMessages As String
strSubscriber objXMLDoc.selectSingleNode("//msu
bscriber").Text strClass objXMLDoc.selectSin
gleNode("//mclass").Text Set objNodeList
objSubscribers.selectNodes("//message../_at_name'"
_ strClass "' and ../../_at_name'"
strSubscriber "'") strMessages
"ltmessagesgt" For Each ele In objNodeList
strMessages strMessages ele.xml Next
strMessages strMessages "lt/messagesgt"
For Each ele In objNodeList
ele.parentNode.removeChild (ele) Next Set
getMessages createResponse(objXMLDoc,
strMessages) End Function
40Message Pool reset
Public Function reset() Dim
objSubscriberList As Variant Dim objRoot As
Variant, objSubscriber As Variant Set
objSubscriberList objSubscribers.selectNodes("//
subscriber") Set objRoot objSubscribers.docu
mentElement For Each objSubscriber In
objSubscriberList objRoot.removeChild
(objSubscriber) Next End Function
41Alert
Alert(Are you still awake?)
42Client-side JavaScript
function mm_initMessage() var objTemp new
ActiveXObject('Microsoft.XMLDOM') var
strXML strXML 'lt?xml version"1.0"?gt' strXML
'ltSOAP-ENVEnvelope ' strXML
'xmlnsSOAP-ENV"urnschemas.xmlsoap.orgsoap/
envelope"' strXML 'xmlnsm"urnstellcom.co
m/distMessages"gt' strXML ' ltSOAP-ENVBodygt'
strXML ' ltmuninitializedgtlt/muninitialize
dgt' strXML ' lt/SOAP-ENVBodygt' strXML
'lt/SOAP-ENVEnvelopegt' objTemp.loadXML(strXML)
return objTemp
43Client-side JavaScriptSample Wrapper
function mm_subscribe(strPublisher,
strSubscriber, strClass) var objMethodCall,
objBody var objHTTPReq new ActiveXObject("Micro
soft.XMLHTTP") objHTTPReq.open("POST",
strPublisher, false) Â // add the SOAPAction
header objHTTPReq.setRequestHeader("SOAPAction",
"DistMessages.MessageMonitorsubscribe") Â ob
jMethodCall objMessage.createElement("msubscrib
e") objMethodCall.appendChild(objMessage.createEl
ement("msubscriber")).text
strSubscriber objMethodCall.appendChild(objMessag
e.createElement("mclass")).text
strClass objBody objMessage.selectSingleNode("/
/SOAP-ENVBody") objBody.replaceChild(objMethodCa
ll, objBody.firstChild) Â objHTTPReq.send(objMess
age.xml) Â debugMessage(objHTTPReq)
44Learning more about SOAP
- Develop.com/soap
- www.soap-wrc.com
- your favorite XML site
45BizTalk
46What is BizTalk?
- BizTalk is a multi-pronged initiative
- The BizTalk Framework
- www.BizTalk.org
- Microsofts BizTalk Server
- BizTalk server products from other vendors
47The BizTalk Framework
- Addresses the problem of data exchange (not
solely focused on vocabulary and grammar
standardization)Â - Specifies the "wrapper" or "envelope" that will
be used to contain your XML message - The data you want to transfer becomes embedded in
the BizTalk-compliant message - The BizTalk specification does not impose any
restrictions or guidelines on the structure or
content of the embedded data - BizTalk V2.0 messages are SOAP-compliant
48The BizTalk Framework Header
- ltSOAP-ENVEnvelope
- xmlnsSOAP-ENV"http//schemas.xml
soap.org/soap/envelope/" - xmlnsxsi"http//www.w3.org/1999/
XMLSchema-instance"gt - ltSOAP-ENVHeadergt
- ltdlvdelivery SOAP-ENVmustUnderstand"1"
- xmlnsdlv"http//schemas.biz
talk.org/btf-2-0/delivery" - xmlnsagr"http//www.trading
-agreements.org/types/"gt - ltdlvtogt
- ltdlvaddress xsitype"agrdepartme
nt"gtBook Order Departmentlt/dlvaddressgt
- lt/dlvtogt
- ltdlvfromgt
- ltdlvaddress xsitype"agrorganiza
tion"gtBooklovers - Anonymouslt/dlvaddressgt
- lt/dlvfromgt
- lt/dlvdeliverygt
- ltpropproperties SOAP-ENVmustUnderstand"1
" - xmlnsprop"http//schemas.bi
ztalk.org/btf-2-0/properties"gt - ltpropidentitygtuuid74b9f5d0-33fb-4a81-
b02b-5b760641c1d6lt/propidentitygt
49The BizTalk Framework Body
- ltSOAP-ENVEnvelope
- xmlnsSOAP-ENV"http//schemas.xml
soap.org/soap/envelope/" - xmlnsxsi"http//www.w3.org/1999/
XMLSchema-instance"gt - ltSOAP-ENVHeadergt
-
- lt/SOAP-ENVHeadergt
- ltSOAP-ENVBodygt
- ltpoPurchaseOrder
- xmlnspo"http//electrocommerce.org/purchase_o
rder/"gt - ltpoTitlegtProfessional
BizTalklt/poTitlegt - lt/poPurchaseOrdergt
- lt/SOAP-ENVBodygt
- lt/SOAP-ENVEnvelopegt
50BizTalk.org
- The BizTalk.org schema repository is intended to
promote schema discovery, re-use and
standardization. BizTalk.org is an independent
body supported by numerous corporations including
Microsoft, SAP, CommerceOne, Boeing, BP/Amoco and
more.
51BizTalk.org
52Microsofts BizTalk Server
- BizTalk Editor
- BizTalk Mapper
- BizTalk Application Designer
- BizTalk Management Desk
- BizTalk Server Administration
53BizTalk Editor
- Define schemas
- Intuitive GUI
54BizTalk Mapper
- Map between schemas
- Intuitive GUI
- Extensible
- Produces
- XSLT
55BizTalk Application Designer
- Shared dual approach business process and
implementation - Intuitive GUI
- Encourages
- "think it
- through" for
- end users
56BizTalk Management Desk
- Define entities used by server
- Organizations
- Ports
- Channels
57BizTalk Server Administration
- MMC Snap-in
- Manage/inspect queues
- See across multiple BizTalk servers
58BizTalk Partners
- Broad support for an unreleased product
- Partners include Ariba, Commerce One,
webMethods, Great Plains, Sequoia, J.D. Edwards,
Baan, Keyfile, POET, etc
59Learning More
- Framework www.microsoft.com/biztalk
- Repository www.biztalk.org
- Server www.microsoft.com/biztalkServer
- Partners www.microsoft.com/biztalk/partners.htm
60Conclusion
- Defined Interoperability
- Seen XML Interoperability to talk to multiple
devices - Seen XML Interoperability using SOAP to implement
a pub/sub message monitor - Seen the BizTalk initiative and how they combine
to facilitate XML interchange
61- Questions?
- Brian Loesgen
- Principal Engineer, Stellcom Inc
- bloesgen_at_stellcom.com