Petals-BC-REST 1.x

compared with
Version 4 by Nicolas Oddoux
on Sep 22, 2010 10:57.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (13)

View Page History

{info}

REST is a style of software architecture not a standard. If you want more details about REST, you can consult the Wikipedia page: [http://en.wikipedia.org/wiki/Representational_State_Transfer]
{info}
When a message is received on a REST linked endpoint from the JBI environment, it is transformed into a REST message and sent to the Web Service. The address of the Web Service to send the REST message to is defined in the address extension of the deployed Service Unit.

The REST request is created according the HTTP method to used:
* GET:
* The REST URI is created from the address extension, JBI operation and JBI payload (only the children of the XML root of the JBI payload are used, the local name is the URI parameter name and the content of the tag is the URI parameter value).
* There is no HTTP body
* POST:
* The REST URI is created from the address extension and the JBI operation.
* The HTTP body is created from the JBI payload (The value of the XML root of the JBI payload is used)
* PUT:
* The REST URI is created from the address extension and the JBI operation.
* The HTTP body is created from an attachment (the first attachment found in the JBI message is used if there is one)
* DELETE:
* The REST URI is created from the address extension and the JBI operation.
* There is no HTTP body
For all the HTTP methods, the headers present in the protocol header JBI message property are added to the HTTP headers.

The external Web Service is called and the REST response is processed and returned to the JBI environment.

The REST response is transformed into a JBI message like this:
* In case of error (HTTP status different from 200) a JBI fault is created.
* The HTTP body if it is present is used to create a JBI attachment (the HTTP body is not a XML in all the cases).
* The JBI payload is empty.
* The HTTP headers are added to the protocol header JBI message property

In all the cases, the MEP used to call the RESTful services is defined by the petalsCDK:mep extension.

h3. With no description of the RESTful Web Service

The REST message is created according the HTTP method defined in the :
* The JBI message payload is wrapped in the SOAP body
* The JBI message attachments are used to create SOAP ones
* The JBI message exchange operation is used to create the SOAP action
The HTTP method is defined in the http-method SU extension.

h3. With a WADL

The REST operation corresponding to the JBI operation is found in the WADL.
The HTTP method is defined in the WADL for the operation.

h3. With a WSDL 2.0

The REST operation corresponding to the JBI operation is found in the WSDL 2.0.
The HTTP method is defined in the WSDL 2.0 for the operation.

h2. Configuration



|| Attribute || Description || Default value || Required ||
| address | Address of the external Web Service to send JBI messages to. | | {center}Yes{center} |
| http-method | HTTP method to use. \\
\\
Possible values are: GET for the HTTP method GET, POST for the HTTP method POST, PUT for the HTTP method PUT and DELETE for the HTTP method DELETE. \\ | | {center}Yes\*{center} |
| wadl | WADL which defines the partner service | | {center}Yes\*{center} |
| wsdl2 | WSDL2 which defines the partner service | | {center}Yes\*{center} |
{table-plus}

\*Only one of these extensions must be used and is required in a specific SU.

h3. Service Unit descriptor



|| Attribute || Description || Default value || Required ||
| service-name | Web Service name to expose. | | {center}No{center} |