110 likes | 439 Views
SOAP. CPSC 315 – Programming Studio Spring 2008 Project 3, Lecture 2. XML Namespaces. Different XML definitions could define the same element name. If we want to use both, could have conflict. Can distinguish using namespaces. <a:book>…</a:book> <b:book>…</b:book>.
E N D
SOAP CPSC 315 – Programming Studio Spring 2008 Project 3, Lecture 2
XML Namespaces Different XML definitions could define the same element name. If we want to use both, could have conflict. Can distinguish using namespaces. <a:book>…</a:book> <b:book>…</b:book>
Defining XML Namespaces xmlns attribute in definition of element xmlns:prefixname=“URL” <a:book xmlns:a=http://this.com/adef> Can be defined in first use of element or in XML root element. Can define a “default” No prefix needed, leave off : also
Middleware “Middle” layer between applications and more basic system (OS) Provides a more common interface for distributed applications Allows heterogeneous HW/OS platforms Generally refers to software allowing processes running across network to interact
SOAP Simple Object Access Protocol An XML-based message passing framework. Communicates via HTTP Enables easier communication around firewalls Applications can communicate using SOAP, even if in different languages/operating systems Not the most efficient approach XML HTTP Full SOAP specifications are more generalized, not necessarily as tied to HTTP
SOAP Messages XML Document Envelope element that encompasses document Optional header element Required Body element Optional Fault element Must use SOAP Envelope/Encoding namespaces Envelope: http://schemas.xmlsoap.org/soap/envelope/ http://www.w3.org/2001/12/soap-envelope Encoding: http://schemas.xmlsoap.org/soap/encoding/ http://www.w3.org/2001/12/soap-encoding No references to DTD or XML processing
SOAP Envelope Root element <soap:Envelope xmlns:soap=http://www.w3.org/2001/12/soap-envelope soap:encodingStyle=http://www.w3.org/2001/12/soap-encoding > ... </soap:Envelope>
SOAP Header Idea is to give processing commands SOAP messages might pass through many intermediate SOAP nodes These might process message in various ways Header gives instructions on what the receiving/relay/etc. node needs to do Header itself can change in this process.
SOAP Body The “main” message Must use namespace definitions to specify elements. <soap:Body> <mq:GetTemp xlmns:mq=“http://this.com/temps”> <mq:Location>Bryan</mq:Location> <mq:Date>4/9/08</mq:date> </mq:GetTemp> <soap:Body>
SOAP Faults Occurs within Body element Several subelements possible faultcode VersionMismatch MustUnderstand Client Server Can extend these (e.g. Client.Authentication) faultstring Human-readable explanation faultfactor Who caused the fault to happen detail Application-specific error information
More Information • Official SOAP specifications: http://www.w3.org/TR/soap/ (Discussed version 1.1) http://www.w3.org/TR/2000/NOTE-SOAP-20000508/ • SOAP tutorial: http://www.w3schools.com/soap/default.asp