JBoss.orgCommunity Documentation

SAVARA 1.0

Getting Started Guide


This section describes the installation procedure for SAVARA tools and runtime modules.

The pre-requisites for the SAVARA Eclipse Tools are:

  1. Eclipse JEE (3.5 or higher) http://www.eclipse.org
  2. SAVARA (version 1.0.0 or higher), available from http://www.jboss.org/savara/downloads
  3. JBoss Tools (3.1 or higher) http://www.jboss.org/tools available from an update site

The pre-requisites for the SAVARA Service Validator (for JBossESB) are:

  1. JBossAS (5.1.0.GA or higher) http://www.jboss.org/jbossas
  2. JBossAS (4.8 or higher) http://www.jboss.org/jbossesb
  3. SAVARA (version 1.0 or higher), available from http://www.jboss.org/savara/downloads

The installation instructions for the SAVARA Eclipse tools are:

The installation instructions for the SAVARA Service Validator (for JBossESB) are:

  1. JBossAS

    Download the latest version and follow its installation instructions.

  2. JBossESB

    Download the latest version and follow the instructions for installing it into the JBossAS environment.

  3. SAVARA

    Unpack the SAVARA distribution and edit the deployment.properties file in this ${SAVARA}/install folder. Set the org.jboss.as.home property to the root directory where the JBossAS environment is located, and change the org.jboss.as.config property from default if you wish to start your JBossAS using a different configuration. Set the org.jboss.esb.home property to the root directory where the JBossESB environment is located.

    Start a command window and execute the command ant deploy.

One of the stages within the architecture phase is to define the information model for the message types associated with the messages exchanges between the interacting participants.

This involves defining message schema for each example message. The schema could already exist and be reused, it could be based on existing schema and just need to be upgraded to support new requirements, or it may need to be defined from scratch.

An example of a schema associated with the purchasing model is the store.xsd shown here:

Once the schema has been defined, then the example messages need to be updated to reference the schema, as shown in the following BuyRequest.xml example message:

The next step in the development process is to specify a Choreography Model to implement the requirements described within the set of scenarios.

The current representation used to define Choreography Models within SAVARA is the W3C Web Service Choreography Description Language (WS-CDL). The pi4soa tools provide a WS-CDL (or choreography description) editor. Although this standard is associated with web services, it does not mean that a system specified using this standard needs to be implemented using web services. The actual WS-CDL language is used for defining the interactions between any distributed system.

The choreography description for the Purchasing example can be found in purchasing-models/PurchaseGoods.cdm. When the choreography editor has been launched, by double-clicking on this file within the Eclipse environment, then navigate to the Choreography Flows tab to see the definition of the purchasing process:

At this point in the lifecycle, various activities would occur related to reviewing services (i.e. in a SOA Repository) and understanding whether existing services meet requirements, need to be modified, or whether new services need to be developed from scratch.

In the current SAVARA tooling, the main functionality in the Service Oriented Design phase is the generation of BPMN (version 1) diagrams. These diagrams can be used as guidance for the development teams that are implementing the individual services.

It is also possible to extend the generated BPMN (version 1) diagrams to include service logic. However it should be noted that changes to the choreography or BPMN diagrams will not be synchronized/merged. So changes in the choreography will not be checked for conformance against previously generated BPMN diagrams, and it will be necessary to generate new 'service contract' BPMN (version 1) diagrams to reflect changes in behaviour of a service within the updated choreography.

In future versions of the SAVARA, based on BPMN2, it will be possible to formally check BPMN2 process models for conformance against a choreography model, and potentially synchronize differences in externally observable behaviour between them.

To generate a BPMN (version 1) diagram from a choreography, select the Export menu item associated with the choreography file, and select the Other->BPMN option.

Once the option has been selected, you will be asked to select the location where the generated BPMN diagrams should be stored. A diagram will be created containing all of the participants involved in the choreography in a single collaboration diagram.

Select a folder that is located within a project in your Eclipse workspace. Once the folder has been chosen, the diagrams will be generated. To see them within the Eclipse project, you will need to refresh the relevant folder.

The generated diagram will appear as two files, one contains the underlying BPMN model (i.e. the information about the tasks, control links, message links, etc.) and the other file contains the diagram information (i.e. node positions, etc). Double click on the file with the .bpmn_diagram suffix to view the diagram in the Eclipse BPMN editor.

Services can be developed by generating initial development artifacts, based on artifacts created in preceding phases (e.g. global model or service contracts/designs).

To ensure that the services continue to conform to the artifacts defined in the previous phases, the tools perform conformance checking between the service implementation and the existing architecture/design artifacts. This is not possible with all implementation languages - they must provide the means to extract the communication structure for comparison.

The following sections explain how the generation and conformance checking can be achieved for the WS-BPEL implementation language.

This tools include a capability to generate a service implementation, for a participant in a choreography, using WS-BPEL. A completed version of the PurchasingGoods example can be found in the samples directory (which can be imported into Eclipse).

However if you wish to generate the example from scratch, the follow the instructions in this section. More information about how to use this feature can be found in the User Guide.

The generated BPEL process for the CreditAgency participant is as follows:



<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
        xmlns:ca="http://www.jboss.org/examples/creditAgency"
        xmlns:pur="http://www.jboss.org/examples/purchasing"
        xmlns:sto="http://www.jboss.org/examples/store"
        xmlns:tns="http://www.jboss.org/savara/examples"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:ns0="http://www.scribble.org/conversation"
        ns0:conversationType="savara.samples.Common@CreditAgency"
        name="PurchaseGoodsProcess_CreditAgency"
        targetNamespace="http://www.jboss.org/examples/creditAgency"
        xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
    <import importType="http://schemas.xmlsoap.org/wsdl/"
                location="PurchaseGoodsProcess_CreditAgency.wsdl"
                namespace="http://www.jboss.org/examples/creditAgency"/>
    <import importType="http://schemas.xmlsoap.org/wsdl/"
                location="PurchaseGoodsProcess_Store.wsdl"
                namespace="http://www.jboss.org/examples/store"/>
    <import importType="http://schemas.xmlsoap.org/wsdl/"
                location="CreditAgencyPartnerLinkTypes.wsdl"
                namespace="http://www.jboss.org/examples/creditAgency"/>
    <partnerLinks>
        <partnerLink myRole="CreditAgencyService" name="StoreToCreditAgency"
                    partnerLinkType="ca:StoreToCreditAgencyServiceLT"/>
    </partnerLinks>
    <variables>
        <variable messageType="ca:CreditCheckRequest" name="creditCheckRequestVar"/>
        <variable messageType="ca:CreditCheckOk" name="creditCheckOkVar"/>
        <variable messageType="ca:CreditCheckInvalid" name="creditCheckInvalidVar"/>
    </variables>
    <sequence>
        <receive createInstance="yes" operation="checkCredit"
                partnerLink="StoreToCreditAgency" portType="ca:CreditAgencyInterface"
                        variable="creditCheckRequestVar"/>
        <if>
            <sequence>
                <reply operation="checkCredit" partnerLink="StoreToCreditAgency"
                    portType="ca:CreditAgencyInterface" variable="creditCheckOkVar"/>
            </sequence>
            <else>
                <sequence>
                    <reply faultName="ca:CreditCheckFailed" operation="checkCredit"
                            partnerLink="StoreToCreditAgency"
                            portType="ca:CreditAgencyInterface"
                            variable="creditCheckInvalidVar"/>
                </sequence>
            </else>
        </if>
    </sequence>
</process>
                    

There are three changes required, the first being to add a condition following the if element:

The next two changes relate to taking the information provided in the request and constructing an appropriate normal and fault response. In this simple example we only echo back the information received in the request, however more complicated processing could be performed before returning either response.

The following XML code should be added before the normal response (i.e. just inside the sequence element following the condition:

The following XML code should be added before the fault response (i.e. just inside the sequence element that is contained in the else element:

The generated BPEL process for the Store participant is as follows:



<process xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" 
        xmlns:ca="http://www.jboss.org/examples/creditAgency" 
        xmlns:pur="http://www.jboss.org/examples/purchasing" 
        xmlns:sto="http://www.jboss.org/examples/store" 
        xmlns:tns="http://www.jboss.org/savara/examples" 
        xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
        xmlns:ns0="http://www.scribble.org/conversation" 
        ns0:conversationType="savara.samples.Purchasing@Store" 
        name="PurchaseGoodsProcess_Store" 
        targetNamespace="http://www.jboss.org/examples/store" 
        xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
    <import importType="http://schemas.xmlsoap.org/wsdl/" 
            location="PurchaseGoodsProcess_Store.wsdl" 
            namespace="http://www.jboss.org/examples/store"/>
    <import importType="http://schemas.xmlsoap.org/wsdl/" 
            location="PurchaseGoodsProcess_CreditAgency.wsdl" 
            namespace="http://www.jboss.org/examples/creditAgency"/>
    <import importType="http://schemas.xmlsoap.org/wsdl/" 
            location="StorePartnerLinkTypes.wsdl" 
            namespace="http://www.jboss.org/examples/store"/>
    <partnerLinks>
        <partnerLink myRole="StoreService" name="BuyerToStore" 
                partnerLinkType="sto:BuyerToStoreServiceLT"/>
        <partnerLink name="StoreToCreditAgency" 
                partnerLinkType="sto:StoreToCreditAgencyLT" 
                partnerRole="CreditAgencyRequester"/>
    </partnerLinks>
    <variables>
        <variable messageType="sto:BuyRequest" name="buyRequestVar"/>
        <variable messageType="ca:CreditCheckRequest" name="creditCheckRequestVar"/>
        <variable messageType="ca:CreditCheckOk" name="creditCheckOkVar"/>
        <variable messageType="sto:BuyConfirmed" name="buyConfirmedVar"/>
        <variable messageType="sto:BuyFailed" name="buyFailedVar"/>
    </variables>
    <sequence>
        <receive createInstance="yes" operation="buy" partnerLink="BuyerToStore" 
                        portType="sto:StoreInterface" variable="buyRequestVar"/>
        <scope>
            <faultHandlers>
                <catch faultMessageType="ca:CreditCheckInvalid" 
                        faultName="ca:CreditCheckFailed" faultVariable="creditCheckInvalidVar">
                    <sequence>
                        <reply faultName="sto:BuyFailed" operation="buy" 
                                partnerLink="BuyerToStore" portType="sto:StoreInterface"
                                variable="buyFailedVar"/>
                    </sequence>
                </catch>
            </faultHandlers>
            <sequence>
                <invoke inputVariable="creditCheckRequestVar" operation="checkCredit" 
                            outputVariable="creditCheckOkVar" partnerLink="StoreToCreditAgency" 
                            portType="ca:CreditAgencyInterface"/>
                <reply operation="buy" partnerLink="BuyerToStore" portType="sto:StoreInterface" 
                                variable="buyConfirmedVar"/>
            </sequence>
        </scope>
    </sequence>
</process>
                    

There are three changes required. The first being to add an assignment statement within the catch element's sequence prior to the reply:

The remaining two changes relate to taking the information received in the initial request, to construct a request to the credit agency, and then extracting the information from the credit agency response, to return it to the Store client. The following snippet shows the two assignment statements either side of the invoke statement:

Note

Before you can deploy and run the runtime validation example, you will need to install the SAVARA Validator module for JBossESB.

Once services have been deployed, as mentioned in the previous section, we still need to be able to verify that the services continue to conform to the choreography description. The Conversation Validation capability within the SAVARA distribution can be used to validate the behaviour of each service.

In this section, we will use the Trailblazer example found in the ${SAVARA}/samples/trailblazer folder and the trailblazer-models Eclipse project.

The JBossESB service validator configuration is defined using jbossesb specific annotations, that are associated with the 'exchange details' components (contained within interactions), within the choreography description.

To view the pre-configured service validator configuration defined for the Trailblazer example, edit the TrailBlazer.cdm file, navigate to the Choreography Flows tab and then select the Choreography->Edit Annotations menu item associated with the first 'exchange details' component (as shown below).

This will display the annotation editor, with the single configured annotation called 'validator'. This annotation defines the information required for the Service Validator to monitor this specific message exchange (i.e. the JMS destination on which the message will be passed).

Once an annotation has been defined, it will also be displayed as part of the tooltip for the associated model component, for example:

Once the jbossesb annotations have been defined for all relevant 'exchange details' components in the choreography description, the choreography file can be copied to the ${JBossAS}/server/default/deploy/savara-validator.esb/models folder in the JBossAS environment. The service validator configuration for the trailblazer example has been preconfigured to be deployed as part of the installation procedure.

Note

If the savara-validator.esb/validator-config.xml within the JBossAS environment is modified, or choreography description files added, removed or updated within the savara-validator.esb/models sub-folder, then the changes will automatically be detected and used to re-configure the service validators without having to restart the JBossESB server.

To run the example, you need to start a browser and select the URL localhost:8080/trailblazer. This will show the following page, if the server has been configured correctly and the TrailBlazer example deployed:

Now you can submit quotes, You will see either a loan request rejected (single email) because the score is less than 4, or two emails (one from JMS bank and one from FileBased bank) with valid quotes. When entering subsequent quotes, make sure that the quote reference is updated, so that each session has a unique id.