Difference between revisions of "BES XML Commands"

From OPeNDAP Documentation
(New page: This page is under construction. '''We are still developing this command protocol and it is not yet a released API.''' == BES XML Command syntax. == The BES will accept commands encod...)
 
(define)
Line 91: Line 91:
 
----
 
----
  
==== define ====
+
=== define ===
  
 
===== Request Example =====
 
===== Request Example =====

Revision as of 00:57, 4 October 2008

This page is under construction.

We are still developing this command protocol and it is not yet a released API.


1 BES XML Command syntax.

The BES will accept commands encoded in XML documents, and provide responses in kind. Some requests specifically indicate a non XML response (such as a DAP2 binary response) in which case the response will be as requested.

1.1 Requests

All elements mentioned in the following are in the http://xml.opendap.org/ns/bes/1.0# namespace unless otherwise noted.

  1. Each request document must have a <request> root element.
  2. Each <request> must contain one or more BesCommand elements.
  3. A <request> may contain multiple BesCommands as long as zero more of those commands returns a response.
    Examples (expand with abbreviated xml):
    • we can do a set context, set container, define and a get das in the same request document as only the get das request command returns a response.
    • There can not be two show commands within the request document, or a show and a get, or multiple gets.
  4. . Each request element must have an attribute reqID the value of which will be used in the response document. There is no guarantee that the value of reqID be unique within the operational domain of the BES. (It might be unique within the software of the requesting client, but that's of no concern to the BES).

Question: Do we may want to allow reqID to be an optional attribute for each individual command. If present it would (can it?) be preserved in the response (or error) object as appropriate.

When we (eventually) develop a schema for this we can use it to "enforce" these restrictions.

1.2 Responses

Need a description and such here.

2 BES Command Set

2.1 setContext

Example:

<setContext  name="contextName>Value</setContext>

Changes the state of the BES for the current client connection. This allows the client to ask the BES to utilize various response formats.

2.1.1 name attribute

Identifies which context value is being set.

dap_format context

Value:
  • Major.Minor where both Major and Minor are integer values.

errors context

Current Values:
  • xml -
  • dap2 - When error context is set to dap2 then all errors will returned as DAP2 error objects (definitely not XML).
Proposed Values:
  • dap - When error context is set to dap then all errors will returned as DAP error objects. The version of the DAP that error must conform to is controlled by the dap_format context. It is possible (likely) that in the future DAP errors will be XML documents.
  • bes - Returns a BES Error response:
<BES>
    <response>
        <BESError>
            <Type>3</Type>
            <Message>Unable to find command for showVersions</Message>
            <Administrator>ndp@opendap.org</Administrator>
        </BESError>
    </response>
</BES>


2.1.1.1 Request Example
   <?xml version="1.0" encoding="UTF-8"?>
   <request reqID ="####" >
       <setContext name="errors">dap2</setContext>
   </request>
2.1.1.2 Response Example

Normally no response. May return a BESError.



2.2 setContainer

2.2.1 Request Example
   <?xml version="1.0" encoding="UTF-8"?>
   <request reqID ="####" >
       <setContainer name="c" space="catalog">data/nc/fnoc1.nc</setContainer>
   </request>
2.2.2 Response Example

Normally no response. May return a BESError.



2.3 define

2.3.1 Request Example
   <?xml version="1.0" encoding="UTF-8"?>
   <request reqID ="####" >
        <define name="d" space="default">
            <container name="c">
                <constraint>a valid ce</constraint>
               <attributes>list of attributes</attributes>
            </container>
            <aggregate handler="someHandler" cmd="someCommand" />
        </define> 
   </request>
2.3.2 Response Example

Normally no response. May return a BESError.



2.4 get

This needs to be expanded to illuminate the missing details from the previoius command set:

  • get 'type' for 'definition' using 'URL';

Type:

  • dds -
  • das -
  • dods -
  • stream -
  • ascii -
  • html_form -
  • info_page -
2.4.1 Request Example
   <?xml version="1.0" encoding="UTF-8"?>
   <request reqID ="####" >
        <get type="data_product" definition="def_name" returnAs="name" url="url" />
   </request>
2.4.2 Response Example

Explain about DAP2 responses etc...

2.5 Multiple command example

Multiple command transaction resulting in a DDS (non XML DAP2) response:

2.5.1 Request Example
   <?xml version="1.0" encoding="UTF-8"?>
   <request reqID ="####" >
       <setContext name="error">dap2</setContext>
       <setContainer name="c" space="catalog">data/nc/fnoc1.nc</setContainer>
        <define name="d" space="default">
            <container name="c">
                <constraint>a valid ce</constraint>
               <attributes>list of attributes</attributes>
            </container>
            <aggregate handler="someHandler" cmd="someCommand" />
        </define> 
        <get  type="dds" definition="d" returnAs="name" />
   </request>



2.6 Show version

2.6.1 Request Example
   <?xml version="1.0" encoding="UTF-8"?>
   <request reqID ="####" >
        <showVersion />
   </request>
2.6.2 Response

Current:

   <showVersion>
       <response>
           <DAP>
               <version>2.0</version>
               <version>3.0</version>
               <version>3.2</version>
           </DAP>
           <BES>
               <lib>
                   <name>libdap</name>
                   <version>3.5.3</version>
               </lib>
               <lib>
                   <name>bes</name>
                   <version>3.1.0</version>
               </lib>
           </BES>
           <Handlers>
               <lib>
                   <name>libnc-dods</name>
                   <version>0.9</version>
               </lib>
           </Handlers>
        </response>
   </showVersion>


Proposed:

   <response reqID="####">
       <version>
           <DAP>
               <version>2.0</version>
               <version>3.0</version>
               <version>3.2</version>
           </DAP>
           <BES>
               <lib>
                   <name>libdap</name>
                   <version>3.5.3</version>
               </lib>
               <lib>
                   <name>bes</name>
                   <version>3.1.0</version>
               </lib>
           </BES>
           <Handlers>
               <lib>
                   <name>libnc-dods</name>
                   <version>0.9</version>
               </lib>
           </Handlers>
       </version>
  </response>




2.7 Show help

2.7.1 Request Example
   <?xml version="1.0" encoding="UTF-8"?>
   <request reqID ="####" >
        <showHelp />
   </request>
2.7.2 Response Example

XHTML



2.8 showProcess

2.8.1 Request Example
   <?xml version="1.0" encoding="UTF-8"?>
   <request reqID ="####" >
        <showProcess />
   </request>
2.8.2 Response Example

XHTML?


2.9 showConfig

2.9.1 Request Example
   <?xml version="1.0" encoding="UTF-8"?>
   <request reqID ="####" >
        <showConfig />
   </request>
2.9.2 Response Example

XHTML?


2.10 showStatus

2.10.1 Request Example
   <?xml version="1.0" encoding="UTF-8"?>
   <request reqID ="####" >
        <showStatus />
   </request>
2.10.2 Response Example

XHTML?



2.11 showContainers

2.11.1 Request Example
   <?xml version="1.0" encoding="UTF-8"?>
   <request reqID ="####" >
        <showContainers />
   </request>
2.11.2 Response Example

XHTML?



2.12 deleteContainer(s), deleteDefinition(s)

2.12.1 Request Example
   <?xml version="1.0" encoding="UTF-8"?>
   <request reqID ="####" >
        <deleteContainers store="storeName" />
        <deleteContainer name="containerName" store="storeName" />
        <deleteDefinitions store="storeName" />
        <deleteDefinition name="defName" store="storeName" />
   </request>
2.12.2 Response Example

Normally no response. May return a BESError



2.13 showDefinitions

2.13.1 Request Example
   <?xml version="1.0" encoding="UTF-8"?>
   <request reqID ="####" >
        <showDefinitions />
   </request>
2.13.2 Response Example

XHTML?



2.14 showContext

2.14.1 Request Example
   <?xml version="1.0" encoding="UTF-8"?>
   <request reqID ="####" >
        <showContext />
   </request>
2.14.2 Response Example

XHTML?



2.15 showCatalog

2.15.1 Request
   <?xml version="1.0" encoding="UTF-8"?>
   <request reqID ="####" >
        <showCatalog node="nodeName" />
   </request>
2.15.2 Response
   <showCatalog>
       <response>
           <dataset thredds_container="true">
               <name>nc/test</name>
               <size>408</size>
               <lastmodified>
                   <date>2006-01-04</date>
                   
               </lastmodified>
               <count>5</count>
               <dataset thredds_container="false">
                   <name>test.nc</name>
                   <size>12148</size>
                   <lastmodified>
                       <date>2005-09-29</date>
                       
                   </lastmodified>
               </dataset>
               <dataset thredds_container="false">
                   <name>testfile.nc</name>
                   <size>43392</size>
                   <lastmodified>
                       <date>2005-09-29</date>
                       
                   </lastmodified>
               </dataset>
               <dataset thredds_container="false">
                   <name>TestPat.nc</name>
                   <size>262452</size>
                   <lastmodified>
                       <date>2005-09-29</date>
                       
                   </lastmodified>
               </dataset>
               <dataset thredds_container="false">
                   <name>TestPatDbl.nc</name>
                   <size>2097464</size>
                   <lastmodified>
                       <date>2005-09-29</date>
                       
                   </lastmodified>
               </dataset>
               <dataset thredds_container="false">
                   <name>TestPatFlt.nc</name>
                   <size>1048884</size>
                   <lastmodified>
                       <date>2005-09-29</date>
                       
                   </lastmodified>
               </dataset>
           </dataset>
       </response>
   </showCatalog>

2.16 showInfo

2.16.1 Request
   <?xml version="1.0" encoding="UTF-8"?>
   <request reqID ="####" >
        <showInfo node="nodeName />
   </request>
2.16.2 Response
   <showInfo>
       <response>
           <dataset thredds_container="true">
               <name>nc/test</name>
               <size>408</size>
               <lastmodified>
                   <date>2006-01-04</date>
                   
               </lastmodified>
               <count>5</count>
           </dataset>
       </response>
   </showInfo>
   <showInfo>
       <response>
           <dataset thredds_container="false">
               <name>nc/test/TestPatFlt.nc</name>
               <size>1048884</size>
               <lastmodified>
                   <date>2005-09-29</date>
                   
               </lastmodified>
           </dataset>
       </response>
   </showInfo>