Petals-BC-REST 1.x

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

Changes (18)

View Page History
In provider role, when a JBI MessageExchange is sent to a ServiceEndpoint (mapped to a Web Service), it is transformed into a REST message and sent to the linked external Web Service. In consumer role, when a REST message is received on an exposed Web Service, it is transformed into a JBI MessageExchange and sent to the corresponding JBI ServiceEndpoint.

The REST component is based on Restlet, Jersey, Resteasy, CXF or Jersey and Axis2 (TBD). It provides the following features:
* Expose Restful Web Services as JBI Services
* Expose Restful Web Services as JBI Services using a WADL (TBC)
* Expose Restful Web Services as JBI Services using a WSDL 2.0 (TBC)
* Expose JBI Services as Restful Web Services


The REST request is created like this:
* The REST URI is created from the address extension, JBI operation and JBI payload
* The REST URI is created from the address extension, the JBI operation and JBI message content (The JBI message content must contains the information about the path, the matrix and query parameters)
* The HTTP body is created differently according the HTTP method to used:
** GET/DELETE: There is no HTTP body
** POST/PUT: The HTTP body is created from a JBI attachment (the first attachment found in the JBI message is used if there is one)
** POST: The HTTP body is created differently according the JBI message content:
*** The JBI message content contains only a reference to a JBI attachment: The HTTP body is created from a JBI attachment (binary data)
*** The JBI message content does not contains a reference to a JBI attachment: The HTTP body is from the JBI message content (form parameters)
** PUT: The HTTP body is created from a JBI attachment
* The headers present in the protocol header JBI message property are added to the HTTP headers.

For example the following JBI message:
{code:lang=xml}
{code}

produces the URI http://weather.yahooapis.com/....

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 20x) 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 fragment in all the cases).
* The JBI payload is empty.
* The JBI message content and attachment are created differently according the Content-Type HTTP header:
** Non XML content types: The JBI message content is a reference (cf SOAP) to a JBI attachment which contains the HTTP body
** XML content types: The JBI message content is created from the HTTP body (there is no JBI attachment created)
* The HTTP headers are added to the protocol header JBI message property




|| Attribute || Description || Default value || Required ||
| address | Address of the external Web Service to send JBI messages to. | | {center}Yes\*{center} |
The JBI message is created like this:
* The JBI operation is created from the operation present in the REST URI operation
* The JBI payload message content is created according to the HTTP method of the incoming REST request:
** GET: The JBI payload message content is created from the REST URI path and parameters
** POST/PUT/DELETE: There is no JBI payload
** POST: The JBI message content is created differently according the Content-Type HTTP header:
*** Non XML content types: The JBI message content is a reference (cf SOAP) to a JBI attachment which contains the HTTP body
*** XML content types: The JBI message content is created from the HTTP body (there is no JBI attachment created)
** PUT/DELETE: There is no JBI message content
* A JBI attachment is created according to the HTTP method of the incoming REST request:
** GET/DELETE: There is no JBI attachment created
** POST: A JBI attachment is created from the HTTP body if the Content-Type HTTP header contains a non XML content type.
** POST/PUT: The PUT: A JBI attachment is created from the HTTP body
* The HTTP headers are added to the the protocol header JBI message property
* The MEP is defined by the petalsCDK:mep extension.



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