Contents

 

Overview

In this cookbook you learn how to create an Xslt Project for a JBI environment. This example will configure a Request-Reply XSLT SU using the SOAP HTTP binding component. You learn how to create an XSL Service and WSDL Document, which contains an operation whose input/output messages correspond to the input/output of the XSL service's transformation as well as a SOAP binding, is also required.

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 XSLT Project

To create the XSLT

  1. Click menu File and select New Project
  2. Select Service Oriented Architecture from Categories, select XSLT Module from Projects, and click Next button.
  3. Input “SampleXSLT” for entry: Project Name, and click Finish.
  4. Right-mouse-click on folder Transformation files, and select New File/Folder.
  5. In the Categories list, expand the XML node and select the Sample Schemas node.
  6. In the File Types list, select Loan Application Schema and click Next.
  7. Accept the default values in the Name and Location page of the wizard (File Name: newLoanApplication , Folder: src ) and click Finish.
    In the Projects window, the Transformation Files node under the sampleXSLT node now contains a subnode labeled newLoanApplication.xsd and the xsltmap.xml node.
  8. Repeat step 4 to 7 and select the Purchase Order Schema.
    The Transformation Files node now contains a subnode labeled newpo.xsd.

.

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 SampleWSDL.wsdl :

  1. In the Projects window, expand the sampleXSLT project node, then right-click the Transformation Files node and choose New > File/Folder.
  2. In the Categories list, select XML node.
  3. In the File Types list, select WSDL Document and click Next.
    The New WSDL Document wizard opens.
  4. In the File Name field, type SampleWSDL and click Next.
  5. In the Input area of the Abstract Configuration page, do the following:
    1. In the Element Or Type column, click the ellipsis button.
      The Select Element Or Type dialog box opens.
    2. Expand the sampleXSLT node, the src/newLoanAllication.xsd node, and the Elements node.
    3. Under the Elements node, select the autoLoanApplication node and click OK.
  6. In the Output area of the Abstract Configuration page, do the following:
    1. In the Element Or Type column, click the ellipsis button.
      The Select Element Or Type dialog box opens.
    2. Expand the sampleXSLT node, the src/src/newpo..xsd node, and the Elements node.
    3. Under the Elements node, select comment and click OK.
  7. Click Next.
    The Concrete Configuration page opens.
  8. Select SOAP for Binding Type.
  9. For Binding Subtype, select the Document Literal radio button.
  10. Click Finish.
    In the Projects window, the Transformation Files node now contains a subnode labeled SampleWSDL.wsdl .

Creating the XSLT Service

To create the XSLT Service:

  1. Right-click the Transformation Files node and choose New > File/Folder.
  2. In the Categories list, select Service Oriented Architecture node.
  3. In the File Types list, select XSLT Service and click Next.
  4. Make sure the Transformation Service radio button is selected and click Next.
  5. Make sure the Existing WSDL file radio button is selected and click Next.
  6. Click Finish.
    The New xsl1.xsl node is created.
  7. From the Palette, expand String and select the concat from the String list.
  8. Drag your selection to the design area, in the middle portion of the Editor .
  9. Select the String-Literal from the String list. Drag your selection to the design area next to the Concat Operator.

  10. Double-click the second field in the concat box and type Approved. Press the Enter key.
  11. In the left side of the XSLT Mapper, Design view, under autoLoanApplication , expand applicant .
  12. Drag SSID onto the string1 part of the Concat method, the second field.
  13. Drag the return string from the Concat method onto the Comment in the right side.
    This concatenates the string SSID to the string 'Approved' and copies the statement into the Comment.

Creating and Deploying the Composite Application

To create the Composite Application project and add the JBI module:

  1. From the menu select New Project.
  2. Select Service Oriented Architecture from Categories, select Java Composite Application from Projects and click Next.
  3. Input 'SampleCompositeApp' for Project Name and click Finish.
  4. Right-click on folder SampleCompositeApp, and select Add JBI Module.
  5. Navigate to the directory under which you created your project, select folder samplexslt, and click button Add Project JAR Files.

To deploy the Composite Application:

  1. Right-click on folder SampleCompositeApp and select Deploy Project.
    If the BUILD SUCCESSFUL message appears in the Output window, then the deployment has succeeded.

Testing the SampleCompositeApp

To test the SampleCompositeApp:

  1. In the Projects window, expand the SampleCompositeAppl project node, right-click the Test node, and choose New Test Case from the pop-up menu.
    The New Test Case wizard opens.
  2. Accept the default test case name, TestCase1 , and click Next.
  3. In the Select the WSDL Document page, expand the sampleXSLT-XSLT ProcessFiles node, select sampleWSDL.wsdl , and click Next.
  4. In the Select the Operation to Test page, select the sampleWSDLOperation and click Finish.
    In the Projects window, under Test , a new TestCase1 node has been added.
    This node contains two subnodes: Input and Output .
    The Source Editor contains a tab for the Input file, Input.xml .
  5. In the Source Editor tab for the Input.xml file, do the following:
    1. Locate the following line:
      <loan:SSID>?string?</loan:SSID>
    2. Replace ?string? with 123-456-789 .
      The line should look like this:
      <loan:SSID>123-456-789</loan:SSID>.
    3. From the IDE's main menu, choose File > Save All.
  6. Double-click Output to examine its contents.
    Initially, output.xml is empty. Therefore the first test run will populate output.xml with the real output. Subsequent test runs will compare the real output against the contents of output.xml .
  7. In the Projects window, right-click the TestCase1 node and choose Run from the pop-up menu.
    Note: The first run is a special case because Output.xml is empty and the output is written to Output.
    Notice the failed message in the JUnit Test Results window.
    The Overwrite Empty Output? dialog box opens.
  8. Click Yes.
  9. Double-click Output to examine its contents.