2.2.6.2.7 Service Document

Service Document (section 2.2.3.7.1) specifies that AtomPub, as specified in [RFC5023], defines a service document which describes collections of resources available from a data service. The root URL of a data service that implements the protocol defined in this document MUST identify such a service document. In this service document, a data service MUST represent all available collections in a single app:workspace element. See [RFC5023] section 8.3.2 for the definition of the app:workspace element and [RFC5023] section 6.1 for the definition of the "app" prefix. Within that workspace, a data service MUST represent each EntitySet in its associated Entity Data Model (EDM), as described in Abstract Data Model (section 2.2.1), as an app:collection element, as specified in [RFC5023] section 8.3.3. The URI identifying the EntitySet MUST be used as the value of the href attribute of the app:collection element. The name of the EntitySet MAY be used as the value of the atom:title element which, as specified in [RFC5023], is a mandatory child element of the app:collection element.

The following is an example AtomPub Service Document, as specified in [RFC5023], for the EDM described in Appendix A: Sample Entity Data Model and CSDL Document (section 6).

 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <service xml:base="http://localhost:2032/nw.svc/"
          xmlns:atom="http://www.w3.org/2005/Atom"
          xmlns:app="http://www.w3.org/2007/app"
          xmlns="http://www.w3.org/2007/app">
   <workspace>
     <atom:title>Default</atom:title>
     <collection href="Customers">
       <atom:title>Customers</atom:title>
     </collection>
     <collection href="Orders">
       <atom:title>Orders</atom:title>
     </collection>
     <collection href="OrderLines">
       <atom:title>OrderLines</atom:title>
     </collection>
   </workspace>
 </service>

Listing: AtomPub Service Document Describing a Data Service