Assembly: mindtouch.core
Class: MindTouch.Dream.HostService
SID: http://services.mindtouch.com/dream/...e/2007/03/host
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. |
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>
<config> <path>8ball</path> <class>MindTouch.Dream.Tutorial.EightBallService</class> </config>
<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>
Retrieve list of all registered blueprints.
Retrieve the blueprint of a given serice type.
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.
Retrieves a list of all running services.
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:
| Name | Type | Defaut
|
Description |
| status | int? | 200 (OK) | Optional response status code to use for reply |
Remove a service blueprint.
This feature applies the XSLT document provided by URI to the XML document in the request body.
| 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. |