SCA MultiService Sample

 

Overview

This sample shows service composition using existing services. The MultiService sample wires to several existing samples which include Stock Quote, Async Hello World, Job Bank Service, and EJB Counter. It demonstrates wiring to services over the default binding, web services binding, and the ejb binding for both ejb 2.x and ejb 3.x services. The MultiService sample exposes one business service over the default binding and the web service binding that returns a JAXB object. The Client JSP, packaged in a WAR file, utilizes this business service exposed over the default binding.

 

 

A. Prepare server environment to use existing samples referenced by MultiService sample

 

1. You must have chosen to install the sample applications as part of your WebSphere base install process in order for the appropriate base samples to be available. If you do not see the <WAS_HOME>\samples\lib\WebServicesSamples\WebServicesSamples.ear file available please reinstall the base application server with the option to install the sample applications.

 

2. This sample requires application security to be enabled.

            __ a. From the left navigation panel expand Security and select Global Security. Check the box marked Enable Application security.

            __ b. Click Apply at the bottom of the panel and then click the Save link at the top of the screen.

            __ c. You must restart you server for this change to take effect.

           

Task A.0 Install Stock Quote sample

1. The Stock Quote sample is located in the WebServicesSamples.ear under the samples directory (<WAS_HOME>\samples\lib\WebServicesSamples). . You can either install this ear file as an enterprise application through the admin console.

__ a. From the left navigation panel of the Administrative console, expand Applications and select New Application and then New Enterprise Application.

__ b. On the install panel, specify the Local file system option and enter the Full path or use the browse button to select the WebServicesSamples.ear file located in the <WAS_HOME>/samples/lib/WebServicesSamples directory. Click Next.

__ c. On the next panel expand the plus sign marked "Choose to generate default bindings and mappings” and check "Generate Default Bindings" and click Next, and then Continue on the next page.

__ d. Continue to click Next until the summary page and click Finish.

__ e. Click the Save link at the top of the screen.

 
2. After saving your configuration return to the screen under Applications->Application Types->WebSphere enterprise applications. Select the check box next to WebServicesSamples and then click on Start.

 

3. If you deployed the WebServicesSample.ear which includes the Stock Quote web service outside of the localhost or on a non default port you will need to modify the wsdl included in the MultiService sample. The wsdl file (StockQuoteFetcher.wsdl) is located in the jar under the <WAS_HOME>\samples\SCA\MultiService\src\main\resources\server\WEB-INF directory. You will need to modify the following line in the wsdl file to reflect the correct hostname and port.

<wsdlsoap:address location="http://localhost:9080/StockQuote/services/xmltoday-delayed-quotes"/>
 
Example:
 
<wsdlsoap:address location="http://scafp.websphere.ibm.com:9081/StockQuote/services/xmltoday-delayed-quotes"/>

 

Task A.1 Install Hello World Async sample

 

1. The hello world asynch sample is included as part of the SCA Feature Pack. The source and installable binaries are located in the samples directory. Follow the instructions in the readme.html under <WAS_HOME>/samples/SCA/helloworld-ws-asynch to install this sample. You do not need to install the client war for this sample. However it may be useful to install the client war to verify the hello world service is properly deployed.

 

2. After you have completed the install for the Hello World Async sample verify that you have started both BLA’s associated with this sample.

Note: You must deploy the HelloWorldAsync sample in the same SCA domain as you plan to deploy the MultiService sample application on.

 

Task A.2 Install Resume Bank EJB from Job Bank sample

Use the Administrative Console to deploy the JobBank EJB target application.

1. The JobBank sample is included as part of the SCA Feature Pack and is used in this sample. You only install the JobbankTargetEJBApp.ear from the <WAS_HOME>/installableApps directory as an enterprise application since the rest of the JobBanks sample is not needed for the purposes of this MultiService sample.

 

__ a. From the left navigation panel of the Administrative console, expand Applications and select New Application and then New Enterprise Application

__ b. On the install panel, specify the Local file system option and enter the Full path or use the browse button to select the JobbankTargetEJBApp.ear file located in the <WAS_HOME>/installableApps/ directory. Click Next.

__ c. On the next panel expand the plus sign marked "Choose to generate default bindings and mappings" and check "Generate Default Bindings" and click Next, and then Continue on the next page.

__ d. Continue to click Next until the summary page and click Finish.

__ e. Click the Save link at the top of the screen.

__ f. After saving your configuration return to the screen under Applications->Application Types->WebSphere enterprise applications. Select the check box next to the JobBanktargetEJB application and the click on Start.

 

Note: If you are not deploying this sample on the localhost or not using the default bootstrap port, 2809, you will need to take note of the hostname and bootstrap port that is being used for this server. You will need to update this information in your MultiService composite file, <WAS_HOME>\samples\SCA\MultiService\src\main\resources\server\META-INF\sca-deployables\default.composite.

<reference name="extEJBService">

    <interface.java interface="com.app.resumebank.ResumeBank"/>

    <binding.ejb uri="corbaname:iiop:localhost:2809/NameServiceServerRoot#ejb/com/app/resumebank/ResumeBankHome"/>

</reference>

 

Task A.3 Install EJB3 Counter sample

 

1. The EJB3 counter sample is located under <WAS_HOME>/installableApps/EJB3CounterSample.ear when you have installed the SCA Feature Pack.

 

2. Install the following ear file as an enterprise application: EJB3CounterSample.ear. The file is located in <WAS_HOME>/installableApps.

__ a. From the left navigation panel of the Administrative console, expand Applications and select New Application and then New Enterprise Application

__ b. On the install panel, specify the Local file system option and enter the Full path or use the browse button to select the EJB3CounterSample.ear file located in the <WAS_HOME>/installableApps/ directory. Click Next.

__ c. On the next panel expand the plus sign marked "Choose to generate default bindings and mappings" and check "Generate Default Bindings" and click Next, and then Continue on the next page.

__ d. Continue to click Next until the summary page and click Finish.

__ e. Click the Save link at the top of the screen.

__ f. After saving your configuration return to the screen under Applications->Application Types->WebSphere enterprise applications. Select the check box next to the EJB3CounterSample application and the click on Start.

 

Note: If you are not deploying this sample on the localhost or not using the default bootstrap port, 2809, you will need to take note of the hostname and bootstrap port that is being used for this server. You will need to update this information in your MultiService composite file, <WAS_HOME>\samples\SCA\MultiService\src\main\resources\server\META-INF\sca-deployables\default.composite.

 

<reference name="ejbCounterService">

    <interface.java interface="om.ibm.websphere.ejb3sample.counter.RemoteCounter"/>

    <binding.ejb uri="corbaname:iiop:localhost:2809/NameServiceServerRoot#ejb/EJBCounterEAR/EJBCounterSample.jar/StatelessCounterBean#com.ibm.websphere.ejb3sample.counter.RemoteCounter"/>

</reference>

 

B. Build the MultiService Sample Application.

 

Note: Be sure to make any modification to the composite or WSDL files before building the MultiService application. Review the above steps to check if you have deployed any of your sample applications outside the localhost or on non default ports.

 

1. Open a command window and change to the <WAS_HOME>\samples\SCA\MultiService directory.

 

2. Issue the following command to build the application

               <WAS_HOME>\profiles\<PROFILE_NAME>\bin\ws_ant.bat

               Example command:

               C:\WebSphere\AppServer\profiles\AppSrv01\bin\ws_ant.bat

 

3. Verify that the build completes without error.

 

4. The output of the build command can be found under the <WAS_HOME>\samples\SCA\MultiService\target directory. Verify that the following artifacts have been generated by the build:

               MultiService.jar

               MultiService.war

 

C. Deploy SCA MultiService Sample Application.

 

1. Use the Administrative Console to import MultiService.jar

               Note: As is noted above, you will need to modify the default.composite file in this asset before importing it if all of your applications are not deployed on the localhost and default ports.

__ a. Log into the Administrative Console by navigating to http://localhost:9060/admin in a Web browser.

__ b. From the left navigation panel of the Administrative console, expand Applications then Application Types and select Assets.

__ c. Press the Import button, then browse to <WAS_HOME>\samples\SCA\MultiService\target and select the MuliService.jar file. Click Next using all the default settings until you reach the summary page and click Finish.

__d. Click the Save link at the top of the screen.

 

2. Go to Applications->Application Types->Business-level applications and create a New Business-level Application called “MultiServiceBLA”. Under  Deployed Assets, Add->Add Asset, and select the MultiService.jar. Complete the installation using all the default settings and save your configuration.

 

3. Next Go return to Applications->Application Types->Business-level applications, and select the new BLA that you just created, MultiServiceBLA, and click Start.

 

D. Deploy SCA MultiService Sample Client JSP.

 

1. Log into the Administrative Console by navigating to http://localhost:9060/admin in a Web browser.

2. Install the MultiService client application.

__ a. If you have not already enabled application security, from the left navigation panel of the Administrative Console, expand Security->Global Security and check “Enable Application security”. Click OK and then click the Save link at the top of the screen. You must restart your server for this change to take effect. After you server has been restarted log back into the Administrative Console.

__ b. From the left navigation panel of the Administrative console, expand Applications and then select New Application and select New Enterprise Application.

__ e. On the install panel, specify the Local file system option and enter the Full path or use the browse button to select the MultiService.war file located in the <WAS_HOME>/samples/SCA/MultiService/target/ directory. Click Next.

__ f. Choose the radio button marked Detailed and then expand the plus sign marked "Choose to generate default bindings and mappings" and check "Generate Default Bindings" and click next, and then Continue on the next page.

__ g. Since the sample application is a WAR file, you need to specify the context root of the Web module in the WAR file. Skip ahead to the step titled Map context root for web modules and specify the context root as multiService and click Next.

 __h. On the next panel titled “Map security roles to users or groups” select the AllAuthenticatedUsers checkbox and then choose 'All Authenticated in Application's Realm' under 'Map Special Subjects' dropdown.

__ i. Select the Next button at the bottom of the panel

__ i. For the remaining install panels, select the defaults by clicking Next until you reach the final panel.  Click Finish to complete the installation of the sample application.

__ k. Verify in the admin console that the MultiService client has installed successfully.

__ l. Once the application is installed, save the changes by clicking on the Save link. The application will appear in the list of applications and its initial status will be stopped” (Status of Red).  Expand Applications then Application Types and select WebSphere enterprise applications.  Check the box next to MultiService_war and press Start.

__ m. Verify that the MultiService client application has started.  The application status for the MultiService_war should show a green arrow.  

 

3. Using a web browser open http://host:port/contextroot for example: http://localhost:9080/multiService.

               a. You will be prompted for a name and a stock symbol. Fill in the name text field with any name, and enter a valid stock symbol in the stock field and click Submit.

               b. If all you applications are deployed correctly you will see a response page that returns the following information:

 

               Greeting: Callback: Hola SCA User

               Authenticated Greeting: Callback: Hola SCA User You are logged in as: defaultWIMFleBasedRealm/wsadmin

               Symbol: IBM Price: 128.66

               Request count: 23

               Request Confirmation number: 102983337