Home > Articles > Web Services > XML

XML Reference Guide

📄 Contents

  1. XML Reference Guide
  2. Overview
  3. What Is XML?
  4. Informit Articles and Sample Chapters
  5. Books and e-Books
  6. Official Documentation
  7. Table of Contents
  8. The Document Object Model
  9. Informit Articles and Sample Chapters
  10. Books and e-Books
  11. Official Documentation
  12. DOM and Java
  13. Informit Articles and Sample Chapters
  14. Books and e-Books
  15. Implementations
  16. DOM and JavaScript
  17. Using a Repeater
  18. Repeaters and XML
  19. Repeater Resources
  20. DOM and .NET
  21. Informit Articles and Sample Chapters
  22. Books and e-Books
  23. Documentation and Downloads
  24. DOM and C++
  25. DOM and C++ Resources
  26. DOM and Perl
  27. DOM and Perl Resources
  28. DOM and PHP
  29. DOM and PHP Resources
  30. DOM Level 3
  31. DOM Level 3 Core
  32. DOM Level 3 Load and Save
  33. DOM Level 3 XPath
  34. DOM Level 3 Validation
  35. Informit Articles and Sample Chapters
  36. Books and e-Books
  37. Documentation and Implementations
  38. The Simple API for XML (SAX)
  39. Informit Articles and Sample Chapters
  40. Books and e-Books
  41. Official Documentation
  42. SAX and Java
  43. Informit Articles and Sample Chapters
  44. Books and e-Books
  45. SAX and .NET
  46. Informit Articles and Sample Chapters
  47. SAX and Perl
  48. SAX and Perl Resources
  49. SAX and PHP
  50. SAX and PHP Resources
  51. Validation
  52. Informit Articles and Sample Chapters
  53. Books and e-Books
  54. Official Documentation
  55. Document Type Definitions (DTDs)
  56. Informit Articles and Sample Chapters
  57. Books and e-Books
  58. Official Documentation
  59. XML Schemas
  60. Informit Articles and Sample Chapters
  61. Books and e-Books
  62. Official Documentation
  63. RELAX NG
  64. Informit Articles and Sample Chapters
  65. Books and e-Books
  66. Official Documentation
  67. Schematron
  68. Official Documentation and Implementations
  69. Validation in Applications
  70. Informit Articles and Sample Chapters
  71. Books and e-Books
  72. XSL Transformations (XSLT)
  73. Informit Articles and Sample Chapters
  74. Books and e-Books
  75. Official Documentation
  76. XSLT in Java
  77. Java in XSLT Resources
  78. XSLT and RSS in .NET
  79. XSLT and RSS in .NET Resources
  80. XSL-FO
  81. Informit Articles and Sample Chapters
  82. Books and e-Books
  83. Official Documentation
  84. XPath
  85. Informit Articles and Sample Chapters
  86. Books and e-Books
  87. Official Documentation
  88. XML Base
  89. Informit Articles and Sample Chapters
  90. Official Documentation
  91. XHTML
  92. Informit Articles and Sample Chapters
  93. Books and e-Books
  94. Official Documentation
  95. XHTML 2.0
  96. Documentation
  97. Cascading Style Sheets
  98. Informit Articles and Sample Chapters
  99. Books and e-Books
  100. Official Documentation
  101. XUL
  102. XUL References
  103. XML Events
  104. XML Events Resources
  105. XML Data Binding
  106. Informit Articles and Sample Chapters
  107. Books and e-Books
  108. Specifications
  109. Implementations
  110. XML and Databases
  111. Informit Articles and Sample Chapters
  112. Books and e-Books
  113. Online Resources
  114. Official Documentation
  115. SQL Server and FOR XML
  116. Informit Articles and Sample Chapters
  117. Books and e-Books
  118. Documentation and Implementations
  119. Service Oriented Architecture
  120. Web Services
  121. Informit Articles and Sample Chapters
  122. Books and e-Books
  123. Official Documentation
  124. Creating a Perl Web Service Client
  125. SOAP::Lite
  126. Amazon Web Services
  127. Creating the Movable Type Plug-in
  128. Perl, Amazon, and Movable Type Resources
  129. Apache Axis2
  130. REST
  131. REST Resources
  132. SOAP
  133. Informit Articles and Sample Chapters
  134. Books and e-Books
  135. Official Documentation
  136. SOAP and Java
  137. Informit Articles and Sample Chapters
  138. Books and e-Books
  139. Official Documentation
  140. WSDL
  141. Informit Articles and Sample Chapters
  142. Books and e-Books
  143. Official Documentation
  144. UDDI
  145. UDDI Resources
  146. XML-RPC
  147. XML-RPC in PHP
  148. Informit Articles and Sample Chapters
  149. Books and e-Books
  150. Official Documentation
  151. Ajax
  152. Asynchronous Javascript
  153. Client-side XSLT
  154. SAJAX and PHP
  155. Ajax Resources
  156. JSON
  157. Ruby on Rails
  158. Creating Objects
  159. Ruby Basics: Arrays and Other Sundry Bits
  160. Ruby Basics: Iterators and Persistence
  161. Starting on the Rails
  162. Rails and Databases
  163. Rails: Ajax and Partials
  164. Rails Resources
  165. Web Services Security
  166. Web Services Security Resources
  167. SAML
  168. Informit Articles and Sample Chapters
  169. Books and e-Books
  170. Specification and Implementation
  171. XML Digital Signatures
  172. XML Digital Signatures Resources
  173. XML Key Management Services
  174. Resources for XML Key Management Services
  175. Internationalization
  176. Resources
  177. Grid Computing
  178. Grid Resources
  179. Web Services Resource Framework
  180. Web Services Resource Framework Resources
  181. WS-Addressing
  182. WS-Addressing Resources
  183. WS-Notifications
  184. New Languages: XML in Use
  185. Informit Articles and Sample Chapters
  186. Books and e-Books
  187. Official Documentation
  188. Google Web Toolkit
  189. GWT Basic Interactivity
  190. Google Sitemaps
  191. Google Sitemaps Resources
  192. Accessibility
  193. Web Accessibility
  194. XML Accessibility
  195. Accessibility Resources
  196. The Semantic Web
  197. Defining a New Ontology
  198. OWL: Web Ontology Language
  199. Semantic Web Resources
  200. Google Base
  201. Microformats
  202. StructuredBlogging
  203. Live Clipboard
  204. WML
  205. XHTML-MP
  206. WML Resources
  207. Google Web Services
  208. Google Web Services API
  209. Google Web Services Resources
  210. The Yahoo! Web Services Interface
  211. Yahoo! Web Services and PHP
  212. Yahoo! Web Services Resources
  213. eBay REST API
  214. WordML
  215. WordML Part 2: Lists
  216. WordML Part 3: Tables
  217. WordML Resources
  218. DocBook
  219. Articles
  220. Books and e-Books
  221. Official Documentation and Implementations
  222. XML Query
  223. Informit Articles and Sample Chapters
  224. Books and e-Books
  225. Official Documentation
  226. XForms
  227. Informit Articles and Sample Chapters
  228. Books and e-Books
  229. Official Documentation
  230. Resource Description Framework (RDF)
  231. Informit Articles and Sample Chapters
  232. Books and e-Books
  233. Official Documentation
  234. Topic Maps
  235. Informit Articles and Sample Chapters
  236. Books and e-Books
  237. Official Documentation, Implementations, and Other Resources
  238. Rich Site Summary (RSS)
  239. Informit Articles and Sample Chapters
  240. Books and e-Books
  241. Official Documentation
  242. Simple Sharing Extensions (SSE)
  243. Atom
  244. Podcasting
  245. Podcasting Resources
  246. Scalable Vector Graphics (SVG)
  247. Informit Articles and Sample Chapters
  248. Books and e-Books
  249. Official Documentation
  250. OPML
  251. OPML Resources
  252. Summary
  253. Projects
  254. JavaScript TimeTracker: JSON and PHP
  255. The Javascript Timetracker
  256. Refactoring to Javascript Objects
  257. Creating the Yahoo! Widget
  258. Web Mashup
  259. Google Maps
  260. Indeed Mashup
  261. Mashup Part 3: Putting It All Together
  262. Additional Resources
  263. Frequently Asked Questions About XML
  264. What's XML, and why should I use it?
  265. What's a well-formed document?
  266. What's the difference between XML and HTML?
  267. What's the difference between HTML and XHTML?
  268. Can I use XML in a browser?
  269. Should I use elements or attributes for my document?
  270. What's a namespace?
  271. Where can I get an XML parser?
  272. What's the difference between a well-formed document and a valid document?
  273. What's a validating parser?
  274. Should I use DOM or SAX for my application?
  275. How can I stop a SAX parser before it has parsed the entire document?
  276. 2005 Predictions
  277. 2006 Predictions
  278. Nick's Book Picks

Every time we get a new innovation, eventually the "old world" of applications tries to use it to its advantage. We had the web, which was designed for documents, and eventually everyone was creating "web enabled applications". Now we have web services, and everyone's creating "web services applications". If you look at it in a more general sense, we even have "Service Oriented Architectures". I'm sure it's not the first time that a "new" way of doing things was co-opted and absorbed by the old way, and I'm even more sure it won't be the last. But this need to adapt web services to the old way of creating programs creates a need to get around some of the things about web services that were considered great in the first place.

For example, web services are inherently stateless. You make a call, and you get a result. Technically, that's the end of the association between sender and receiver. But if you've ever tried to create any kind of serious application, you know that that's hardly the end of it. You know that you often need to pass information that approximates a state, such as a message identifier or a session id.

Then there's the matter of parameters. In a traditional API, you have methods and functions and properties (oh my!) and you pass and receive values. Sure, you can approximate that in a SOAP message, but that would mean fundamentally changing the way that you think about programming. And That Will Not Do, apparently.

So to that end, we have the need to create a web service in such a way that we can program with it as we would program with any other language or environment. We need to be able to uniquely identify a service or a service instance, we ned to be able to pass parameters back and forth.

It has to be standard.

In other words, it doesn't do any good to solve all of those problems if everybody solves them differently. To that end, one proposed method that is gathering steam, particularly when it comes to Grid Computing, is WS-Addressing.

WS-Addressing has two basic functions: to provide a standard way of referencing endpoints, and to provide a standard set of headers providing information about a message, such as where it's going and where replies and faults should go. Let's start by looking at endpoint references.

The purpose of endpoint references is to provide a way to give more information that a simple URL can provide. For example, consider this endpoint reference, slightly modified from our discussion on Web Services Resource Framework:

<wsa:EndpointReference>
   <wsa:Address>
        http://www.example.com/services/someService
   </wsa:Address>
   <wsa:ReferenceProperties>
        <tns:resourceID>DataChunk42</tns:resourceID>
   </wsa:ReferenceProperties>
   <wsa:ReferenceParameters>
        <tns:expires>32000</tns:expires>
   </wsa:ReferenceParameters>
</wsa:EndpointReference>

In this case, we have an endpoint with two pieces of information: the address of the serivce, and a reference property. Endpoint references can have five different types of information:

  • address: The address is a URI (such as a URL) the represents the location of the service and identifies it. This information is required.
  • reference properties: This peices of information (such as the one in the example above) help to identify the resource to which the service refers.
  • reference parameters: This information is anything else that helps to facilitate the interaction.
  • selected port type: The primary portType of the endpoint being conveyed, as defined in the WSDL file.
  • service-port: Also referencing the WSDL definition of the service, the service-port points to the service element that describes the service.
  • policy: This information refers to WS-Policy elements.

The Address element represents the location of the service, so there's no need to represent it in a message, but the SOAP binding specifies that all other information is to be included in the Header of the SOAP message. So this endpoint might receive a SOAP message of:

<SOAP-ENV:Envelope>
     <SOAP-ENV:Header>
          <tns:resourceID>DataChunk42</tns:resourceID>
          <tns:expires>32000</tns:expires>
     </SOAP-ENV:Header>
     <SOAP-ENV:Body>
        ...
     </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Now, this isn't the only information that WS-Addressing specifies. It also defines Message Information Headers, or specific bits of information about a message that also get included in the SOAP header. For example, we could specify that this message was from http://www.example.com/clients/someClient, and that the reply should go to http://www.example.com/clients/someOtherClient. We could even send any faults to yet a third endpoint. We can also specify an action, which is similar to the old SOAPAction header:

<SOAP-ENV:Envelope>
     <SOAP-ENV:Header>
         <wsa:MessageID>msgid:1234567902282223</wsa:MessageID>
         <wsa:To>http://www.example.com/services/someService</wsa:To>
         <wsa:Action>http://www.example.com/someAction</wsa:Action>
         <wsa:From>http://www.example.com/clients/someClient</wsa:From>
         <wsa:ReplyTo><wsa:Address>http://www.example.com/clients/someOtherClient</wsa:Address></wsa:ReplyTo>
         <wsa:FaultTo><wsa:Address>http://www.example.com/clients/yetAnotherClient</wsa:Address></wsa:FaultTo>
          <tns:resourceID>DataChunk42</tns:resourceID>
          <tns:expires>32000</tns:expires>
     </SOAP-ENV:Header>
     <SOAP-ENV:Body>
        ...
     </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Notice that the ReplyTo and FaultTo are endpoint references, and not simple URIs. When we send a response, we put some of this information to use:

<SOAP-ENV:Envelope>
     <SOAP-ENV:Header>
         <wsa:MessageID>msgid:1234567902282429</wsa:MessageID>
         <wsa:RelatesTo>msgid:1234567902282223</wsa:RelatesTo>
         <wsa:To>http://www.example.com/clients/someOtherClient</wsa:To>
         <wsa:Action>http://www.example.com/someOtherAction</wsa:Action>
         <wsa:From>
               <wsa:Address>http://www.example.com/services/someService</wsa:Address>
               <wsa:ReferenceProperties>
                      <tns:resourceID>DataChunk42</tns:resourceID>
               </wsa:ReferenceProperties>
               <wsa:ReferenceParameters>
                       <tns:expires>32000</tns:expires>
               </wsa:ReferenceParameters>
         </wsa:From>
     </SOAP-ENV:Header>
     <SOAP-ENV:Body>
        ...
     </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

In this case, the RelatesTo element serves to tie the two messages together, and the From element represents an endpoint reference.

Message Information Headers include the following:

  • To: This is the destination of the message, and is required.
  • Action: Expressed as a URI, this property is required.
  • MessageID: The message id is only required if you are using ReplyTo or FaultTo.
  • RelatesTo: When used in a reply, this property ties the message back to the original request. Other possible roles may be defined for this element using the RelationshipType attribute..
  • ReplyTo: This optional property contains an endpoint reference for the endpoint that is to receive the reply, if any. If this element is not present, the reply is sent back to the original requestor.
  • From: Optional, this property refers to the endpoint reference of the requestor of the current message.
  • FaultTo: Represents the destination endpoint reference for any faults generated by the operation.

WS-Addressing generally enhances WSDL, and is designed to work with it. For example, the WSDL file can contain references to WS-Addressing elements, and vice versa.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.