Use Guvnor NG as a Service Repository to manage SOA services

This article shows how to use Guvnor NG as a Service Repository to manage SOA services and artifacts. To be more specifically, it shows how to do following:

 

1. Create SOA service artifacts outside Guvnor NG.

2. Store and manage SOA service artifacts in Guvnor NG.

3. Reference SOA service artifacts stored in Guvnor NG from outside (Using REST or Eclipse JBDS).

 

Please NOTE, this article is a revised version of Jeff DeLong's previous doc: Using Drools Guvnor 5.1 as a service repository, most content are copied from that doc directly.

 

 

Setup

 

1. Download Guvnor 5.4.0 snapshot from https://hudson.jboss.org/jenkins/job/guvnor/lastSuccessfulBuild/artifact/guvnor-distribution/target/

 

2. Install Guvnor. Do not install samples.

 

3. Switch to SOA Services perspective.

 

soaperspective.jpg

 

 

Add SOA Service Artifacts into Guvnor NG

 

This section shows how to do following:

 

1. Create SOA services in Guvnor.

2. Add various type of SOA service artifacts (Sample Messages, XSDs, WSDLs, JBOSS ESB configuration, BPEL, Java file, Scenario Diagrams, Choreography Model, Smooks Transformation etc )  into Guvnor. What artifact types are supported is 100% configurable. You tell Guvnor configuration file what artifact types you want to support, what icon and what title you want display for this artifact type, what asset editor you want to associated with this artifact type.

3. View and edit artifact content using asset editors. Note, Guvnor has a plugin framework that allows you to plug custom artifact editors into Guvnor. In this example, Sample Message, XSD, WSDL, JBOSS ESB configuration file are associated with XML asset editor. Java file, Scenario Diagrams, Choreography Model (cdm file) are associated with binary file upload/download editor. BPEL process defintion is associated with BPEL editor.

4. Manage artifact life cycles.

5. Use Global Area to manage artifacts that can be shared among different services.

 

 

1. Add following status (life cycles): Business Analysis, Architecture Modeling, Service Oriented Analysis, Service Oriented Design, Service Development, Service Testing, Deployed, Retired

 

addstatus.jpg

 

 

2. Add XSDs, Sample Messages and other non service specific artifacts to Global Area. Global Area contains assets that potentially can be shared among different services. Global Area encourages ppl to write reusable artifacts across services.

 

2.1). Add following Sample Messages to Global Area: PolicyQuote.xml

 

addsamplemsg1.jpg

 

 

addsamplemsg2.jpg

 

 

samplemessageeditor.jpg

As you can see from the screen shot above, Sample Message is associated with XML editor by default.

 

 

2.2). Add following XML schemas to Global Area: policyQuoteBase.xsd, policyQuoteRequest.xsd,

policyQuoteResponse.xsd, policyQuoteFault.xsd

 

addxsd1.jpg

 

addxsd2.jpg

 

addxsd3.jpg

 

 

3. Add Services:  PolicyQuoteProcessService

newsoaservice.jpg

 

 

4. Add SOA service artifacts to PolicyQuoteProcessService

 

4.1). Import PolicyQuoteRequest.xsd, PolicyQuoteResponse.xsd, PolicyQuoteFault.xsd and PolicyQuoteBase.xsd from Global Area to PolicyQuoteProcessService

importxsd.jpg

 

 

4.2). Add WSDL file.

 

4.3). Import Sample Messages from Global Area to PolicyQuoteProcessService.

 

4.4). Add JBoss ESB configuration file.

 

4.5). Add Scenario Diagrams: SuccessfulPolicyQuote. Change its status to BusinessAnalysis.

newScenarioDiagram.jpg

 

 

changestatus.jpg

 

 

4.6). Add Choreography Model: the PolicyQuoteCDM.cdm. Change PolicyQuoteCDM.cdm's status to Architectural Modeling

 

 

4.7). Add PolicyQuoteProcess BPEL process definition. Change its status to Service Development

 

4.8). Add Task.java. Change its status to Service Development

 

4.9). This is what PolicyQuoteProcessService looks like after adding artifacts above:

service.jpg

 

 

 

Use Service Repository

 

 

1. Download Guvnor 5.4.0 snapshot from https://hudson.jboss.org/jenkins/job/guvnor/lastSuccessfulBuild/artifact/guvnor-distribution/target/

 

2. Install Guvnor. Do not install samples. Import Guvnor repository file guvnor_ng_repository.xml (which is created by steps above) from attachement.

 

 

Access Service Repository using REST interface.

 

The whole service repositroy can be accessed remotely through REST service. For details please check:

https://hudson.jboss.org/jenkins/job/guvnor/lastSuccessfulBuild/artifact/guvnor-docs/target/docbook/publish/en-US/html_single/index.html#d0e1856

 

 

Access Service Repository using Eclipse JBDS.

 

1) Start JBDS and create a new ESB Project named PolicyQuoteProcessService. Go into the META-INF folder and delete the jboss-esb.xml file.

 

2) Use the FIle -> New -> Guvnor -> Resources from Guvnor and add  jboss-esb.xml from the PolicyQuoteProcessService service to the META-INF folder.

eclipse.jpg

 

NOTE: This does not work at the moment because services are not visible to WebDav or JBDS (https://issues.jboss.org/browse/GUVNOR-1704). For the purpose of demostration, you can try to add artifacts from the Global Area.

 

3) Use the FIle -> New -> Guvnor -> Resources from Guvnor and add the policyQuoteBase.xsd, policyQuoteRequest.xsd,  policyQuoteResponse.xsd, policyQuoteFault.xsd  from the PolicyQuoteProcessService service to the esbcontent folder

 

4). Repeat step 3, add other files from the PolicyQuoteProcessService service to the esbcontent folder.

 

5) Add Task.java into a folder src/org/acme/insurance.

 

 

 

 

Known issues:

https://issues.jboss.org/browse/GUVNOR-1703: Duplicate nodes are added under navigation panel tree when switching among Perspecitves

https://issues.jboss.org/browse/GUVNOR-1704: JBDS and WebDav can not see services created in Guvnor with SOAService perspective.