2Start recording!Recordings in various formats will be available in a few daysCheck out the Tutor Group Forums for:Recording linksCopies of slidesAny follow questions and answersPlease use the “chat” box to chat!Bad enough listening to me for 90 minutesAt least you can chat to the other studentsAny subject you like, I will ignore box except for questions!
4Proposed agenda Where are we? Eclipse Protocols XML TMA Tips, Q & A DataMetadataToolsSchema DesignTMA Tips, Q & AAny questions, please click the “raise your hand” icon Then type question in chat box Or use microphone!
5Fun Quiz! Throughout this presentation there are some movie quotes! Question 1 (easy)Which movie are most of them from?Question 2 (harder)Which quote is the odd one out?And which movie is it from?There are NO prizes!But please don’t spoil the fun for others…
6Proposed Un-agenda(?) Security This is well covered (for our purposes) in Block 2 Part 2But be aware that this is a BIG subjectYou are NOT an expert just having read Part 2!Message Transport over HTTPAlso well covered, Block 2 part 3But the protocol stuff here will be usefulThe practical workThoroughly described in Block 2 parts 4-7Excellent support from the appropriate national forums
7“If there's a bright center to the universe, you're on the planet that it's farthest from.” Where Are We?
8Overview Block 1 – E-Business in context E M TMA01 A pt 2 YouAre HereBlock 2 – Protocols and DataTMA02Block 3 – Web ServicesTMA03Block 4 – Business ProcessesEMA pt 1
9Block 2You need to read (and understand!) most of block 2 material before starting TMA02 You have 2 ½ weeks remaining Do not panic! If really pushed for time, Block 2 Part 3 is not immediately relevant to the TMA But you will struggle with Block 3 without it Contact your tutor if you have any questions or problems (More on the TMA later…)
10“That’s no moon! That’s a space station” Eclipse
11Eclipse Tips Don’t Panic! Watch the video for an overview From the T320 websiteOr on the DVDWatch the 9th April recording in the Module-Wide tutorial roomIntroduction to Eclipse, XML and XML schema (Michelle and Mike) ~ 1hr 25mins
13My view of eclipse (YMMV) For any given task, there is probably something better than EclipsePHP editing – PHPStormXML Editing – OxygenBut for integration, flexibility and add-ons (of all types) there is little to beat itEspecially for large teamsAs a developer, do I use it by choice?I used to… (First large scale IDE I used)Recently migrated to something less “heavy” - JeditAnd less “austere” (more colourful and fun!)
14Protocols “I am C-3PO, human-Cyborg Relations...” “Don’t need a protocol droid…”Protocols
15Block 2 Part 1 Good, interesting material And quite brief! Don’t worry too much about EDI / EDIFACTFor historical interest onlyMake sure you understand:Structured and unstructured dataWhat a protocol is (next slide)
16What Is a Protocol? 1 - The pattern of message exchange How is an interaction started? Who can start it?How do we take turns? Synchronous or asynchronous?What is the procedure for handling errors?How to manage acknowledgements?How to end / complete the interactionInteresting aside…If we expect the other guy to acknowledge our message was received, should we acknowledge their acknowledgement?Look up “The Two Generals’ Problem” on Wikipedia
17What Is a Protocol? 2 – The format and semantics of messages The arrangement of dataWhere stuff starts and endsWhat format the data is inThe difference between “protocol data” and “payload data”What does the data mean?Especially the “protocol data” e.g. flags, lengths, checksumsThe “payload data” may just be “data” (i.e. treated as a single “chunk” of bytes
18Example ProtocolS“Good Evening” “Table for four please” “This way please” “Thank you” “Here are your menus, would you like to order your drinks now?”GET /t320/index.cfm HTTP/1.1 Host: dell400.open.ac.uk HTTP/ OK Server: Microsoft-IIS/4.0 Date: Mon, 01 Jul :38:27 GMT Content-Length 2722
19Layered PRotocolsBlock 2 Part 3 – Message Exchange over HTTP Important to understand “Layered Protocols”
20“What’s in there?”“Only what you take with you…”XML
21XML terminology<item about=“this”>A string of Characters</item>Name ValueAttributeElement ContentStart TagEnd TagElement
22XML DataCan be in the content… <h1>My Webpage</h1 Can be in an attribute value… <img src=“http://xkcd.org/1011.jpg”/> Can be the presence of the element itself… <hr />
23METADataIt is a useful distinction to talk about “data” and “metadata” “Metadata” is “data about the data” It is NOT the data itself, but is additional information that helps interpret or categorise the data Could also consider it “primary” vs. “secondary” data <fuel-load units=“litres”>10000</fuel-load> Or the MP3 “tags” that provide artist, album, & genre details
24Creating XML By hand, in an editor Not typical, except authoring of structured documentsWhere there is much more content than structureE.g. Oxygen XML/Author to create product manualProgrammatically (i.e. through a computer program)By writing out XML as a text fileNeed to know ALL the data beforehand(Except in very trivial cases, like log files)Need to know ALL the structure beforehandOr use a DOM Interface…
25Creating XML through a dom interface Remember, XML has a hierarchical (tree like) structureSo we can create that tree by adding “branches” as required, where required (and then move them around!)A typical DOM interface has functions like:Document.CreateElement(ElementName)Element.AddAttribute(Name,Value)Element.AddChild(Element) / Element.RemoveChild()Element.AddContent(CharacterData)When complete, write out as an XML fileDocument.CreateXMLFile(RootElement)
27Reading XML - DOM We can also use a DOM interface to read XML Typical functions include:Document.ReadXMLFile(Filename)Element.GetAttribute(Name)Element.GetContent()Element.GetChildren()In this way data can be read and used in a programPoints to note:ALL the data is read in by the program“Navigation” can be long-winded for “deep” trees
28Reading XML – SAX An alternative approach is to use a SAX interface XML is read element-by-elementYou tell the interface which elements you want to work onTypical interface might be:Create a “call back” table of elements and function calls(i.e. call function X when you find element E)ParseFile(Filename, CallBackTable)How do you specify the elements you need? X-PATH
29X-PATHExamples: /contact/name/familyname //town Others: //Element[name=“value”] These can get really long and complicated! (Debug tools available)
30Converting XML What if want to reorganise XML to match another schema? We already know one way:Use DOM to read in “old” XML, rearrange as required, write out “new” XMLBut this requires a program to be writtenAlternative is an XSLT processorTakes an existing XML file, and a specification of changesCreates new XML file based on:An specification of an element pattern (X-PATH!)Some instructions as to what to outputAll these instructions are written in XML!But can be tricky – need to understand recursionBut for that, first you must understand recursion…
31XSLT PROCESSOR Transform Specification (XML) Input Output XML XML File (application)
32Restricting XML With XML we can define elements and attributes at whim It is useful to restrict XML to a specific “vocabulary”So we can define it, share it, re-use itOriginally – Document Type Definitions ( DTD )Kinda weird syntax – don’t worry about thisBut note that XHTML is still defined by a DTDNewer approach XML-SCHEMAUses XML to define other elements, attributesHow they can be arrangedWhat they can contain (e.g. facets)
33XML SCHEMAS Best developed using a graphical tool E.g. Eclipse But there are better (paid for) toolsOther tools may validate XML against a schemaE.g. DOM Interface usually has option to validateDocument.ReadXMLFile(FileName,Validate=true)If you know (and trust) the source it may not always be necessary to validate files (does take time & resources)
34Schema Design Karl’s Tips for Real Life Schema Design (Not really necessary for the TMA – i.e. no extra marks!)Always include a schema version no. in your XMLHelps to maintain backwards compatibilityUse element content for data, attributes for metadataMakes difference clearer, easier to set defaultsLook for opportunities to re-use elements & dataBut be aware, it is hard to enforce internal consistency in schema (e.g. unique IDs - YES, cross-references – NO?.)Be careful placing mandatory elements (ideally, first)Helps with forward compatibility (new elements)
35"You're in a desert, walking along in the sand, when all of a sudden..." "Is this the test now?"TMA02 Tips Q & A
36TMA02 Q1Based on example data gathering form, develop a schema and example XML data fileYou are developing a data representation NOT trying to reproduce the formThe form is provided as an example of how the data is gathered at presentRemember, we want a format in which data can be used in for automation
37Example of use Possible Destinations: Possible Sources: Other programs PrintoutsDifferentXML filePossible Sources:Typed bya personCreatedin anotherprogramComputerProgramXML DocumentPossibleActions:Use for databaselookupCombine with other dataStore in a databaseDatabase
38The “right” answer? There isn’t one! There is a wide range of answers because:XML can be used in various waysElements vs. AttributesElement organisation / hierarchy / optionalityElement & attribute namingStrictness vs. flexibilityHence Q1(c)Explain, in your terms, why you made particular choicesAny, sensible justification is fine!
39TMA01 Q2 (a) Tests your understanding of XML Well covered in the course material(b) Tests your understanding of SchemasAlso well covered in the course material(c) Asks you to explain your choice of representationWhy did you decide to use <whatever>?Don’t forget to mention alternatives considered(d) Short note on using EclipseMake sure you say three things!Can be positive or negative
40TMA02 Q2 (a) Tests your understanding of namespaces Well covered in the course material(b) Comparing various XML tools in a specific scenarioSome in course material, but also this presentation(c) Industry Standards vs bespoke developmentStandards were covered in Block 1Think about pros and cons(d) Short report on using image metadataSee this presentation about “metadata”Don’t worry about references
41TMA02 Tips There are no tricks or traps! So don’t look for them… Largely straight forwardBut don’t leave it too late to start…And maybe start with 1b, then do 1a…?No word count limitsBut longer is not always better!Look at the marks breakdownUse this to guide your time
42Any Questions?Please type below or in the chat box Click on the “Raise your hand” icon to use your microphone
43“Difficult to see, always in motion is the future” What Next?
44Thank you for watching! TMA02 Submission date 8th May Block 3 Material available 29th AprilAny questions or problemsCheck the Tutor Group Forum for slides & recordingsNext tutorial: 3rd JuneThank you for watching!