13.07.2015 Views

Using Petals to Implement a Service-oriented Architecture

Using Petals to Implement a Service-oriented Architecture

Using Petals to Implement a Service-oriented Architecture

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The ESB is now capable of hosting JSR181 services exchanging SOAP messages.Deploying the previously created assembly is as easy as A-B-C: it is noting more than aregular component, and a simple copy/paste in<strong>to</strong> the «install» direc<strong>to</strong>ry does the trick:this action deploys the component on the ESB.But this is not sufficient <strong>to</strong> make it available as a regular SOAP service: a link between theSOAP component and the deployed service assembly must be created. The point is <strong>to</strong>explain <strong>to</strong> the SOAP component <strong>to</strong> which component incoming SOAP requests must beforwarded <strong>to</strong>.Create a new «<strong>Petals</strong> <strong>Service</strong> Consumer», selecting «Communication Pro<strong>to</strong>col» as keywords, and «SOAP // petals-bc-soap» as petals component (version «4.2»). The wizardnow asks which ESB service operation should be exposed through the SOAP pro<strong>to</strong>col.Click on the «Select a service» link <strong>to</strong> open the selection wizard. In this wizard, select theport «HelloWorldPort» in the «Available <strong>Service</strong>» list, and then the operation <strong>to</strong> expose(i.e., «helloWorld»). The default project name is OK (i.e., «su-SOAP-HelloWorldconsume»),but change the «SOAP <strong>Service</strong> Name» <strong>to</strong> clearly identify its SOAP nature(e.g., «SOAPHelloWorld»). Ask <strong>Petals</strong>Studio <strong>to</strong> generates the service assembly (rightclick,«<strong>Petals</strong>», «Fast export <strong>to</strong> <strong>Petals</strong>»), and deploy the generated zip archive on the ESBusing the usual copy/paste au<strong>to</strong>-deploy mechanism.The developed web service is now executed by the JSR-181 <strong>Service</strong> Engine, and exposedthrough the SOAP Binding Component. You can list the services available through theSOAP BC on the dedicated web page: http://localhost:8084/petals/services/list<strong>Service</strong>s.The service can be accessed through a standard SOAP client (e.g., soapUI 1 ).Fig 4. <strong>Using</strong> soapUI <strong>to</strong> interact with the service1 http://sourceforge.net/projects/soapui/files/4


Create and Deploy a BPEL processThe Business Process Execution Language (BPEL) supports the description of servicecomposition (as «business processes») in a high level and standardised formalism.Hosting a BPEL artefact in the <strong>Petals</strong> ESB follows the same principles than the previousweb service deployment: (i) deploy the associated service engine, (ii) implement theprocess, (iii) deploy it on the ESB and finally (iv) expose it <strong>to</strong> the external world though theSOAP-BC component.To deploy the BPEL service engine, copy/paste the «petals-se-bpel-1.1.0.zip»component in<strong>to</strong> the «install» direc<strong>to</strong>ry.To implement a BPEL process, simply create a new «<strong>Petals</strong> <strong>Service</strong> Provider» inthe <strong>Petals</strong>Studio IDE. The «BPEL // petals-se-bpel» component is available under the«<strong>Service</strong> Composition» key word. Use «HelloWorldProcess» name, in the «http://sandbox.soa.polytech.unice.fr» namespace. In this tu<strong>to</strong>rial, we’ll create asynchronous process. The wizard generates a process skele<strong>to</strong>n, which basically containsthree activities: (i) the reception of a triggering message (receive), (ii) the sending of asynchronous response <strong>to</strong> the caller (reply), and (iii) and empty activity in between. As theservice is useless «as is», open the source of the «HelloWorldProcess.bpel» file, andreplace the «empty» activity by the following code:Hello, World!This code declares an assign activity that first initialise the output message with agreetings.To deploy the process, ask <strong>Petals</strong> Studio <strong>to</strong> «fast export <strong>to</strong><strong>Petals</strong>», and then copy/paste the generated zip archive inthe «install» direc<strong>to</strong>ry of the ESB.Then, the service is not yet accessible for external callers:a SOAP binding must be defined and then deployed.Create a new «<strong>Petals</strong> <strong>Service</strong> Consumer», using«SOAP // petals-bc-soap» component. With the «select aservice» wizard, selects the «HelloWorldProcessPort»,and the «process» operation. Do not forget <strong>to</strong> prefix bySOAP the «SOAP <strong>Service</strong> Name».To deploy the binding, ask <strong>Petals</strong>Studio <strong>to</strong> «fast export <strong>to</strong><strong>Petals</strong>», and then copy/paste the generated zip archive inthe «install» direc<strong>to</strong>ry of the ESB. The process becomesavailable <strong>to</strong> the outside world, and is listed in the http://localhost:8084/petals/services/list<strong>Service</strong>s page.Fig 5. BPEL graph. display5


Fig 6. <strong>Using</strong> soapUI <strong>to</strong> interact with the process6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!