|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (1)
View Page Historyh2. Configuration
All needed information must be defined in the service-unit. See [Service Unit attributes to consume services|#service-unit-attributes-consume] for more information :
{code:xml}
<jbi:jbi version="1.0" ..>
<jbi:services binding-component="true">
<jbi:consumes interface-name="inscription-cantine:inscriptionCantine">
<cdk:timeout>${municipalite.timeout.clt-services.qf}</cdk:timeout>
<cdk:mep xsi:nil="true" />
<rest:service-base-path>/api/demarches-administratives</rest:service-base-path>
<rest:mapping>
<rest:operation name="inscription-cantine:new">
<!-- REST request part -->
<rest:http-method>POST</rest:http-method>
<rest:path-template>/demande-cantine</rest:path-template>
<rest:http-body-from-json-virtual-root>new</rest:http-body-from-json-virtual-root>
<rest:incoming-payload>
<rest:transformation>
<rest:xsl>new-request.xsl</rest:xsl>
</rest:transformation>
</rest:incoming-payload>
<!-- REST response part -->
<rest:on-jbi-response>
<rest:on-default-out>
<rest:http-response http-code="201">
<rest:header name="Access-Control-Allow-Origin">
<rest:constant>*</rest:constant>
</rest:header>
<rest:header name="Access-Control-Allow-Headers">
<rest:constant>Origin, X-Requested-With, Content-Type, Accept</rest:constant>
</rest:header>
<rest:http-body-to-json-virtual-root>newResponse</rest:http-body-to-json-virtual-root>
</rest:http-response>
</rest:on-default-out>
<rest:on-default-error>
<rest:http-response http-code="500" />
</rest:on-default-error>
</rest:on-jbi-response>
</rest:operation>
<rest:operation name="inscription-cantine:validate">
<!-- REST request part -->
<rest:http-method>PUT</rest:http-method>
<rest:path-template>/demande-cantine/{numero-demande}</rest:path-template>
<rest:http-body-from-json-virtual-root>validate</rest:http-body-from-json-virtual-root>
<rest:incoming-payload>
<rest:transformation>
<rest:xsl>validate-request.xsl</rest:xsl>
</rest:transformation>
</rest:incoming-payload>
<!-- REST response part -->
<rest:on-jbi-response>
<rest:on-default-out>
<rest:http-response http-code="202">
<rest:http-body-to-json-virtual-root>validateResponse</rest:http-body-to-json-virtual-root>
</rest:http-response>
</rest:on-default-out>
<rest:on-fault order-id="0">
<rest:condition>
<rest:xpath>boolean(//*[local-name()='inscriptionInconnue'])</rest:xpath>
</rest:condition>
<rest:http-response http-code="404" />
</rest:on-fault>
<rest:on-fault order-id="1">
<rest:condition>
<rest:xpath>boolean(//*[local-name()='inscriptionDejaValidee'])</rest:xpath>
</rest:condition>
<rest:http-response http-code="409" />
</rest:on-fault>
<rest:on-default-error>
<rest:http-response http-code="500" />
</rest:on-default-error>
</rest:on-jbi-response>
</rest:operation>
<rest:operation name="flowable-integration:getProcessInstances">
<!-- REST request part -->
<rest:http-method>GET</rest:http-method>
<rest:path-template>/usager-demandeur/{usager-demandeur}</rest:path-template>
<rest:http-body-from-json-virtual-root>getProcessInstances</rest:http-body-from-json-virtual-root>
<rest:xml-template>
<flowable-integration:getProcessInstances>
<flowable-integration:process-definition-identifier>inscriptionCantine</flowable-integration:process-definition-identifier>
<flowable-integration:variables>
<flowable-integration:variable name="citizen">{usager-demandeur}</flowable-integration:variable>
</flowable-integration:variables>
</flowable-integration:getProcessInstances>
</rest:xml-template>
<!-- REST response part -->
<rest:on-jbi-response>
<rest:on-default-out>
<rest:transformation>
<rest:xsl>demandes-usager.xsl</rest:xsl>
</rest:transformation>
<rest:http-response http-code="200">
<rest:header name="Access-Control-Allow-Origin">
<rest:constant>*</rest:constant>
</rest:header>
<rest:header name="Access-Control-Allow-Headers">
<rest:constant>Origin, X-Requested-With, Content-Type, Accept</rest:constant>
</rest:header>
<rest:http-body-to-json-auto-array>true</rest:http-body-to-json-auto-array>
</rest:http-response>
</rest:on-default-out>
<rest:on-default-error>
<rest:http-response http-code="500">
<rest:header name="Access-Control-Allow-Origin">
<rest:constant>*</rest:constant>
</rest:header>
<rest:header name="Access-Control-Allow-Headers">
<rest:constant>Origin, X-Requested-With, Content-Type, Accept</rest:constant>
</rest:header>
</rest:http-response>
</rest:on-default-error>
</rest:on-jbi-response>
</rest:operation>
</rest:mapping>
</jbi:consumes>
</jbi:services>
</jbi:jbi>
{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.
{code:xml}
<jbi:jbi version="1.0" ..>
<jbi:services binding-component="true">
<jbi:consumes interface-name="inscription-cantine:inscriptionCantine">
<cdk:timeout>${municipalite.timeout.clt-services.qf}</cdk:timeout>
<cdk:mep xsi:nil="true" />
<rest:service-base-path>/api/demarches-administratives</rest:service-base-path>
<rest:mapping>
<rest:operation name="inscription-cantine:new">
<!-- REST request part -->
<rest:http-method>POST</rest:http-method>
<rest:path-template>/demande-cantine</rest:path-template>
<rest:http-body-from-json-virtual-root>new</rest:http-body-from-json-virtual-root>
<rest:incoming-payload>
<rest:transformation>
<rest:xsl>new-request.xsl</rest:xsl>
</rest:transformation>
</rest:incoming-payload>
<!-- REST response part -->
<rest:on-jbi-response>
<rest:on-default-out>
<rest:http-response http-code="201">
<rest:header name="Access-Control-Allow-Origin">
<rest:constant>*</rest:constant>
</rest:header>
<rest:header name="Access-Control-Allow-Headers">
<rest:constant>Origin, X-Requested-With, Content-Type, Accept</rest:constant>
</rest:header>
<rest:http-body-to-json-virtual-root>newResponse</rest:http-body-to-json-virtual-root>
</rest:http-response>
</rest:on-default-out>
<rest:on-default-error>
<rest:http-response http-code="500" />
</rest:on-default-error>
</rest:on-jbi-response>
</rest:operation>
<rest:operation name="inscription-cantine:validate">
<!-- REST request part -->
<rest:http-method>PUT</rest:http-method>
<rest:path-template>/demande-cantine/{numero-demande}</rest:path-template>
<rest:http-body-from-json-virtual-root>validate</rest:http-body-from-json-virtual-root>
<rest:incoming-payload>
<rest:transformation>
<rest:xsl>validate-request.xsl</rest:xsl>
</rest:transformation>
</rest:incoming-payload>
<!-- REST response part -->
<rest:on-jbi-response>
<rest:on-default-out>
<rest:http-response http-code="202">
<rest:http-body-to-json-virtual-root>validateResponse</rest:http-body-to-json-virtual-root>
</rest:http-response>
</rest:on-default-out>
<rest:on-fault order-id="0">
<rest:condition>
<rest:xpath>boolean(//*[local-name()='inscriptionInconnue'])</rest:xpath>
</rest:condition>
<rest:http-response http-code="404" />
</rest:on-fault>
<rest:on-fault order-id="1">
<rest:condition>
<rest:xpath>boolean(//*[local-name()='inscriptionDejaValidee'])</rest:xpath>
</rest:condition>
<rest:http-response http-code="409" />
</rest:on-fault>
<rest:on-default-error>
<rest:http-response http-code="500" />
</rest:on-default-error>
</rest:on-jbi-response>
</rest:operation>
<rest:operation name="flowable-integration:getProcessInstances">
<!-- REST request part -->
<rest:http-method>GET</rest:http-method>
<rest:path-template>/usager-demandeur/{usager-demandeur}</rest:path-template>
<rest:http-body-from-json-virtual-root>getProcessInstances</rest:http-body-from-json-virtual-root>
<rest:xml-template>
<flowable-integration:getProcessInstances>
<flowable-integration:process-definition-identifier>inscriptionCantine</flowable-integration:process-definition-identifier>
<flowable-integration:variables>
<flowable-integration:variable name="citizen">{usager-demandeur}</flowable-integration:variable>
</flowable-integration:variables>
</flowable-integration:getProcessInstances>
</rest:xml-template>
<!-- REST response part -->
<rest:on-jbi-response>
<rest:on-default-out>
<rest:transformation>
<rest:xsl>demandes-usager.xsl</rest:xsl>
</rest:transformation>
<rest:http-response http-code="200">
<rest:header name="Access-Control-Allow-Origin">
<rest:constant>*</rest:constant>
</rest:header>
<rest:header name="Access-Control-Allow-Headers">
<rest:constant>Origin, X-Requested-With, Content-Type, Accept</rest:constant>
</rest:header>
<rest:http-body-to-json-auto-array>true</rest:http-body-to-json-auto-array>
</rest:http-response>
</rest:on-default-out>
<rest:on-default-error>
<rest:http-response http-code="500">
<rest:header name="Access-Control-Allow-Origin">
<rest:constant>*</rest:constant>
</rest:header>
<rest:header name="Access-Control-Allow-Headers">
<rest:constant>Origin, X-Requested-With, Content-Type, Accept</rest:constant>
</rest:header>
</rest:http-response>
</rest:on-default-error>
</rest:on-jbi-response>
</rest:operation>
</rest:mapping>
</jbi:consumes>
</jbi:services>
</jbi:jbi>
{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.
{include:0 CDK SU Consume Configuration 5.7.0}
\\
\\