Search results for 'soa'

Creating a Simple SOA Project with NetBeans Enterprise Pack

Contents

Overview

You will be creating a simple SOA project. You will add a WSDL file to your BPEL Module project. You use the Partner view to add the messages, partner link type, port type, and operation. Then you will create a composite application project and use the CASA editor to modify the project configuration. This tutorial also illustrates a basic scenario of how a File Binding Component can be used in a composite application.

Software Needed for this Tutorial

Before you begin, you must install the following software on your computer:

  • NetBeans IDE 5.5.1 Beta with NetBeans Enterprise Pack 5.5.1 Beta

 

Configuring the Tutorial Environment

Before you can deploy your application, the Sun Java System Application Server and JBI runtime must be configured correctly and running.

To configure the tutorial environment:

  1. Click the Runtime tab to open the Runtime window.
  2. In the Runtime window, expand the Servers node.
  3. If the Servers node already contains a Sun Java System Application Server 9 node, then go to step 5.
  4. If the Servers node does not contain a Sun Java System Application Server 9 node, then do the following to add an application server:
    1. Right-click the Servers node and choose Add Server from the pop-up menu.
      The Add Server Instance dialog box opens.
    2. In the Choose Server page, from the Server drop-down list, select Sun Java System Application Server.
    3. (Optional) In the Name field, accept the default value or type the name you want to use to identify the server in the IDE.
    4. Click Next.
      The Platform Location Folder page opens.
    5. In the Platform Location field, use the Browse button to navigate to and select the Application Server installation location.
      If you accepted the default values during the installation, the location is C:\Sun\Appserver .
    6. Select the Register Local Default Domain radio button.
    7. Click Next.
    8. Supply the user name and password for the domain's administrator.
      If you accepted the default values during the installation, the user name is admin and the password is adminadmin .
    9. Click Finish.
  5. In the Runtime window, right-click the Sun Java System Application Server 9 node and choose Start.
    If the Start option is not available, the server is already running and you can skip the next step.
  6. Wait until the following message appears in the Output window:
    Application server startup complete.
    When the server is running, the IDE displays a green arrow badge on the Sun Java System Application Server 9 node.

Creating the Project

In this section, you create a BPEL Module project called HelloSample .

To create the HelloSample project:

  1. From the IDE's main menu, choose File > New Project.
    The New Project wizard opens.
  2. In the Categories list, select the Service Oriented Architecture node.
  3. In the Projects list, select the BPEL Module node.
  4. Click Next.
  5. In the Project Name field, type HelloSample .
  6. (Optional) In the Project Location field, use the Browse button to navigate to and select a different folder where the IDE will store the project files.
  7. Click Finish.
    The Projects window now contains a project node for a BPEL Module project called HelloSample .

Creating the WSDL Document

In this section, you add a WSDL file to your BPEL Module project and then use Partner view to configure the components of the WSDL Document.

To create HelloSample.wsdl :

  1. In the Projects window, expand the HelloSample project node, then right-click the Process Files node and choose New > WSDL Document.
    The New WSDL Document wizard opens.
  2. In the File Name field, type HelloSample .
  3. Click Finish.
  4. The IDE does the following:
    • Creates HelloSample.wsdl node under the Process Files.
    • Opens the HelloSample.wsdl in the source editor.
      The Source Editor contains 3 tabs for the WSDL file, Source, WSDL, and Partner, with the WSDL view opened.
    • Opens the Properties window. If the Properties window is not visible, choose Window > Properties.
  5. In the WSDL view, click the Partner button to open the Partner view of the WSDL editor.
    The IDE opens the WSDL Palette. If the Palette window is not visible, choose Window > Palette from the main menu.
    You can create the SequenceDiagram in this view.

To add Messages :

  1. In the Palette of the Partner view select the Message icon.
  2. Drag your selection to the WSDL Partner View design area, below the Messages.
    The IDE adds a Message and the name of the new Message is ( Messages1 ).
  3. Click the down arrow to expand the new message. If the arrow is up, the message is already expanded.
    The design area now shows Part Name and Part element or Type columns.
  4. In the Message Part Name column, double-click the default value (part1) to make the field editable.
  5. Type inputType and press Enter. If the Message1 is collapsed, click the down arrow to expand the new message
  6. In the Part Element Or Type column, make sure the default type is xsd:string
    If the type is not string then click the ellipsis button and select BuiltIn Schema Types > Built-in Types > String
  7. Repeat step 1-6 and for the Message Part Name, enter resultType.

To add PartnerLinkType :

  1. In the Palette of the Partner view select the PartnerLinkType icon.
  2. Drag your selection to the WSDL Partner View design area, below the PartnerLinkTypes(0).
    The IDE adds a PartnerLink and is ready to create new Roles and Port Types. Roles and PortTypes are drawn as dotted vertical lines( Lifeline) with the External names showing at the top.
  3. For Port Types double click the green rectangle under the role1 node.
  4. Click Enter. The new portType1 is assigned.
  5. In the Palette of the Partner view select the Request-Response icon.
  6. Drag your selection to the WSDL Partner View design area, below the portType1.
    The new Operation, operation1 is added.
  7. Under operation1, double click the upper message arrow where it says <No Message Selected> and select tns:message1.
  8. Repeat step 7and 8 for the lower message arrow and select tns:message2.

Creating the BPEL Process

To create HelloSample.bpel :

  1. In the Projects window, expand the HelloSample project node, then right-click the Process Files node and choose New > BPEL Process.
    The New BPEL Process wizard opens.
  2. In the File Name field, type HelloSample.
  3. Click Finish.
    The Sample.bpel is created

To add a partner link:

  1. In the Web Service section of the Palette, select the Partner Link icon and drag your selection to the design area.
    The Create New Partnerlink1Property Editor opens.
  2. Accept the defaults and click OK.

To add a Receive activity:

  1. In the Web Service section of the Palette, select the Receive icon and drag your selection to the design area between the Process Start activity and the Process End activity.
    The IDE provides you with visual clues to show you where you can drop the selection.
    This action places a Receive activity called Receive1 in the Design view.
  2. Double-click the Receive1 activity.
    The Receive1 [Receive] - Property Editor opens.
  3. From the Partner Link drop-down list, select PartnerLink1.
    The IDE fills in the Operation field.
  4. Create a new input variable by doing the following:
    1. Click the Create button next to the Input Variable field.
      The New Input Variable dialog box opens.
    2. Change the value in the Name field to inputVar .
    3. Click OK.
  5. Click OK to close the Receive1 [Receive] - Property Editor.
    The Receive activity is now labeled start in the Design view.

To add a Reply activity:

  1. In the Web Service section of the Palette, select the Reply icon and drag your selection to the design area between the Receive1 activity and the Process End activity.
    The IDE provides you with visual clues to show you where you can drop the selection.
    This action places a Reply activity called Reply1 in the Design view.
  2. Double-click the Reply1 activity.
    The Reply1 [Reply] - Property Editor opens.
  3. From the Partner Link drop-down list, select PartnerLink1.
    The IDE fills in the Operation field.
  4. Create a new output variable by doing the following:
    1. Make sure the Normal Response radio button is selected.
    2. Click the Create button next to the Output Variable field.
      The New Output Variable dialog box opens.
    3. Change the value in the Name field to outputVar .
    4. Click OK.
  5. Click OK to close the Reply1 [Reply] - Property Editor.
    The Reply activity is now labeled end in the Design view.

To add an Assign activity:

  1. In the Basic Activities section of the Palette, select the Assign icon and drag your selection to the design area between the Receive1 activity and the Reply1 activity.
    This action places an Assign activity called Assign1 in the Design view.
  2. Select the Assign1 activity.
  3. If the BPEL Mapper window is not visible, choose Window > BPEL Mapper from the main menu.
  4. In the left pane of the BPEL Mapper, under Variables, expand the inputVar node.
    inputType appears under inputVar .
  5. In the right pane of the BPEL Mapper, under Variables, expand the outputVar node.
    resultType appears under outputVar .
  6. Drag inputType from the left pane of the BPEL Mapper to the resultType node in the right pane of the BPEL Mapper.
    This assignment copies the input statement into the output.
  7. To save your changes, in the Projects window, select the SynchronousSample project node, and from the IDE's main menu, choose File > Save All.

Creating the Composite Application

Before you deploy the BPEL Module project, you must add the JBI module to the deployment project. Deploying the project makes the service assembly available to the application server, thus allowing its service units to be run.

To create the Composite Application project:

  1. From the IDE's main menu, choose File > New Project.
    The New Project wizard opens.
  2. In the Categories list, select the Service Oriented Architecture node.
  3. In the Projects list, select the Composite Application node.
  4. Click Next.
  5. In the Project Name field, type SampleCompositeApp .
  6. Click Finish.
    The Projects window now contains a project node for a Composite Application project called SampleCompositeApp .

Using the CASA Editor

To use the CASA editor to modify the project configuration:

  1. Right click on the SampleCompositeApp project and select Edit Project.
  2. Click on the HelloSample node and drag-n-drop it onto the JBI module area.



  3. Click the build button on CASA toolbar to build the bpel project.

To create the WSDL endpoint:

  1. Click on the "file" palette item on the WSDL Bindings category in the Palette panel.
  2. Drag-n-drop it to the WSDL Ports area in the CASA editor.
  3. A new "casasport1" WSDL endpoint is added.

To createa new connection:

  1. Click on the consume endpoint of the new port.
  2. Drag it to the erole1_myRole to create a new connection.

To Check auto-generated WSDL endpoint properties

  1. In the Navigator panel, expand the WSDL Ports node.
  2. Expand casaPort1 > casaBinding1 > operation1 > input1.
  3. Select file:message.
  4. In the Properties window, assign use='literal" , pollingIntervl=5000 and fileName=input.txt.
  5. Click on WSDL Ports area in the CASA editor to open the Navigator panel again.
  6. In the Navigator panel, expand WSDL Ports > casaPort1 > casaBinding1 > operation1 > output1.
  7. Select file:message.
  8. In the Properties window, assign fileName=output.txt.
  9. Click on WSDL Ports area in the CASA editor to open the Navigator panel.
  10. In the Navigator panel, expand the WSDL Ports node.
  11. Expand casaPort1 ->casaPort1 to select the file:address node.
  12. In the Properties window, in the fileDirectory, replace C:/Temp with the string c:/temp.
  13. Click Ok.



Deploying and Testing the SampleCompositeApp

To deploy the Composite Application:

  1. Right-click the SampleCompositeApp project node and choose Deploy Project.
    If a message similar to the following message appears in the Output window, then the deployment has succeeded:
    BUILD SUCCESSFUL (total time: 11 seconds)

To test the SampleCompositeApp:

  1. Create the input.txt file in c:/temp folder and edit the file to content 'Hello World!!'.
  2. input.txt will be renamed to input.txt_processed.
  3. output.txt will be created in the same folder with the same content 'Hello World!!'.


@http://blogs.sun.com/barkodar/resource/HelloSample.html

2007/03/21 15:16 2007/03/21 15:16
Trackback Address:이 글에는 트랙백을 보낼 수 없습니다