2. Setting Up the Advanced API Sample Projects This page last changed on Dec 31, 2008. ## How To Set Up the Advanced API Sample Projects This topic describes how to set up the Oracle Data Service Integrator sample projects which illustrate how to call data service operations from client applications. #### Topic Map How To Set Up the Advanced API Sample Projects Installing the Oracle Data Service Integrator Retail Dataspace Sample Adding Functions to the Dataspace Project Updating the Schema Exporting the Mediator Client JAR Files Creating the Sample Dataspaces Adding the Mediator Client JAR Files Setting the Java Build Paths Setting the Run Configurations Related Topics Advanced API Samples - Mediator, Web Services, and DSP Controls ### Installing the Oracle Data Service Integrator Retail Dataspace Sample Launch Workshop for WebLogic. Install the Oracle Data Service Integrator Retail Dataspace Sample. The sample creates a dataspace for retail data services that connects to a relational database and web services.
   | For more information, see Configure the Retail Dataspace Sample Application
3. ### Adding Functions to the Dataspace Project To add the sample functions to the `RetailDataspace` project: Expand the `RetailDataspace` project in the Project Explorer, and locate the `RetailApplication/CustomerManagement/ProfileService.ds` data service. ProfileService Data Service in the Project Explorer Double-click the `ProfileService.ds` data service and click the Source tab. In the `ProfileService.ds` data service, add the following functions to the bottom of the Source view:
       declare namespace ord= "ld:Logical/Order/Order";

       (::pragma  function <f:function kind="library" visibility="public" isPrimary="false" xmlns:f="urn:annotations.ld.bea.com"/>::)
       declare function tns:getOrderCount($arg as xs:string) as xs:integer {
          count( for $b in ord:getOrderByCustID($arg) return $b)
       };

       (::pragma  function <f:function kind="library" visibility="public" isPrimary="false" xmlns:f="urn:annotations.ld.bea.com"/>::)
       declare function tns:getOrderCounts($arg as xs:string) as xs:integer* {
          for $b in ord:getOrderByCustID($arg) return 1
       };

       (::pragma  function <f:function kind="library" visibility="public" isPrimary="false" xmlns:f="urn:annotations.ld.bea.com"/>::)

       declare function tns:getServiceCases($profiles as element(ns5:PROFILES)) as element(ns7:CASE)* {
          for $profile in $profiles/ns2:PROFILE
          for $b in ns8:getServiceCaseByCustID($profile/CustomerID)
          return $b
       };
3. The sample projects call these functions to determine the order count and to retrieve the service cases. Choose File > Save in the main menu. ### Updating the Schema To update the schema file to support the new functions in the `ProfileService.ds` data service follow these steps: Locate the `RetailApplication/CustomerManagement/schemas/ProfileService.xsd` schema file. ProfileService XSD in the Project Explorer Double-click the `ProfileService.xsd` schema file and click the Source tab. In the `ProfileService.xsd` schema file, add the following lines before `</xs:schema>` at the bottom of the Source view:
       <xsd:complexType name="PROFILE_SERVICES">
             <xsd:sequence>
                <xsd:element ref="retailerType:PROFILE" minOccurs="0" maxOccurs="unbounded"/>
             </xsd:sequence>
          </xsd:complexType>
       <xsd:element name="PROFILES" type="retailer:PROFILE_SERVICES"/>
1. This specifies the `PROFILE_SERVICES` complex type, which is used by the new functions you added to the `ProfileService.ds` data service in the previous section. Choose File > Save in the main menu. Redeploy the RetailDataspace. ### Exporting the Mediator Client JAR Files Before exporting the Mediator Client JAR files, you need to create a web service map. To create the web service map: Right-click the `ProfileService.ds` data service and choose Create Web Service Map. Click OK to any information dialogs that may appear. Creating a Web Service Map Redeploy the RetailDataspace. #### Exporting the Java Mediator Client JAR File To export the Java Mediator Client JAR file for the project: Right-click the RetailDataspace and choose Export. Expand Oracle Data Service Integrator, select Mediator Client JAR file, and click Next. Selecting Mediator Client JAR File RetailDataspace should be selected; if not, click the checkbox next to that option. Choose a convenient destination directory for the `RetailDataspace-dsp-client.jar` file. Then click Finish. Workshop for WebLogic creates the Mediator Client JAR file. A message indicating that your have successfully exported the mediator JAR file and its location should appear. #### Exporting the Java Web Services Mediator Client JAR File To export the Java Web Services Mediator Client JAR File: Right-click the RetailDataspace and choose Export. Expand Oracle Data Service Integrator, select Web Services Mediator Client JAR File, and click Next. Notice that the necessary projects and folders are automatically selected. Selecting Mediator Client JAR File Select a destination directory and click Finish. Workshop for WebLogic creates the Web Services Mediator Client JAR file. A message indicating that your have successfully exported the web services mediator JAR file and its location should appear. ### Creating the Sample Dataspaces The sample provides four dataspaces: DSPClientSamplesDynamic1 DSPClientSamplesStatic1 DSPClientSamplesControlDynamic DSPClientSamplesControlStatic The dynamic and static client samples illustrate use of the Java and Web Services Mediator APIs. The control dynamic and static samples, illustrate use of Oracle Data Service Integrator Control APIs. You can create the four sample dataspaces by dowloading and importing the advanced samples ZIP file. Download the ZIP file from the following location: http://edocs.bea.com/aldsp/docs30/code/AdvancedAPISamples.zip Right-click in the Project Explorer and choose Import. Expand General, select Existing Projects into Workspace, and click Next. Importing Existing Projects into the Workspace Click Select archive file, click Browse, and open the `DspClientSamples_All.zip` file. Selecting the Sample Dataspace Archive Click Finish. Workshop for WebLogic imports the sample dataspace projects. ### Adding the Mediator Client JAR Files To add your mediator client JAR files to the projects: In the project explorer copy the mediator client JAR files you generated earlier (`RetailDataspace-dsp-client.jar` and `RetailDataspace-ws-client.jar`) to the following folder:
       DSPClientSamplesStatic1/WebContent/WEB-INF/lib
Click Yes To All when prompted to overwrite the existing files. Right-click the `DSPClientSamplesStatic1` dataspace project, and click Refresh. ### Setting the Java Build Paths You need to set the Java build paths to include the specific JAR files required by the projects.
| You need to specify the Java build path for all four dataspace projects: DSPClientSamplesStatic1 DSPClientSamplesDynamic1 DSPClientSamplesControlStatic DSPClientSamplesControlDynamic
1. To set the Java build path: In Project Explorer right-click the dataspace project you have selected, then choose:
       Build Path > Configure Build Path
A dialog appears displaying the properties for the dataspace project. Click the Libraries tab. ##### Configuring the Build Path Click Add External JARs, then locate and select the indentifed JAR files. Click Open. Click OK. The following table identifies the necessary JAR files and their location for each advanced sample dataspace project. (The `ld-client.jar` file is needed by all four projects.) ##### Project, Required JAR Files, and Location
Dataspace Project | JAR File | Path
DSPClientSamplesControlDynamic | ld-client.jar com.bea.core.sdo.1.0.0.0.jar | <ALDSP_HOME>/lib <BEA_HOME>/modules
DSPClientSamplesControlStatic | ld-client.jar com.bea.core.sdo.1.0.0.0.jar | <ALDSP_HOME>/lib <BEA_HOME>/modules
DSPClientSamplesDynamic1 | ld-client.jar weblogic.jar | <ALDSP_HOME>/lib <BEA_HOME>/wlserver_10.3/server/lib
DSPClientSamplesStatic1 | ld-client.jar api.jar weblogic.jar | <ALDSP_HOME>/lib <BEA_HOME>/wlserver_10.3/server/lib <BEA_HOME>/wlserver_10.3/server/lib
| When configuring the path for the Oracle Data Service Integrator control dataspace projects, you may notice duplicate entries for `ld-client.jar` and `com.bea.sdo.1.0.0.0.jar`. If so, retain only the file associated with the location in the above table.
3. ### Setting the Run Configurations You need to create a run configuration for the following projects: DSPClientSamplesDynamic1 DSPClientSampleStatic1 #### Setting the Run Configuration for DSPClientSamplesDynamic1 To set the run configuration for `DSPClientSamplesDynamic1`: Right-click `DSPClientSamplesDynamic1` in the Project Explorer and choose Run As > Run. The Run dialog appears. Right-click Java Application, choose New, and type `Dynamic` as the name of the new run configuration. Configuring the Run Configuration Main Class Enter the following in the Main class field:
       client.java_and_ws.dynamic.RunClients
4. Click Apply. Click the Classpath tab. ##### Configuring the Run Configuration Classpath Select Bootstrap Entries > WebLogic System Libraries, and click Remove (if the WebLogic System Libraries entry is present). Select User Entries Click Add External JARs Navigate to:
       <BEA_HOME>/wlserver_10.3/server/lib
3. select the `api.jar` file, and click Open. Click Apply. Click Close. #### Setting the Run Configuration for DSPClientSamplesStatic1 To set the run configuration for `DSPClientSamplesStatic1`: Right-click `DSPClientSamplesStatic1` in the Project Explorer and choose Run As > Run. The Run dialog appears. Right-click Java Application, choose New, and type Static as the name of the new run configuration. Configuring the Run Configuration Main Class Enter the following in the Main class field:
       client.java_and_ws.static0.RunClients
Click Apply. Click Close. ## Related Topics ##### How Tos Call ALDSP Using the Java Mediator API, Web Services, and DSP Controls Running the Mediator API Sample Projects ##### Reference Understanding the Advanced Static Mediator API Sample Static Mediator API Code Reference Dynamic Mediator API Code Reference Oracle Data Service Integrator Control Static Mediator API Code Reference Oracle Data Service Integrator Control Dynamic Mediator API Code Reference

Document generated by Confluence on Jan 13, 2009 15:15