|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (30)
View Page Historyh1. Exposing an external Restful Web Service as a JBI service endpoint
In provide mode, the component exposes an external Web Service in the JBI environment to send REST requests to the external Web Service.
In service provider mode, the component exposes an external REST resource as a service in the JBI environment. It will convert service invocations into REST requests to the associated external resources.
h2. Usage
The Petals BC REST component can expose an external Web Service as a JBI service endpoint by deploying a Service Unit on it:
The Petals BC REST component can expose a set of external REST resources as a JBI service endpoint by deploying a service-unit on it.
{center}
When a message is received on a REST linked endpoint from the JBI environment, it is transformed into a REST request and sent to the resource server.
*Provides an external resource as a JBI service*
{center}
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 resource server.
{center}
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 resource server.
The REST request is created like this:
* 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 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),
** PUT: The HTTP body is created from a JBI attachment.
For example the following JBI message will produces the URI {{http://localhost:8088/library/My+Documents/documents/6/metadata}}: {{http://localhost:8088/library/My%20Documents/documents/6/metadata}}:
{code:lang=xml}
<consulter xmlns="http://petals.ow2.org/bc/rest/unit-test/ged">
<consulter xmlns="http://petals.ow2.org/bc/rest/unit-test/ged">
h3. With no description of the RESTful resource
All needed information must be defined in the service-unit. See [Service Unit attributes to provide services|#service-unit-attributes-provide] for more information :
All needed information must be defined in the service-unit JBI descriptor. This JBI descriptor is configured through parameters divided in following groups:
* *JBI parameters* that defines the service provider identification,
* *CDK parameters* that are parameters driving the service provider implementation at CDK layer,
* *CDK interceptor parameters* that are parameters driving interceptors at CDK layer,
* *Dedicated parameters* that are parameters driving the service provider implementation at component layer.
h4. CDK parameters defining service provider implementation
The following parameters correspond to the CDK configuration of the service provider implementation.
{include:0 CDK SU Provide Configuration 5.8.0}
h4. CDK parameters driving interceptors
The following parameters drive interceptors at CDK layer.
{include:0 CDK SU Interceptor configuration}
h4. Dedicated configuration
The following parameters correspond to the component specific configuration of the service provider implementation.
{table-plus}
|| Attribute || Description || Default value || Required ||
| http-method | HTTP method to use. Possible values are: GET, POST, PUT and DELETE. | {center}-{center} | {center}Yes\*{center} |
| http-body-type | Define which kind of HTTP body the resource is expecting:
* NO_BODY: no HTTP body is expected,
* XML: the HTTP body is filled with the incoming XML payload, possibly transformed by the XSL tansformation defined with '{{xsl}}',
* JSON: the HTTP body is filled with the incoming XML payload, possibly transformed by the XSL tansformation defined with '{{xsl}}', converted into JSON,
* POST_QUERY_STRING:
* MULTIPART_FORMDATA: A multi-part HTTP request is built. Each part will be defined using '{{form-data}}',
* ATTACHMENT: the attachment of the incoming JBI request is used as HTTP request body. By default the header 'Content-Type' of the HTTP request is initialized with the attachment MIME type. | {center}-{center} | {center}Yes{center} |
| uri | URI template of the external resource.
Value of substitutable parameters are retrieved from XPath expressions given by '{{xpath-param}}', or retrieved from JBI message properties. | {center}-{center} | {center}Yes\*{center} |
| buffer-request | if the request should be buffered to be sent, mostly useful with authentication methods that requires multiple retries. | {center}{{false}}{center} | {center}No{center} |
| trust-all-certificates | Do not fail if an HTTPS connection uses an untrusted certificate (self-signed, expired, etc). DO NOT USE IN PRODUCTION. | {center}{{false}}{center} | {center}No{center} |
| xpath-param | Define how to retrieve an URI template parameter as an XPath expression executed on the incoming payload. The attribute {{name}} is the name of the parameter in the URI template, and the value is the XPath expression to apply. | {center}-{center} | {center}Yes, if at least one parameter is included into the URI template{center} |
| authentication | Defines the authentication to set on the REST request.
{code}
<rest:authentication>
<rest:basic>
<rest:username><rest:constant>${username}</rest:constant></rest:username>
<rest:password><rest:xpath>//*[local-name()='password']</rest:xpath></rest:password>
</rest:basic>
</rest:authentication>
{code}
Available authentication are:
* *Basic authentication*, using '{{<basic />}}', and having following parameters:
** {{<username />}}: the username to use
*** '{{<constant />}}', the username is a constant, placeholders are supported,
*** '{{<xpath />}}', the username value is extracted from the incoming payload by an XPath expression.
** {{<password />}}: the password to use
*** '{{<constant />}}', the password is a constant, placeholders are supported,
*** '{{<xpath />}}', the password value is extracted from the incoming payload by an XPath expression.
* *JWT (Java Web Token) based authentication*, using '{{<jwt />}}', and having following parameters:
** {{<claim />}}: defines a list of claims to include in the token
*** {{<name />}}: the claim name
**** '{{<constant />}}', the claim name is a constant, placeholders are supported,
**** '{{<xpath />}}', the claim name is extracted from the incoming payload by an XPath expression,
*** {{<value />}}: the claim value
**** '{{<constant />}}', the claim value is a constant, placeholders are supported,
**** '{{<xpath />}}', the claim value is extracted from the incoming payload by an XPath expression,
** {{<compress-with />}}: defines a compression algorithm. Available values are: {{DEF}} (JWA standard deflate compression algorithm) or {{GZIP}} (gzip compression algorithm),
** {{<sign-with />}}: defines the token signature (algorithm and key):
*** {{algorithm}}: attribute defining the signature algorithm. All algorithms accepted by library [io.jsonwebtoken:jjwt:0.6.0|https://github.com/jwtk/jjwt] are supported.
*** {{<key-file-url />}}: URL of the key file to use to sign the token. Placeholders are accepted in the key URL definition.
* *NTLM authentication*, using '{{<ntlm />}}', and having following parameters:
** {{<username />}}: the username to use
*** '{{<constant />}}', the username is a constant, placeholders are supported,
*** '{{<xpath />}}', the username value is extracted from the incoming payload by an XPath expression.
** {{<password />}}: the password to use
*** '{{<constant />}}', the password is a constant, placeholders are supported,
*** '{{<xpath />}}', the password value is extracted from the incoming payload by an XPath expression.
** {{<domain />}}: the Windows domain of the user to use
*** '{{<constant />}}', the domain is a constant, placeholders are supported,
*** '{{<xpath />}}', the domain value is extracted from the incoming payload by an XPath expression. | {center}-{center} | {center}No{center} |
| headers | Defines the HTTP headers to set on the REST request:
* each header defines through a sub-element '{{<header />}}' for which the attribute '{{name}}' is the name of the header,
* the value to set is defined by the content of the sub-element '{{<header />}}':
** '{{<constant />}}', the constant of this tag will be used as header value,
** '{{<xpath />}}', the header value is extracted from the incoming payload by an XPath expression
{code}
<rest:headers>
<rest:header name="Accept"><rest:constant>application/xml</rest:constant><rest:header>
<rest:header name="X-RequestDigest"><rest:xpath>/update/token</rest:xpath><rest:header>
<rest:headers>
{code} | {center}-{center} | {center}No{center} |
| xsl | A XSL style-sheet used to transform the incoming XML payload before to generate the HTTP body of the REST request. The result of this transformation will be used to be converted into JSON or to be set as XML payload. The component placeholders are available as parameters from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0/placeholders}}'. The parameter name is the placeholder name, and its value the placeholder value. | {center}-{center} | {center}No{center} |
| xsl/@is-json-result | If {{true}}, the output of the XSL transforming the incoming XML payload will be considered as JSON to put in the HTTP body of the REST request. | {center}false{center} | {center}No{center} |
| response-body-as | Defined the body content type. By default, the body content-type is auto-detected according to the content-type of the HTTP response, but in few case it is necessary to specify it. Possible values are:
* {{auto}}: The body content type is auto-detected from the HTTP response content-type,
* {{xml}}: The body contains XML,
* {{json}}: The body contains JSON,
* {{attachment}}: The body is an attachment. | {center}{{auto}}{center} | {center}No{center} |
| on-http-status | Define how to process a given HTTP status:
* the attribute {{code}} is the HTTP code associated to this processing,
* the sub-elements '{{out}}', '{{fault}}' or '{{error}} define conditional transformations to apply on the HTTP body response if exists. The first condition evaluted to '{{true}}' determine the transformation that will be applied. The result of the transformation will be used as OUT response, fault or error. Several conditional transformations can be defined:
** the attribute '{{order-id}}' permits to order condition evaluations,
** the sub-element '{{condition}}' defines the condition to evaluate. Now, only XPath conditions are supported through the sub-element '{{xpath}}',
** the sub-element '{{transformation}}' defines the transformation to apply if the condition matches. Now, only XSL transformations are supported through the sub-element '{{xsl}}',
{tip}
If the HTTP body response is a XML or JSON payload, it is used as XML to be transformed according to the current {{on-http-status}} definition. Several XSL parameters are set to be used in the XSL transformation:
* the IN message payload can be loaded by the XSL through a variable using the XSL statement: {{<xsl:variable name="inPayload" select="document('petals-bc-rest:in-payload')"/>}}
* each URI parameter is available without namespace,
* the HTTP response status is available as parameters '{{http-status-code}}' and '{{http-status-reason}}' from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0}}',
* the headers of the HTTP response are available as parameters from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0/headers}}'. The parameter name is the HTTP header name, and its value the HTTP header value.
If the HTTP body response is not a XML or JSON payload, the IN message payload is used to be transformed according to the current {{on-htt-status}} definition. Several XSL parameters are set to be used in the XSL transformation:
* the content identifier of the attachment is available as parameter '{{content-id}}' from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0}}',
* the HTTP response status is available as parameters '{{http-status-code}}' and '{{http-status-reason}}' from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0}}',
* the headers of the HTTP response are available as parameters from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0/headers}}'. The parameter name is the HTTP header name, and its value the HTTP header value,
* each URI parameter is available without namespace,
{tip}
* the sub-elements '{{otherwise-out}}', '{{otherwise-fault}}' or '{{otherwise-error}} define the default transformation to apply when no condition transformation matches the HTTP body response. The result of the transformation will be used as OUT response, fault or error. Only one default transformation can be defined:
** the sub-element '{{transformation}}' defines the transformation to apply if the condition matches. Now, only XSL transformations are supported through the sub-element '{{xsl}}'. The available XSL parameters available are the same as the ones for '{{out}}', '{{fault}}' and '{{error}},
* if no default transformation is defined:
** if the HTTP code returned is 20X:
*** if the exchange is an InOut exchange, the HTTP body is put as OUT message,
*** otherwise (the exchange is InOnly or RobustInOnly), the status DONE is returned,
** otherwise, a status ERROR is returned. | {center}-{center} | {center}No{center} |
| form-data | Define the form data to put in a part of a multi-part HTTP request:
* the attribute '{{name}}' define the name of the form data,
* the sub-element '{{extracted-by-xpath}}' defines the XPath expression applied on the incoming request to compute the value to set into the form data. If the result of the XPath expression is the content identifier of an attachment of the incoming request, the attribute '{{as-attachment}}' drives the processing of the attachment: if '{{true}}', the attachment content will be put into the form data, otherwise the content id will be put. If you want to put the XPath result as a form field value, use the value '{{false}}'.
* the sub-element '{{attachment-name}}' can be used to transmitted an attachment name to the REST server. This sub-element has only sens with an attachment form data. The attachment name can be defined as a constant value through the sub-element '{{constant}}' or as a XPath expression through the sub-element '{{xpath}}'. | {center}-{center} | {center}No{center} |
| http-body-to-json-multiple-pi | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-from-json-multiple-pi | This parameter drives the conversion of JSON to XML. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-to-json-virtual-root | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}-{center} | {center}No{center} |
| http-body-from-json-virtual-root | This parameter drives the conversion of JSON to XML. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}-{center} | {center}No{center} |
| http-body-to-json-auto-array | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-to-json-auto-primitive | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-to-json-pretty-print | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-to-json-ns-declarations | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| namespace-mapping | This parameter drives the conversion of XML to JSON. The prefix is defined by attribute {{prefix}}. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}-{center} | {center}No{center} |
{table-plus}
h4. Service unit content
The service unit has to contain the following elements, packaged in the archive:
* the META-INF/jbi.xml descriptor file as described above,
* it is also highly recommended to provide a WSDL description for service provider embeded in the service-unit,
* XSL files referenced in the JBI descriptor.
h4. Example
* *JBI parameters* that defines the service provider identification,
* *CDK parameters* that are parameters driving the service provider implementation at CDK layer,
* *CDK interceptor parameters* that are parameters driving interceptors at CDK layer,
* *Dedicated parameters* that are parameters driving the service provider implementation at component layer.
h4. CDK parameters defining service provider implementation
The following parameters correspond to the CDK configuration of the service provider implementation.
{include:0 CDK SU Provide Configuration 5.8.0}
h4. CDK parameters driving interceptors
The following parameters drive interceptors at CDK layer.
{include:0 CDK SU Interceptor configuration}
h4. Dedicated configuration
The following parameters correspond to the component specific configuration of the service provider implementation.
{table-plus}
|| Attribute || Description || Default value || Required ||
| http-method | HTTP method to use. Possible values are: GET, POST, PUT and DELETE. | {center}-{center} | {center}Yes\*{center} |
| http-body-type | Define which kind of HTTP body the resource is expecting:
* NO_BODY: no HTTP body is expected,
* XML: the HTTP body is filled with the incoming XML payload, possibly transformed by the XSL tansformation defined with '{{xsl}}',
* JSON: the HTTP body is filled with the incoming XML payload, possibly transformed by the XSL tansformation defined with '{{xsl}}', converted into JSON,
* POST_QUERY_STRING:
* MULTIPART_FORMDATA: A multi-part HTTP request is built. Each part will be defined using '{{form-data}}',
* ATTACHMENT: the attachment of the incoming JBI request is used as HTTP request body. By default the header 'Content-Type' of the HTTP request is initialized with the attachment MIME type. | {center}-{center} | {center}Yes{center} |
| uri | URI template of the external resource.
Value of substitutable parameters are retrieved from XPath expressions given by '{{xpath-param}}', or retrieved from JBI message properties. | {center}-{center} | {center}Yes\*{center} |
| buffer-request | if the request should be buffered to be sent, mostly useful with authentication methods that requires multiple retries. | {center}{{false}}{center} | {center}No{center} |
| trust-all-certificates | Do not fail if an HTTPS connection uses an untrusted certificate (self-signed, expired, etc). DO NOT USE IN PRODUCTION. | {center}{{false}}{center} | {center}No{center} |
| xpath-param | Define how to retrieve an URI template parameter as an XPath expression executed on the incoming payload. The attribute {{name}} is the name of the parameter in the URI template, and the value is the XPath expression to apply. | {center}-{center} | {center}Yes, if at least one parameter is included into the URI template{center} |
| authentication | Defines the authentication to set on the REST request.
{code}
<rest:authentication>
<rest:basic>
<rest:username><rest:constant>${username}</rest:constant></rest:username>
<rest:password><rest:xpath>//*[local-name()='password']</rest:xpath></rest:password>
</rest:basic>
</rest:authentication>
{code}
Available authentication are:
* *Basic authentication*, using '{{<basic />}}', and having following parameters:
** {{<username />}}: the username to use
*** '{{<constant />}}', the username is a constant, placeholders are supported,
*** '{{<xpath />}}', the username value is extracted from the incoming payload by an XPath expression.
** {{<password />}}: the password to use
*** '{{<constant />}}', the password is a constant, placeholders are supported,
*** '{{<xpath />}}', the password value is extracted from the incoming payload by an XPath expression.
* *JWT (Java Web Token) based authentication*, using '{{<jwt />}}', and having following parameters:
** {{<claim />}}: defines a list of claims to include in the token
*** {{<name />}}: the claim name
**** '{{<constant />}}', the claim name is a constant, placeholders are supported,
**** '{{<xpath />}}', the claim name is extracted from the incoming payload by an XPath expression,
*** {{<value />}}: the claim value
**** '{{<constant />}}', the claim value is a constant, placeholders are supported,
**** '{{<xpath />}}', the claim value is extracted from the incoming payload by an XPath expression,
** {{<compress-with />}}: defines a compression algorithm. Available values are: {{DEF}} (JWA standard deflate compression algorithm) or {{GZIP}} (gzip compression algorithm),
** {{<sign-with />}}: defines the token signature (algorithm and key):
*** {{algorithm}}: attribute defining the signature algorithm. All algorithms accepted by library [io.jsonwebtoken:jjwt:0.6.0|https://github.com/jwtk/jjwt] are supported.
*** {{<key-file-url />}}: URL of the key file to use to sign the token. Placeholders are accepted in the key URL definition.
* *NTLM authentication*, using '{{<ntlm />}}', and having following parameters:
** {{<username />}}: the username to use
*** '{{<constant />}}', the username is a constant, placeholders are supported,
*** '{{<xpath />}}', the username value is extracted from the incoming payload by an XPath expression.
** {{<password />}}: the password to use
*** '{{<constant />}}', the password is a constant, placeholders are supported,
*** '{{<xpath />}}', the password value is extracted from the incoming payload by an XPath expression.
** {{<domain />}}: the Windows domain of the user to use
*** '{{<constant />}}', the domain is a constant, placeholders are supported,
*** '{{<xpath />}}', the domain value is extracted from the incoming payload by an XPath expression. | {center}-{center} | {center}No{center} |
| headers | Defines the HTTP headers to set on the REST request:
* each header defines through a sub-element '{{<header />}}' for which the attribute '{{name}}' is the name of the header,
* the value to set is defined by the content of the sub-element '{{<header />}}':
** '{{<constant />}}', the constant of this tag will be used as header value,
** '{{<xpath />}}', the header value is extracted from the incoming payload by an XPath expression
{code}
<rest:headers>
<rest:header name="Accept"><rest:constant>application/xml</rest:constant><rest:header>
<rest:header name="X-RequestDigest"><rest:xpath>/update/token</rest:xpath><rest:header>
<rest:headers>
{code} | {center}-{center} | {center}No{center} |
| xsl | A XSL style-sheet used to transform the incoming XML payload before to generate the HTTP body of the REST request. The result of this transformation will be used to be converted into JSON or to be set as XML payload. The component placeholders are available as parameters from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0/placeholders}}'. The parameter name is the placeholder name, and its value the placeholder value. | {center}-{center} | {center}No{center} |
| xsl/@is-json-result | If {{true}}, the output of the XSL transforming the incoming XML payload will be considered as JSON to put in the HTTP body of the REST request. | {center}false{center} | {center}No{center} |
| response-body-as | Defined the body content type. By default, the body content-type is auto-detected according to the content-type of the HTTP response, but in few case it is necessary to specify it. Possible values are:
* {{auto}}: The body content type is auto-detected from the HTTP response content-type,
* {{xml}}: The body contains XML,
* {{json}}: The body contains JSON,
* {{attachment}}: The body is an attachment. | {center}{{auto}}{center} | {center}No{center} |
| on-http-status | Define how to process a given HTTP status:
* the attribute {{code}} is the HTTP code associated to this processing,
* the sub-elements '{{out}}', '{{fault}}' or '{{error}} define conditional transformations to apply on the HTTP body response if exists. The first condition evaluted to '{{true}}' determine the transformation that will be applied. The result of the transformation will be used as OUT response, fault or error. Several conditional transformations can be defined:
** the attribute '{{order-id}}' permits to order condition evaluations,
** the sub-element '{{condition}}' defines the condition to evaluate. Now, only XPath conditions are supported through the sub-element '{{xpath}}',
** the sub-element '{{transformation}}' defines the transformation to apply if the condition matches. Now, only XSL transformations are supported through the sub-element '{{xsl}}',
{tip}
If the HTTP body response is a XML or JSON payload, it is used as XML to be transformed according to the current {{on-http-status}} definition. Several XSL parameters are set to be used in the XSL transformation:
* the IN message payload can be loaded by the XSL through a variable using the XSL statement: {{<xsl:variable name="inPayload" select="document('petals-bc-rest:in-payload')"/>}}
* each URI parameter is available without namespace,
* the HTTP response status is available as parameters '{{http-status-code}}' and '{{http-status-reason}}' from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0}}',
* the headers of the HTTP response are available as parameters from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0/headers}}'. The parameter name is the HTTP header name, and its value the HTTP header value.
If the HTTP body response is not a XML or JSON payload, the IN message payload is used to be transformed according to the current {{on-htt-status}} definition. Several XSL parameters are set to be used in the XSL transformation:
* the content identifier of the attachment is available as parameter '{{content-id}}' from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0}}',
* the HTTP response status is available as parameters '{{http-status-code}}' and '{{http-status-reason}}' from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0}}',
* the headers of the HTTP response are available as parameters from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0/headers}}'. The parameter name is the HTTP header name, and its value the HTTP header value,
* each URI parameter is available without namespace,
{tip}
* the sub-elements '{{otherwise-out}}', '{{otherwise-fault}}' or '{{otherwise-error}} define the default transformation to apply when no condition transformation matches the HTTP body response. The result of the transformation will be used as OUT response, fault or error. Only one default transformation can be defined:
** the sub-element '{{transformation}}' defines the transformation to apply if the condition matches. Now, only XSL transformations are supported through the sub-element '{{xsl}}'. The available XSL parameters available are the same as the ones for '{{out}}', '{{fault}}' and '{{error}},
* if no default transformation is defined:
** if the HTTP code returned is 20X:
*** if the exchange is an InOut exchange, the HTTP body is put as OUT message,
*** otherwise (the exchange is InOnly or RobustInOnly), the status DONE is returned,
** otherwise, a status ERROR is returned. | {center}-{center} | {center}No{center} |
| form-data | Define the form data to put in a part of a multi-part HTTP request:
* the attribute '{{name}}' define the name of the form data,
* the sub-element '{{extracted-by-xpath}}' defines the XPath expression applied on the incoming request to compute the value to set into the form data. If the result of the XPath expression is the content identifier of an attachment of the incoming request, the attribute '{{as-attachment}}' drives the processing of the attachment: if '{{true}}', the attachment content will be put into the form data, otherwise the content id will be put. If you want to put the XPath result as a form field value, use the value '{{false}}'.
* the sub-element '{{attachment-name}}' can be used to transmitted an attachment name to the REST server. This sub-element has only sens with an attachment form data. The attachment name can be defined as a constant value through the sub-element '{{constant}}' or as a XPath expression through the sub-element '{{xpath}}'. | {center}-{center} | {center}No{center} |
| http-body-to-json-multiple-pi | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-from-json-multiple-pi | This parameter drives the conversion of JSON to XML. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-to-json-virtual-root | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}-{center} | {center}No{center} |
| http-body-from-json-virtual-root | This parameter drives the conversion of JSON to XML. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}-{center} | {center}No{center} |
| http-body-to-json-auto-array | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-to-json-auto-primitive | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-to-json-pretty-print | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-to-json-ns-declarations | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| namespace-mapping | This parameter drives the conversion of XML to JSON. The prefix is defined by attribute {{prefix}}. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}-{center} | {center}No{center} |
{table-plus}
h4. Service unit content
The service unit has to contain the following elements, packaged in the archive:
* the META-INF/jbi.xml descriptor file as described above,
* it is also highly recommended to provide a WSDL description for service provider embeded in the service-unit,
* XSL files referenced in the JBI descriptor.
h4. Example
{code:xml}
<jbi:jbi xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cdk5="http://petals.ow2.org/components/extensions/version-5"
<jbi:jbi xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cdk5="http://petals.ow2.org/components/extensions/version-5"
{code}
The Service Unit has to contain the following elements, packaged in the archive:
* the META-INF/jbi.xml descriptor file as described above,
* XSL files referenced in the JBI descriptor.
* the META-INF/jbi.xml descriptor file as described above,
* XSL files referenced in the JBI descriptor.
h3. With a WADL
Using a WADL file simplifies the implementation of the service provider:
The * the address of the RESTful Web Service is found in the WADL.
The * the REST operation corresponding to the JBI operation is found in the WADL.
The * the HTTP method is defined in the WADL for the operation.
The Service Unit has to contain the following elements, packaged in the archive:
* The META-INF/jbi.xml descriptor file as described above,
* An optional imported WADL file describing the partner service.
* The META-INF/jbi.xml descriptor file as described above,
* An optional imported WADL file describing the partner service.
All needed information must be defined in the service-unit JBI descriptor. This JBI descriptor is configured through parameters divided in following groups:
* *JBI parameters* that defines the service provider identification,
* *CDK parameters* that are parameters driving the service provider implementation at CDK layer,
* *Dedicated parameters* that are parameters driving the service provider implementation at component layer.
* *JBI parameters* that defines the service provider identification,
* *CDK parameters* that are parameters driving the service provider implementation at CDK layer,
* *Dedicated parameters* that are parameters driving the service provider implementation at component layer.
h3. With a WSDL 2.0
h4. CDK parameters
The following parameters correspond to the CDK configuration of the service provider implementation.
The following parameters correspond to the CDK configuration of the service provider implementation.
The address of the RESTful Web Service is found in the 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.
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.
{include:0 CDK SU Provide Configuration 5.8.0}
The Service Unit has to contain the following elements, packaged in the archive:
* The META-INF/jbi.xml descriptor file as described above,
* An optional imported WSDL 2.0 file describing the partner service.
* The META-INF/jbi.xml descriptor file as described above,
* An optional imported WSDL 2.0 file describing the partner service.
h4. Dedicated configuration
The following parameters correspond to the component specific configuration of the service provider implementation.
The following parameters correspond to the component specific configuration of the service provider implementation.
{include:0 CDK SU Provide Configuration 5.7.0}
{anchor:service-unit-attributes-provide}
{center}{*}Service Unit attributes to provide services{*}{center}
{anchor:service-unit-attributes-provide}
{center}{*}Service Unit attributes to provide services{*}{center}
{table-plus}
|| Attribute || Description || Default value || Required ||
|| Attribute || Description || Default value || Required ||
| http-method | HTTP method to use. Possible values are: GET, POST, PUT and DELETE. | {center}-{center} | {center}Yes\*{center} |
| http-body-type | Define which kind of HTTP body the resource is expecting:
* NO_BODY: no HTTP body is expected,
* XML: the HTTP body is filled with the incoming XML payload, possibly transformed by the XSL tansformation defined with '{{xsl}}',
* JSON: the HTTP body is filled with the incoming XML payload, possibly transformed by the XSL tansformation defined with '{{xsl}}', converted into JSON,
* POST_QUERY_STRING:
* MULTIPART_FORMDATA: A multi-part HTTP request is built. Each part will be defined using '{{form-data}}',
* ATTACHMENT: the attachment of the incoming JBI request is used as HTTP request body. By default the header 'Content-Type' of the HTTP request is initialized with the attachment MIME type. | {center}-{center} | {center}Yes{center} |
| uri | URI template of the external resource.
Value of substitutable parameters are retrieved from XPath expressions given by '{{xpath-param}}', or retrieved from JBI message properties. | {center}-{center} | {center}Yes\*{center} |
| buffer-request | if the request should be buffered to be sent, mostly useful with authentication methods that requires multiple retries. | {center}{{false}}{center} | {center}No{center} |
| trust-all-certificates | Do not fail if an HTTPS connection uses an untrusted certificate (self-signed, expired, etc). DO NOT USE IN PRODUCTION. | {center}{{false}}{center} | {center}No{center} |
| xpath-param | Define how to retrieve an URI template parameter as an XPath expression executed on the incoming payload. The attribute {{name}} is the name of the parameter in the URI template, and the value is the XPath expression to apply. | {center}-{center} | {center}Yes, if at least one parameter is included into the URI template{center} |
| authentication | Defines the authentication to set on the REST request.
{code}
<rest:authentication>
<rest:basic>
<rest:username><rest:constant>${username}</rest:constant></rest:username>
<rest:password><rest:xpath>//*[local-name()='password']</rest:xpath></rest:password>
</rest:basic>
</rest:authentication>
{code}
Available authentication are:
* *Basic authentication*, using '{{<basic />}}', and having following parameters:
** {{<username />}}: the username to use
*** '{{<constant />}}', the username is a constant, placeholders are supported,
*** '{{<xpath />}}', the username value is extracted from the incoming payload by an XPath expression.
** {{<password />}}: the password to use
*** '{{<constant />}}', the password is a constant, placeholders are supported,
*** '{{<xpath />}}', the password value is extracted from the incoming payload by an XPath expression.
* *JWT (Java Web Token) based authentication*, using '{{<jwt />}}', and having following parameters:
** {{<claim />}}: defines a list of claims to include in the token
*** {{<name />}}: the claim name
**** '{{<constant />}}', the claim name is a constant, placeholders are supported,
**** '{{<xpath />}}', the claim name is extracted from the incoming payload by an XPath expression,
*** {{<value />}}: the claim value
**** '{{<constant />}}', the claim value is a constant, placeholders are supported,
**** '{{<xpath />}}', the claim value is extracted from the incoming payload by an XPath expression,
** {{<compress-with />}}: defines a compression algorithm. Available values are: {{DEF}} (JWA standard deflate compression algorithm) or {{GZIP}} (gzip compression algorithm),
** {{<sign-with />}}: defines the token signature (algorithm and key):
*** {{algorithm}}: attribute defining the signature algorithm. All algorithms accepted by library [io.jsonwebtoken:jjwt:0.6.0|https://github.com/jwtk/jjwt] are supported.
*** {{<key-file-url />}}: URL of the key file to use to sign the token. Placeholders are accepted in the key URL definition.
* *NTLM authentication*, using '{{<ntlm />}}', and having following parameters:
** {{<username />}}: the username to use
*** '{{<constant />}}', the username is a constant, placeholders are supported,
*** '{{<xpath />}}', the username value is extracted from the incoming payload by an XPath expression.
** {{<password />}}: the password to use
*** '{{<constant />}}', the password is a constant, placeholders are supported,
*** '{{<xpath />}}', the password value is extracted from the incoming payload by an XPath expression.
** {{<domain />}}: the Windows domain of the user to use
*** '{{<constant />}}', the domain is a constant, placeholders are supported,
*** '{{<xpath />}}', the domain value is extracted from the incoming payload by an XPath expression. | {center}-{center} | {center}No{center} |
| headers | Defines the HTTP headers to set on the REST request:
* each header defines through a sub-element '{{<header />}}' for which the attribute '{{name}}' is the name of the header,
* the value to set is defined by the content of the sub-element '{{<header />}}':
** '{{<constant />}}', the constant of this tag will be used as header value,
** '{{<xpath />}}', the header value is extracted from the incoming payload by an XPath expression
{code}
<rest:headers>
<rest:header name="Accept"><rest:constant>application/xml</rest:constant><rest:header>
<rest:header name="X-RequestDigest"><rest:xpath>/update/token</rest:xpath><rest:header>
<rest:headers>
{code} | {center}-{center} | {center}No{center} |
| xsl | A XSL style-sheet used to transform the incoming XML payload before to generate the HTTP body of the REST request. The result of this transformation will be used to be converted into JSON or to be set as XML payload. The component placeholders are available as parameters from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0/placeholders}}'. The parameter name is the placeholder name, and its value the placeholder value. | {center}-{center} | {center}No{center} |
| xsl/@is-json-result | If {{true}}, the output of the XSL transforming the incoming XML payload will be considered as JSON to put in the HTTP body of the REST request. | {center}false{center} | {center}No{center} |
| response-body-as | Defined the body content type. By default, the body content-type is auto-detected according to the content-type of the HTTP response, but in few case it is necessary to specify it. Possible values are:
* {{auto}}: The body content type is auto-detected from the HTTP response content-type,
* {{xml}}: The body contains XML,
* {{json}}: The body contains JSON,
* {{attachment}}: The body is an attachment. | {center}{{auto}}{center} | {center}No{center} |
| on-http-status | Define how to process a given HTTP status:
* the attribute {{code}} is the HTTP code associated to this processing,
* the sub-elements '{{out}}', '{{fault}}' or '{{error}} define conditional transformations to apply on the HTTP body response if exists. The first condition evaluted to '{{true}}' determine the transformation that will be applied. The result of the transformation will be used as OUT response, fault or error. Several conditional transformations can be defined:
** the attribute '{{order-id}}' permits to order condition evaluations,
** the sub-element '{{condition}}' defines the condition to evaluate. Now, only XPath conditions are supported through the sub-element '{{xpath}}',
** the sub-element '{{transformation}}' defines the transformation to apply if the condition matches. Now, only XSL transformations are supported through the sub-element '{{xsl}}',
{tip}
If the HTTP body response is a XML or JSON payload, it is used as XML to be transformed according to the current {{on-http-status}} definition. Several XSL parameters are set to be used in the XSL transformation:
* the IN message payload can be loaded by the XSL through a variable using the XSL statement: {{<xsl:variable name="inPayload" select="document('petals-bc-rest:in-payload')"/>}}
* each URI parameter is available without namespace,
* the HTTP response status is available as parameters '{{http-status-code}}' and '{{http-status-reason}}' from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0}}',
* the headers of the HTTP response are available as parameters from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0/headers}}'. The parameter name is the HTTP header name, and its value the HTTP header value.
If the HTTP body response is not a XML or JSON payload, the IN message payload is used to be transformed according to the current {{on-htt-status}} definition. Several XSL parameters are set to be used in the XSL transformation:
* the content identifier of the attachment is available as parameter '{{content-id}}' from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0}}',
* the HTTP response status is available as parameters '{{http-status-code}}' and '{{http-status-reason}}' from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0}}',
* the headers of the HTTP response are available as parameters from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0/headers}}'. The parameter name is the HTTP header name, and its value the HTTP header value,
* each URI parameter is available without namespace,
{tip}
* the sub-elements '{{otherwise-out}}', '{{otherwise-fault}}' or '{{otherwise-error}} define the default transformation to apply when no condition transformation matches the HTTP body response. The result of the transformation will be used as OUT response, fault or error. Only one default transformation can be defined:
** the sub-element '{{transformation}}' defines the transformation to apply if the condition matches. Now, only XSL transformations are supported through the sub-element '{{xsl}}'. The available XSL parameters available are the same as the ones for '{{out}}', '{{fault}}' and '{{error}},
* if no default transformation is defined:
** if the HTTP code returned is 20X:
*** if the exchange is an InOut exchange, the HTTP body is put as OUT message,
*** otherwise (the exchange is InOnly or RobustInOnly), the status DONE is returned,
** otherwise, a status ERROR is returned. | {center}-{center} | {center}No{center} |
| form-data | Define the form data to put in a part of a multi-part HTTP request:
* the attribute '{{name}}' define the name of the form data,
* the sub-element '{{extracted-by-xpath}}' defines the XPath expression applied on the incoming request to compute the value to set into the form data. If the result of the XPath expression is the content identifier of an attachment of the incoming request, the attribute '{{as-attachment}}' drives the processing of the attachment: if '{{true}}', the attachment content will be put into the form data, otherwise the content id will be put. If you want to put the XPath result as a form field value, use the value '{{false}}'.
* the sub-element '{{attachment-name}}' can be used to transmitted an attachment name to the REST server. This sub-element has only sens with an attachment form data. The attachment name can be defined as a constant value through the sub-element '{{constant}}' or as a XPath expression through the sub-element '{{xpath}}'. | {center}-{center} | {center}No{center} |
| http-body-to-json-multiple-pi | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-from-json-multiple-pi | This parameter drives the conversion of JSON to XML. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-to-json-virtual-root | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}-{center} | {center}No{center} |
| http-body-from-json-virtual-root | This parameter drives the conversion of JSON to XML. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}-{center} | {center}No{center} |
| http-body-to-json-auto-array | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-to-json-auto-primitive | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-to-json-pretty-print | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-to-json-ns-declarations | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| namespace-mapping | This parameter drives the conversion of XML to JSON. The prefix is defined by attribute {{prefix}}. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}-{center} | {center}No{center} |
| http-body-type | Define which kind of HTTP body the resource is expecting:
* NO_BODY: no HTTP body is expected,
* XML: the HTTP body is filled with the incoming XML payload, possibly transformed by the XSL tansformation defined with '{{xsl}}',
* JSON: the HTTP body is filled with the incoming XML payload, possibly transformed by the XSL tansformation defined with '{{xsl}}', converted into JSON,
* POST_QUERY_STRING:
* MULTIPART_FORMDATA: A multi-part HTTP request is built. Each part will be defined using '{{form-data}}',
* ATTACHMENT: the attachment of the incoming JBI request is used as HTTP request body. By default the header 'Content-Type' of the HTTP request is initialized with the attachment MIME type. | {center}-{center} | {center}Yes{center} |
| uri | URI template of the external resource.
Value of substitutable parameters are retrieved from XPath expressions given by '{{xpath-param}}', or retrieved from JBI message properties. | {center}-{center} | {center}Yes\*{center} |
| buffer-request | if the request should be buffered to be sent, mostly useful with authentication methods that requires multiple retries. | {center}{{false}}{center} | {center}No{center} |
| trust-all-certificates | Do not fail if an HTTPS connection uses an untrusted certificate (self-signed, expired, etc). DO NOT USE IN PRODUCTION. | {center}{{false}}{center} | {center}No{center} |
| xpath-param | Define how to retrieve an URI template parameter as an XPath expression executed on the incoming payload. The attribute {{name}} is the name of the parameter in the URI template, and the value is the XPath expression to apply. | {center}-{center} | {center}Yes, if at least one parameter is included into the URI template{center} |
| authentication | Defines the authentication to set on the REST request.
{code}
<rest:authentication>
<rest:basic>
<rest:username><rest:constant>${username}</rest:constant></rest:username>
<rest:password><rest:xpath>//*[local-name()='password']</rest:xpath></rest:password>
</rest:basic>
</rest:authentication>
{code}
Available authentication are:
* *Basic authentication*, using '{{<basic />}}', and having following parameters:
** {{<username />}}: the username to use
*** '{{<constant />}}', the username is a constant, placeholders are supported,
*** '{{<xpath />}}', the username value is extracted from the incoming payload by an XPath expression.
** {{<password />}}: the password to use
*** '{{<constant />}}', the password is a constant, placeholders are supported,
*** '{{<xpath />}}', the password value is extracted from the incoming payload by an XPath expression.
* *JWT (Java Web Token) based authentication*, using '{{<jwt />}}', and having following parameters:
** {{<claim />}}: defines a list of claims to include in the token
*** {{<name />}}: the claim name
**** '{{<constant />}}', the claim name is a constant, placeholders are supported,
**** '{{<xpath />}}', the claim name is extracted from the incoming payload by an XPath expression,
*** {{<value />}}: the claim value
**** '{{<constant />}}', the claim value is a constant, placeholders are supported,
**** '{{<xpath />}}', the claim value is extracted from the incoming payload by an XPath expression,
** {{<compress-with />}}: defines a compression algorithm. Available values are: {{DEF}} (JWA standard deflate compression algorithm) or {{GZIP}} (gzip compression algorithm),
** {{<sign-with />}}: defines the token signature (algorithm and key):
*** {{algorithm}}: attribute defining the signature algorithm. All algorithms accepted by library [io.jsonwebtoken:jjwt:0.6.0|https://github.com/jwtk/jjwt] are supported.
*** {{<key-file-url />}}: URL of the key file to use to sign the token. Placeholders are accepted in the key URL definition.
* *NTLM authentication*, using '{{<ntlm />}}', and having following parameters:
** {{<username />}}: the username to use
*** '{{<constant />}}', the username is a constant, placeholders are supported,
*** '{{<xpath />}}', the username value is extracted from the incoming payload by an XPath expression.
** {{<password />}}: the password to use
*** '{{<constant />}}', the password is a constant, placeholders are supported,
*** '{{<xpath />}}', the password value is extracted from the incoming payload by an XPath expression.
** {{<domain />}}: the Windows domain of the user to use
*** '{{<constant />}}', the domain is a constant, placeholders are supported,
*** '{{<xpath />}}', the domain value is extracted from the incoming payload by an XPath expression. | {center}-{center} | {center}No{center} |
| headers | Defines the HTTP headers to set on the REST request:
* each header defines through a sub-element '{{<header />}}' for which the attribute '{{name}}' is the name of the header,
* the value to set is defined by the content of the sub-element '{{<header />}}':
** '{{<constant />}}', the constant of this tag will be used as header value,
** '{{<xpath />}}', the header value is extracted from the incoming payload by an XPath expression
{code}
<rest:headers>
<rest:header name="Accept"><rest:constant>application/xml</rest:constant><rest:header>
<rest:header name="X-RequestDigest"><rest:xpath>/update/token</rest:xpath><rest:header>
<rest:headers>
{code} | {center}-{center} | {center}No{center} |
| xsl | A XSL style-sheet used to transform the incoming XML payload before to generate the HTTP body of the REST request. The result of this transformation will be used to be converted into JSON or to be set as XML payload. The component placeholders are available as parameters from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0/placeholders}}'. The parameter name is the placeholder name, and its value the placeholder value. | {center}-{center} | {center}No{center} |
| xsl/@is-json-result | If {{true}}, the output of the XSL transforming the incoming XML payload will be considered as JSON to put in the HTTP body of the REST request. | {center}false{center} | {center}No{center} |
| response-body-as | Defined the body content type. By default, the body content-type is auto-detected according to the content-type of the HTTP response, but in few case it is necessary to specify it. Possible values are:
* {{auto}}: The body content type is auto-detected from the HTTP response content-type,
* {{xml}}: The body contains XML,
* {{json}}: The body contains JSON,
* {{attachment}}: The body is an attachment. | {center}{{auto}}{center} | {center}No{center} |
| on-http-status | Define how to process a given HTTP status:
* the attribute {{code}} is the HTTP code associated to this processing,
* the sub-elements '{{out}}', '{{fault}}' or '{{error}} define conditional transformations to apply on the HTTP body response if exists. The first condition evaluted to '{{true}}' determine the transformation that will be applied. The result of the transformation will be used as OUT response, fault or error. Several conditional transformations can be defined:
** the attribute '{{order-id}}' permits to order condition evaluations,
** the sub-element '{{condition}}' defines the condition to evaluate. Now, only XPath conditions are supported through the sub-element '{{xpath}}',
** the sub-element '{{transformation}}' defines the transformation to apply if the condition matches. Now, only XSL transformations are supported through the sub-element '{{xsl}}',
{tip}
If the HTTP body response is a XML or JSON payload, it is used as XML to be transformed according to the current {{on-http-status}} definition. Several XSL parameters are set to be used in the XSL transformation:
* the IN message payload can be loaded by the XSL through a variable using the XSL statement: {{<xsl:variable name="inPayload" select="document('petals-bc-rest:in-payload')"/>}}
* each URI parameter is available without namespace,
* the HTTP response status is available as parameters '{{http-status-code}}' and '{{http-status-reason}}' from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0}}',
* the headers of the HTTP response are available as parameters from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0/headers}}'. The parameter name is the HTTP header name, and its value the HTTP header value.
If the HTTP body response is not a XML or JSON payload, the IN message payload is used to be transformed according to the current {{on-htt-status}} definition. Several XSL parameters are set to be used in the XSL transformation:
* the content identifier of the attachment is available as parameter '{{content-id}}' from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0}}',
* the HTTP response status is available as parameters '{{http-status-code}}' and '{{http-status-reason}}' from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0}}',
* the headers of the HTTP response are available as parameters from namespace '{{http://petals.ow2.org/bc/rest/xsl/param/output/1.0/headers}}'. The parameter name is the HTTP header name, and its value the HTTP header value,
* each URI parameter is available without namespace,
{tip}
* the sub-elements '{{otherwise-out}}', '{{otherwise-fault}}' or '{{otherwise-error}} define the default transformation to apply when no condition transformation matches the HTTP body response. The result of the transformation will be used as OUT response, fault or error. Only one default transformation can be defined:
** the sub-element '{{transformation}}' defines the transformation to apply if the condition matches. Now, only XSL transformations are supported through the sub-element '{{xsl}}'. The available XSL parameters available are the same as the ones for '{{out}}', '{{fault}}' and '{{error}},
* if no default transformation is defined:
** if the HTTP code returned is 20X:
*** if the exchange is an InOut exchange, the HTTP body is put as OUT message,
*** otherwise (the exchange is InOnly or RobustInOnly), the status DONE is returned,
** otherwise, a status ERROR is returned. | {center}-{center} | {center}No{center} |
| form-data | Define the form data to put in a part of a multi-part HTTP request:
* the attribute '{{name}}' define the name of the form data,
* the sub-element '{{extracted-by-xpath}}' defines the XPath expression applied on the incoming request to compute the value to set into the form data. If the result of the XPath expression is the content identifier of an attachment of the incoming request, the attribute '{{as-attachment}}' drives the processing of the attachment: if '{{true}}', the attachment content will be put into the form data, otherwise the content id will be put. If you want to put the XPath result as a form field value, use the value '{{false}}'.
* the sub-element '{{attachment-name}}' can be used to transmitted an attachment name to the REST server. This sub-element has only sens with an attachment form data. The attachment name can be defined as a constant value through the sub-element '{{constant}}' or as a XPath expression through the sub-element '{{xpath}}'. | {center}-{center} | {center}No{center} |
| http-body-to-json-multiple-pi | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-from-json-multiple-pi | This parameter drives the conversion of JSON to XML. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-to-json-virtual-root | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}-{center} | {center}No{center} |
| http-body-from-json-virtual-root | This parameter drives the conversion of JSON to XML. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}-{center} | {center}No{center} |
| http-body-to-json-auto-array | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-to-json-auto-primitive | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-to-json-pretty-print | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| http-body-to-json-ns-declarations | This parameter drives the conversion of XML to JSON. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}false{center} | {center}No{center} |
| namespace-mapping | This parameter drives the conversion of XML to JSON. The prefix is defined by attribute {{prefix}}. See https://github.com/beckchr/staxon/wiki/Factory-Configuration | {center}-{center} | {center}No{center} |
| wadl | WADL which defines the partner service | {center}-{center} | {center}Yes\*{center} |
| wsdl2 | WSDL2 which defines the partner service | {center}-{center} | {center}Yes\*{center} |
{table-plus}
\*Either {{uri}} and {{http-method}} extensions or {{wadl}} or {{wsdl2}} must be present in a specific SU.
h4. Service unit content
The service unit has to contain the following elements, packaged in the archive:
* the META-INF/jbi.xml descriptor file as described above,
* it is also highly recommended to provide a WSDL description for service provider embeded in the service-unit,
* a WADL file describing the partner service.
* the META-INF/jbi.xml descriptor file as described above,
* it is also highly recommended to provide a WSDL description for service provider embeded in the service-unit,
* a WADL file describing the partner service.
h1. Exposing an internal JBI service endpoint as a RESTful Web Service
The petals-bc-rest component can listen incoming REST messages and send messages to a JBI service endpoint by deploying a Service Unit on it. The component consumes the JBI service:
{center}