Host

Table of contents
  1. 1. Overview
  2. 2. Data Types
    1. 2.1. Config
    2. 2.2. Service
    3. 2.3. Blueprint
    4. 2.4. InitConfig
    5. 2.5. Script
    6. 2.6. ScriptResults
  3. 3. Features
      1. 3.1.1. GET:blueprints
        1. 3.1.1.1. Response
        2. 3.1.1.2. Version History
      2. 3.1.2. POST:blueprints
        1. 3.1.2.1. Request Body
        2. 3.1.2.2. Response
        3. 3.1.2.3. Version History
      3. 3.1.3. GET:blueprints/{sid-or-typename}
        1. 3.1.3.1. Response
        2. 3.1.3.2. Version History
      4. 3.1.4. DELETE:blueprints/{sid-or-typename}
        1. 3.1.4.1. Response
        2. 3.1.4.2. Version History
      5. 3.1.5. POST:convert
        1. 3.1.5.1. Request Body
        2. 3.1.5.2. Response
        3. 3.1.5.3. Version History
      6. 3.1.6. POST:execute
        1. 3.1.6.1. Request Body
        2. 3.1.6.2. Response
        3. 3.1.6.3. Version History
      7. 3.1.7. POST:load
        1. 3.1.7.1. Query Parameters
        2. 3.1.7.2. Response
        3. 3.1.7.3. Version History
      8. 3.1.8. POST:register (OBSOLETE)
        1. 3.1.8.1. Request Body
        2. 3.1.8.2. Response
        3. 3.1.8.3. Version History
      9. 3.1.9. GET:services
        1. 3.1.9.1. Response
        2. 3.1.9.2. Version History
      10. 3.1.10. POST:services
        1. 3.1.10.1. Request Body
        2. 3.1.10.2. Response
        3. 3.1.10.3. Version History
      11. 3.1.11. POST:shutdown
        1. 3.1.11.1. Response
        2. 3.1.11.2. Version History
      12. 3.1.12. POST:start (OBSOLETE)
        1. 3.1.12.1. Request Body
        2. 3.1.12.2. Response
        3. 3.1.12.3. Version History
      13. 3.1.13. POST:stop
        1. 3.1.13.1. Request Body
        2. 3.1.13.2. Response
        3. 3.1.13.3. Version History
      14. 3.1.14. *:test
        1. 3.1.14.1. Query Parameters
        2. 3.1.14.2. Request Body
        3. 3.1.14.3. Response
        4. 3.1.14.4. Version History
      15. 3.1.15. POST:unregister (OBSOLETE)
        1. 3.1.15.1. Request Body
        2. 3.1.15.2. Response
        3. 3.1.15.3. Version History
      16. 3.1.16. GET:versions
        1. 3.1.16.1. Response
        2. 3.1.16.2. Version History
      17. 3.1.17. POST:xmltransform
        1. 3.1.17.1. Query Parameters
        2. 3.1.17.2. Request Body
        3. 3.1.17.3. Response
        4. 3.1.17.4. Version History

Assembly: mindtouch.core
Class: MindTouch.Dream.HostService
SID: http://services.mindtouch.com/dream/...e/2007/03/host

Overview

The Host service provides an interface to start and stop services.  Before a service can be started, its blueprint must be registered through one of two mechanisms: full-registration or self-registration.

As the name implies, full-registration requires all details of the service to be specified upfront (assembly, type, name, copyright, features, etc.).  Self-registration, on the other hand, only requires the assembly and type information, but assumes that service class was defined using DreamService and DreamFeature attributes.

Once a blueprint has been registered, services can be instantiated.

Verb:Suffix Description
GET:blueprints Retrieve list of all blueprints.
POST:blueprints Register a service blueprint.
DELETE:blueprints/{sid-or-typename} Remove a service blueprint.
GET:blueprints/{sid-or-typename} Retrieve a blueprint with given suffix as name.
POST:convert Convert a document to another format
POST:execute Execute an XML script.
POST:load Load an assembly and register all contained services.
GET:services Retrieves a list of all running services.
POST:services Start a service instance.
POST:stop Stop a service instance.
POST:shutdown Shutdown host service and all running services.
*:test Test communication with Host service.
GET:version Retrieve version information about Dream assemblies.
POST:xmltransform Apply a XML-transform (xslt) to a document.

Data Types

Config

<config>
	<service-dir>C:/service_state</service-dir>
	<http-port>8081</http-port>
</config>

Service

<service>
	<uri>http://localhost:8081/myservice</uri>
</service>

Blueprint

Read more about Blueprints.


Partial Blueprint: a partial blueprint can be used for service classes that were defined using Dream attributes .

<blueprint>
	<assembly>dream.tutorial.8ball</assembly>
	<class>MindTouch.Dream.Tutorial.EightBallService</class>
</blueprint>

Complete Blueprint: a complete blueprint specifies all the information required to instantiate a Dream service.  The service class only needs to implement the IDreamService interface.

<blueprint>
    <assembly Version="1.0.0.0" Culture="neutral" PublicKeyToken="null">dream.tutorial.8ball</assembly>
    <class>MindTouch.Dream.Tutorial.EightBallService</class>
    <name>Dream Tutorial 8-Ball</name>
    <copyright>Copyright (c) 2006, 2007 MindTouch, Inc.</copyright>
    <info>http://doc.opengarden.org/Dream_SDK/Tutorials/8-Ball</info>

    <!-- the configuration element describes how to configure the service -->
    <configuration>
        <entry>
            <xpath>nolog</xpath>
            <valuetype>void?</valuetype>
            <description>When present, service will not create a log sub-service at /@log.</description>
        </entry>
        <entry>
            <xpath>uri.host</xpath>
            <valuetype>uri?</valuetype>
            <description>Uri for host service (provided by Host).</description>
        </entry>
        <entry>
            <xpath>uri.self</xpath>
            <valuetype>uri</valuetype>
            <description>Uri for current service (provided by Host).</description>
        </entry>
    </configuration>

    <!-- the 'features' element list all service features -->
    <features>
        <feature>
            <pattern>GET:</pattern>
            <description>Returns a random 8-ball message</description>
            <info>http://doc.opengarden.org/Dream_SDK/Tutorials/8-Ball</info>
            <method>GetAnswer</method>
            <statusfilter>2xx</statusfilter>
        </feature>
    </features>
</blueprint>

InitConfig

<config>
	<path>8ball</path>
	<class>MindTouch.Dream.Tutorial.EightBallService</class>
</config>

Script

<script>
	<action verb="POST" path="/host/register">
		<blueprint>
			<assembly>dream.tutorial.8ball</assembly>
			<class>MindTouch.Dream.Tutorial.EightBallService</class>
		</blueprint>
	</action>
	<action verb="POST" path="/host/start">
		<config>
			<path>8ball</path>
			<class>MindTouch.Dream.Tutorial.EightBallService</class>
		</config>
	</action>
</script>

ScriptResults

<results>...</results>

Features

GET:blueprints

Retrieve list of all registered blueprints.

Response
Status Response Body Description
200 Blueprint List All blueprints currently registered with this host
Version History

Aqua: feature added


POST:blueprints

Register a service blueprint.

Request Body

Partial or Complete Blueprint

Response
Status Response Body Description
200 --- ---
Version History

Crimson: feature added


GET:blueprints/{sid-or-typename}

Retrieve the blueprint of a given serice type.

Response
Status Response Body Description
200 Blueprint Requested blueprint if given name is currently registered with this host
404 HTML Html error page.
Version History

Aqua: feature added


DELETE:blueprints/{sid-or-typename}

Remove a service blueprint.

Response
Status Response Body Description
200 --- ---
Version History

Crimson: feature added


POST:convert

This feature is simply a passthrough.  That is, it replies with whatever document is in the request body.  Combined with the built-in Dream request processing parameters, it can be used to convert from any standard Dream format to any other.

Request Body

Anything.

Response
Status Response Body Description
200 Same as request body. By default, the response body is the same as the request body.
Version History

Beryl: feature added


POST:execute

Execute an XML script.

Request Body

Script

Response
Status Response Body Description
200 ScriptResults A list of Result documents
Version History

Aqua: feature added


POST:load

Load an assembly and register all contained services.

Query Parameters
Name Type Description
name string Name of assembly to load
Response
Status Description
Ok (200) (1-3 sentence description of response contents)
Version History

Crimson: feature added


POST:register (OBSOLETE)

Register a service blueprint.

Request Body

Partial or Complete Blueprint

Response
Status Response Body Description
200 --- ---
Version History

Crimson: feature is obsolete, use POST:blueprints

Aqua: feature added


GET:services

Retrieves a list of all running services.

Response
Status Response Body Description
200 Service List List of services currently running on the host
Version History

Aqua: feature added


POST:services

Start a service instance.

Request Body

InitConfig

Response
Status Response Body Description
200 --- ---
Version History

Crimson: feature added


POST:shutdown

    ---    ---

Shutdown host service and all running services.

Response
Status Response Body Description
200 --- ---
Version History

Aqua: feature added


POST:start (OBSOLETE)

Start a service instance.

Request Body

InitConfig

Response
Status Response Body Description
200 --- ---
Version History

Crimson: feature is obsolete, use POST:services

Aqua: feature added


POST:stop

Stop a service instance.

Request Body

Service

Response
Status Response Body Description
200 --- ---
Version History

Aqua: feature added


*:test

This feature responds to any HTTP verb (GET, PUT, POST, etc.).   The request body is optional and can be any valid XML document.  The response is an XML document built from the requeset body and all included request headers.  The response status code can be specified by the status query argument.

This feature has multiple uses:

  • to test if the Host service is running by doing a simple GET:test/
  • to inspect what kind of headers were sent by the client since these are reflected in the response message
  • to test the client response handlers by overwriting the response status code
Query Parameters
Name Type Defaut
Description
status int? 200 (OK) Optional response status code to use for reply
Request Body

Optionaly, any valid XML document.

Response
Status Response Body Description
(any) XMessage The replied XMessage is an XML encoding of the request headers and the request body.
Version History

Beryl: feature added


POST:unregister (OBSOLETE)

Remove a service blueprint.

Request Body

Partial Blueprint. The <class> element  is used as unique key to find the registered blueprint.

Response
Status Response Body Description
200 --- ---
Version History

Crimson: feature is obsolete, use DELETE:blueprints/{sid-or-typename}

Aqua: feature added


GET:versions

Retrieve version information about Dream assemblies.

Response
Status Description
Ok (200) (1-3 sentence description of response contents)
Version History

Crimson: feature added


POST:xmltransform

This feature applies the XSLT document provided by URI to the XML document in the request body.

Query Parameters
Name Type Defaut
Description
xslt uri (none) Source location of XSLT document
Request Body

Any valid XML document.

Response
Status Response Body Description
200 Determined by XSLT By default the, response body is expected to be a XML document.  The respones type can be ovewritten by using the dream.out.type query argument.
400 Error message When the XSLT document could not be found.
Version History

Beryl: feature added

Tag page
You must login to post a comment.
Powered by MindTouch Deki v.8.08.1a