development lifecycle for task flows in oracle webcenter ... · development lifecycle for task...
TRANSCRIPT
Lyudmil Pelov, A-Team, Oracle
December 2013
Development Lifecycle for Task Flows in Oracle
WebCenter Portal 11gR1 version 11.1.1.8.0
Development Lifecycle for Task Flows in Oracle WebCenter Portal
2
Table of Contents Introduction ......................................................................................................................................3
About the Examples Used in This Paper ..............................................................................................3
Step 1: Create a Fusion Web Application (GenericServiceConsumer) ...................................................6
Step 2: Start the Generic Web Service ............................................................................................... 11
Step 3: Create a Web Service Proxy .................................................................................................. 16
Step 3a: Create a Web Service Proxy Facade ..................................................................................... 23
Step 3b: Create a Data Control from the Proxy Facade (GenericServiceConsumer) ............................. 29
Step 4: Create a Bounded Task Flow ................................................................................................. 31
Step 5: Consume the Data Control in the Task Flow........................................................................... 35
Step 6: Create a Test Page to Test the Sample Task Flow ................................................................... 39
Step 7: Deploy the Sample Task Flow to an ADF Library JAR File ........................................................ 44
Step 8: Create the Deployer Project .................................................................................................. 50
Step 9: Deploy the Deployer Project with the Sample Task Flow (WAR file) to WebCenter Portal ....... 62
Step 10: Register the Sample Task Flow with WebCenter Portal ....................................................... 66
Step 11: Deploy PotalSharedLibrary to WebCenter Portal ................................................................. 75
Step 12: Register the Web Service Connection with WebCenter Portal ............................................. 79
Step 13: Add the Sample Task Flow to a WebCenter Portal Resource Catalog .................................... 83
Step 14: Change the Sample Task Flow and Redeploy ....................................................................... 88
Troubleshooting .............................................................................................................................. 95
Development Lifecycle for Task Flows in Oracle WebCenter Portal
3
Introduction
This paper steps you through the development lifecycle of a sample task flow in WebCenter
Portal 11.1.1.8.0. The example shows you how to develop and test a task flow in JDeveloper,
then describes how to deploy, redeploy, and use the task flow in WebCenter Portal. This paper
supplements the information found in “Planning a Portal with WebCenter Portal”, available at:
http://docs.oracle.com/cd/E29542_01/webportal.htm
About the Examples Used in This Paper
This paper ships with the following sample JDeveloper applications:
GenericWebService – Includes a web service that returns a simple user collection with
information. This sample web service is consumed by the sample task flow. To follow
along with this paper, you must first import the GenericWebService project into
JDeveloper and deploy the web service to a managed server accessible from WebCenter
Portal.
GenericServiceConsumer – Includes a sample task flow and a test page that enables you
to test the task flow independently from WebCenter Portal.
Deployer– Part of the GenericServiceConsumer application. Used to deploy the sample
task flow (as an ADF shared library WAR file) to the WebCenter Portal managed server.
The above examples should be used with JDeveloper 11.1.1.7 and the latest WebCenter Portal
extension version 11.1.1.8.
The high-level steps involved, as well as the individual actions comprising each step, are
depicted here:
Development Lifecycle for Task Flows in Oracle WebCenter Portal
4
Develop and test the sample task flow
Deploy the sample task flow
Register the sample task flow with WebCenter Portal
9. Deploy the Deployer Project (ADF Shared WAR) to WebCenter Portal
8. Create the Deployer project and import the JAR file
7. Deploy the sample task flow to an ADF library JAR file
12. Register the web service connection with WebCenter Portal
11. Deploy PortalSharedLibrary (extend.spaces.webapp.war) to WebCenter Portal
10. Register the sample task flow (ADF Shared WAR) with WebCenter Portal (extend.spaces.webapp.war)
6. Create a test page to test the sample task flow
5. Consume the proxy (data control) in the task flow
4. Create a bounded task flow (generic-service-taskflow)
3. Create a web service proxy (GenericServiceConsumer)
2. Deploy and start up the web service (GenericWebService)
1. Create a Fusion Web application (GenericServiceConsumer)
Development Lifecycle for Task Flows in Oracle WebCenter Portal
5
Use the sample task flow in WebCenter Portal
Redeploy updates to the sample task flow
The overall flow is illustrated in this diagram:
The remainder of this paper describes each step of the process in detail.
13. Add the sample task flow to a resource catalog and drop on pages
14. Change the sample task flow and redeploy
Development Lifecycle for Task Flows in Oracle WebCenter Portal
6
Step 1: Create a Fusion Web Application (GenericServiceConsumer)
The Fusion Web application serves as a host in which task flows are created and tested. To
create the application:
1. In JDeveloper, select File> New…
Development Lifecycle for Task Flows in Oracle WebCenter Portal
7
2. In the New Gallery window, select General->Applications, and then click Fusion Web
Application (ADF).
Development Lifecycle for Task Flows in Oracle WebCenter Portal
8
3. In the Application Name field, enter GenericServiceConsumer (or any name you choose)
as well as package prefix and click Next.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
9
4. Keep the default settings and click Finish.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
10
5. An application named GenericServiceConsumer displays with an ADF project, as shown
here:
Development Lifecycle for Task Flows in Oracle WebCenter Portal
11
Step 2: Start the Generic Web Service
NOTE: Any public web service can be used to complete this guide!
1. To test the web service, open the sample GenericWebService application provided with
this paper, right-click the UserService.java class, and select Test Web Service, as shown
below:
This step deploys the web service to the integrated WebLogic Server, then starts and prepares
it for testing, as shown below:
Development Lifecycle for Task Flows in Oracle WebCenter Portal
12
Select an operation from the Operations drop-down to test a specific web service method.
For example you can test the getUser() method by using following names as argument: Fill,
Peter, Rick.
If you want to approach new web service test with the HTTP Analyzer, click the Target URL
link in the integrated WebLogic Server Log (highlighted in red, as shown on the screenshot
above). This will open the HTTP Analyzer again and allow you to test new web service
function. The HTTP Analyzer window can be closed after you finish testing.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
13
The GenericWebService Application includes following two classes:
package com.oracle; public class User { private int id; private String name; private int age; public User() { super(); } public User(int id, String name, int age) { this.id = id; this.name = name; this.age = age; } public void setName(String name) { this.name = name; } public String getName() { return name; } public void setAge(int age) { this.age = age; } public int getAge() { return age; } public void setId(int id) { this.id = id; } public int getId() { return id; }
Development Lifecycle for Task Flows in Oracle WebCenter Portal
14
}
package com.oracle; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.jws.WebService; @WebService(serviceName = "UserServiceWS") public class UserService { private List<User> users = new ArrayList<User>(); public UserService() { users.add(new User(1, "Fill", 42)); users.add(new User(2, "Peter", 32)); users.add(new User(3, "Rick", 41)); } public String getMessage(String s) { if (s == null || s.equalsIgnoreCase("")) return "Hello nobody!"; return "Hello: " + s; } public void addUser(String name, int age) { users.add(new User(users.size() + 1, name, age)); } public User getUser(String name) { for (User user : this.users) { if (user.getName().equals(name)) { return user; } } return null; } public List<User> getUsers() {
Development Lifecycle for Task Flows in Oracle WebCenter Portal
15
return users; } }
2. Copy the WSDL URL, which you will need later when you create the java proxy. Right-
click the link and select Copy.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
16
Step 3: Create a Web Service Proxy
In this step, you’ll create a web proxy to consume the generic web service.
1. In JDeveloper, open the GenericServiceConsumer application you created in step 1.
Highlight ViewController, right-click, and select New…
Development Lifecycle for Task Flows in Oracle WebCenter Portal
17
2. From the New Gallery, All Technologies tab, under the Business Tier from the left side
navigation select Web Services, then select Web Service Proxy from the right side and
click OK.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
18
3. On the Create Web Service Proxy welcome screen, click Next.
4. Paste the WSDL URL from your web service, leave the rest of defaults, then click Next.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
19
5. Specify the namespaces for the packages, which will be created after the import, then
click Next.
Package Name: com.oracle.proxy.service
Root Package for Generated Types: com.oracle.proxy.types
Development Lifecycle for Task Flows in Oracle WebCenter Portal
20
6. Confirm the end point configuration and click Next.
7. Keep the default option on Asynchronous Methods and click Next.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
21
8. Keep the defaults and click Next.
9. Keep the defaults and click Next.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
22
10. Confirm the methods delivered from the web services and click Finish to create the
proxy.
If the proxy was configured properly, you should see following screen:
Development Lifecycle for Task Flows in Oracle WebCenter Portal
23
Step 3a: Create a Web Service Proxy Facade
To use the web service proxy in data controls, you must create a proxy facade to abstract the
logic from the web service proxy. To do this:
1. In JDeveloper, open the GenericServiceConsumer application.
2. Highlight ViewController, right-click, and select New…
Development Lifecycle for Task Flows in Oracle WebCenter Portal
24
3. From the New Gallery, select Java Class.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
25
4. Enter a name for the Java class and click OK.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
26
5. Change ProxyFacade to reference the Web Service Connection from the ADF
Connections configuration, which can be specified later. Notice that the name used for
the lookup search should be the same as the connection name:
The source code from the ProxyFacade class:
package com.oracle.view; import com.oracle.proxy.service.UserService; import com.oracle.proxy.service.UserServiceWS; import com.oracle.proxy.types.User; import java.util.List; import javax.xml.ws.WebServiceRef; import oracle.adf.model.connection.webservice.api.WebServiceConnection; import oracle.adf.share.ADFContext; public class ProxyFacade { @WebServiceRef private UserServiceWS userServiceWS; private UserService userService;
Development Lifecycle for Task Flows in Oracle WebCenter Portal
27
public ProxyFacade() { try { WebServiceConnection connection = (WebServiceConnection)ADFContext.getCurrent().getConnectionsContext().lookup("GenericUserWebServiceConnection"); userService = connection.getJaxWSPort(UserService.class); this.userService = this.userServiceWS.getUserServicePort(); } catch (Exception e) { e.printStackTrace(); } } public List<User> getUsers() { return this.userService.getUsers(); } public User getUser(String username) { return this.userService.getUser(username); }
}
Within the constructor, the current context looks for the web service configuration within the
connection.xml file.
The connection should be specified within the local JDeveloper project connection.xml file by
using following XML syntax:
<?xml version = '1.0' encoding = 'UTF-8'?> <References xmlns="http://xmlns.oracle.com/adf/jndi"> <Reference name="GenericUserWebServiceConnection" className="oracle.adf.model.connection.webservice.impl.WebServiceConnectionImpl" manageInOracleEnterpriseManager="true" deployable="true" xmlns=""> <Factory className="oracle.adf.model.connection.webservice.api.WebServiceConnectionFactory"/> <RefAddresses> <XmlRefAddr addrType="WebServiceConnection"> <Contents> <wsconnection description="http://localhost:8888/GenericWebService-UserWebService-context-root/UserServiceSoap12HttpPort?WSDL" service="{http://oracle.com/}UserServicePort"/> </Contents>
Development Lifecycle for Task Flows in Oracle WebCenter Portal
28
</XmlRefAddr> </RefAddresses> </Reference>
</References>
Please note that this excerpt shows the Web Service connection used by WebCenter Portal.
Even if this connection appears in the local JDeveloper Project connection.xml file, the
connection will not appear within the Connections section as shown on the screen shot below
until you add it manually:
In order to add the connection open the Consumer application. Under Application Resources-
>Descriptions>ADF META-INF open the connections.xml file and add the XML Reference
snipped already provided, as shown on the screenshot above.
NOTE: It is very important to add this connection configuration to be able to test the
application locally at your development machine!
Development Lifecycle for Task Flows in Oracle WebCenter Portal
29
Step 3b: Create a Data Control from the Proxy Facade (GenericServiceConsumer)
In this step you’ll create a data control, using the proxy facade you created in step 4.
1. In JDeveloper, go to the GenericServiceConsumer project, right-click on the
ProxyFacade class, and select Create Data Control.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
30
2. Wait for JDeveloper to prepare the configurations. After a few seconds, the data
controller should be created.
The new data control can be now used within ADF pages or task flows.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
31
Step 4: Create a Bounded Task Flow
In this step, you’ll create a bounded ADF task flow. Later on, you will deploy this task flow to
the portal server and use it in WebCenter Portal.
Note: It is important that you work within the ViewController project. In a later step, you will
export content from the ViewController project to an ADF JAR library ready for deployment to a
portal server. (Alternatively, you can create the business logic in a separate project and then
import it to the ViewController project.)
1. Select the ViewController project, then click the New icon.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
32
2. From the New Gallery, select ADF Task Flow (JSF) and click OK.
3. Enter a file name in the File Name field.
4. On enter the File Name the Task Flow ID will be automatically changed.
IMPORTANT: Choose the name carefully. The Task Flow ID(generic-service-task-flow)
we specify here is what should be used to identify the task flow in WebCenter Portal’s
resource catalog later.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
33
5. From the palette on the right, select View and drag and drop it on to the task flow definition
surface. Enter userservice for the view name.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
34
6. Double-click the view to create a new fragment. In the File Name field, enter userservice.jsff.
7. Select Blank Page as the page template and click OK.
8. Save all your changes.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
35
Step 5: Consume the Data Control in the Task Flow
In this step, you’ll consume the data control you created earlier within the task flow.
1. Open the userservice.jsff page fragment.
2. Expand the Data Controls tab, then go to ProxyFacade->getUser(String).
Note: As a test, we will first create a simple example based only on the getUser service call.
We will use the rest of the service later.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
36
3. Drag and drop getUser from the Data Controls navigator to the task flow page
fragment, then select ADF Parameter Form from the drop-down list.
The ADF Parameter Form option creates a form that allows the return of user information
based on user name.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
37
4. From the function getUser, drag and drop age (under Return parameter) to the page.
The age parameter displays the age of the user in the information returned.
5. From the drop-down menu, select the output option you prefer.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
38
The page should look now like this:
Development Lifecycle for Task Flows in Oracle WebCenter Portal
39
Step 6: Create a Test Page to Test the Sample Task Flow
To test the task flow, create a page and drag and drop the task flow as a binding on the page.
1. In the JDeveloper GenericServiceConsumer application, click the New icon, then select
JSF Page to create a new page.
2. Enter a name for the new page, for example userservicetester.jspax and select a
template your choice. The page could have blank template, as it will be used only to test
Development Lifecycle for Task Flows in Oracle WebCenter Portal
40
the task flow.
After the page has been created, your project should look like this:
Development Lifecycle for Task Flows in Oracle WebCenter Portal
41
3. Drag and drop the task flow to the page, as shown below. Be sure to select Region from
the drop-down menu.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
42
4. Run the page to test the task flow.
The page should start without any error messages and display in your default browser, as
shown here:
Development Lifecycle for Task Flows in Oracle WebCenter Portal
43
5. When you type a user name in the Username field, the age of the user should display.
The default web service has the following user names:
Fill: Age 42, Peter: Age 32, Rick: Age 41.
Test all three users to make sure that the web service and task flow work properly.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
44
Step 7: Deploy the Sample Task Flow to an ADF Library JAR File
In this step, you’ll deploy the sample task flow that contains the web service proxy and the data
control to an ADF library (JAR file) that you can use in WebCenter Portal.
Note: There are two stages in task flow deployment:
Deploy the task flow project to an ADF library JAR file.
Create another deployment profile to deploy the ADF library JAR file to your target
server.
This step describes the first stage (deployment to JAR file).
To deploy the GenericServiceConsumer task flow project to a JAR file:
1. To export the ViewController project as an ADF library JAR file, you must create a new
deployment profile. Right-click the ViewController project and select Project Properties.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
45
2. In the new window, select Deployment.
3. Select New in the panel on the right to create a new WAR profile.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
46
4. Under Archive Type, select ADF Library JAR File, and enter a name for the file (for
example, adflibGenericServiceConsumer1). Click OK.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
47
5. Keep the default settings on the following screen, and click OK to save the new
deployment profile. You will use this profile in the next step.
6. Create the ADF Library JAR file by deploying the profile. Right-click the ViewController
project, then select Deployment-><Deployment Profile Name>.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
48
This creates the JAR file within the local JDeveloper project.
7. On the Deployment Action screen, select Deploy to ADF Library JAR file and click Next .
Development Lifecycle for Task Flows in Oracle WebCenter Portal
49
8. Validate the summary information, and then click Finish to create the JAR file.
The folder containing the ADF library JAR file displays within the log if the deployment
profile executed successfully.
In the next step, you will deploy the newly created ADF library JAR file containing your task
flow to WebCenter Portal’s managed server using the Deployer project.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
50
Step 8: Create the Deployer Project
In this step, you’ll create a generic project that can deploy one or more task flow projects. This
project is only used to deploy ADF libraries (JAR files) to a WebCenter Portal managed server.
1. To create the Deployer project within the GenericServiceConsumer application, click
New…, then select New Project….
Development Lifecycle for Task Flows in Oracle WebCenter Portal
51
2. On the next screen, select Generic Project, and then click OK.
3. In the Project Name field, type Deployer, then click Finish.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
52
The Deployer project displays in the navigator, as shown here:
4. Next we need to include the ADF library JAR you created from the ViewController
deployment profile in the new Deployer project. To do this:
Development Lifecycle for Task Flows in Oracle WebCenter Portal
53
a) Right-click the Deployer project and select Project Properties. From the new screen,
select Libraries and Classpath.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
54
b) Click Add JAR/Directory. From the next screen, select the ADF library JAR file (as
shown below). Click Select, then OK to confirm.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
55
This action changes the Generic Project into a project with ADF Dependencies, as shown
below:
IMPORTANT: Double check the WEB.XML file that there are no entries within the file.
You should do this every time you include any library into the Deployer project. Entries
in WEB.XML file will cause exception on deployment. For more information see the
troubleshooting section on the end of this document. WEB.XML file should look like the
screenshot below:
Development Lifecycle for Task Flows in Oracle WebCenter Portal
56
c) Save your changes.
In the next step you will create a manifest file that allows you to deploy several versions of
the same project to the WebCenter Portal managed server. You cannot deploy multiple ADF
shared libraries with the same version, but you can use the manifest file to increment
deployment versions.
5. Before you can add a manifest file to the Deployer project, you must create a new
deployment profile. To create a deployment profile, click the Deployer project and
select Project Properties.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
57
6. On the Project Properties screen, select Deployment, then click New…
7. In the Archive Type drop-down, select WAR File. Enter a name for the deployment
profile (in our case genericserviceconsumer), then click OK and confirm the defaults in
case pop message appears.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
58
8. Confirm OK again on the Deployment profile screen.
9. Now create the manifest file. Go to the project file system and create a file called
MANIFEST.MF file within the /src/META-INF/ folder. (You may need to create the folder
itself.)
NOTE: This step can be also proceeded in JDeveloper, by creating two folders and then a
file.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
59
10. Add task flow information to the manifest file, for example:
Manifest-Version: 1.0 Created-By: A-Team Implementation-Title: training.generic.taskflow Extension-Name: extend.portal.training.generic.taskflow Specification-Version: 1.0.0 Implementation-Version: 1.0.0 Implementation-Vendor: Oracle
11. Include the manifest file within the project deployment profile. Right-click the Deployer
project, select Project Properties, select Deployment, then select the deployment
profile. Click Edit… to edit the profile.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
60
12. On the Edit WAR Deployment Profile screen, select WAR Options, then select the
Include Manifest File checkbox.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
61
13. Click Add… to select the manifest file and add it to the deployment profile. On the new
screen, go down to the META-INF folder and select the manifest file, as shown below,
then click Open and OK to save.
The Deployer project is now ready to deploy the sample task flow.
Within the Deployer project you should now see the new MANIFEST.MF file:
Development Lifecycle for Task Flows in Oracle WebCenter Portal
62
Step 9: Deploy the Deployer Project with the Sample Task Flow (WAR file) to WebCenter
Portal
In this step, you’ll deploy the sample task flow to the portal server using the Deployer project.
Note: Ensure that the WebCenter Portal managed server (11.1.1.8.0) is up and running before
starting this step.
1. Right-click the Deployer project, select Deploy, then select the deployment profile you
created earlier.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
63
2. On the Deployment Action screen, select Deploy to Application Server, then click Next.
3. Select the connection that points to the WebLogic Server where you want to deploy the
shared library. In this example, WebCenter Portal runs on VirtualBox (vmwls).
Development Lifecycle for Task Flows in Oracle WebCenter Portal
64
4. On the WebLogic Options screen, select the managed server on which WebCenter Portal
is deployed (WC_Spaces), as well as the Deploy as a shared library option.
5. Confirm the options and click Finish to deploy the ADF shared library that contains the
sample task flow.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
65
A deployment log similar to that shown here displays if deployment was successful:
6. Use the WebLogic Administration Console to confirm that the library successfully
deployed on the managed server. For example, the screen below shows version 1.0.0
was deployed as specified within the manifest file.
NOTE: As shown on the screen above you should see the deployed library in format:
extend.portal.training.generic.taskflow, as this was the name specified within the
MANIFEST.MF file. On the end of the shared library the version is shown.
Before you can use the task flow in WebCenter Portal, you must restart the managed server on
which you deployed the task flow. However, before you restart the server you must register
the ADF shared library with WebCenter Portal using the WebCenter Portal Server Extension
Project, as described in the next section.
Note: Make sure that the Generic Web Service example is deployed so you can use it from the
task flow. The web service can be installed on any managed server accessible from WebCenter
Portal. In this example, the web service is installed on the WebCenter Portal Managed Server
and has the following URL:
http://localhost:8888/GenericWebService-UserWebService-context-
root/UserServiceSoap12HttpPort
Test the web service by opening the URL from your browser as shown here:
Development Lifecycle for Task Flows in Oracle WebCenter Portal
66
Step 10: Register the Sample Task Flow with WebCenter Portal
The ADF shared library file containing your task flow is deployed and ready to use, but the task
flow will not appear in the WebCenter Portal resource catalog until you have registered the ADF
shared library with WebCenter Portal and restarted the managed server on which WebCenter
Portal is deployed. This step describes how to register additional ADF shared libraries with
WebCenter Portal using the WebCenter Portal Server Extension Project.
1. To create a new WebCenter Portal Server Extension application, click the New icon,
select Applications, and then select WebCenter Portal Server Extension. Click OK.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
67
2. On the Name your application screen, enter a name for the application (or keep the
default), then click Next.
3. Leave the default settings on the Project 1 Name screen and click Next.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
68
4. Either leave the default settings on the Configure Java Settings screen, or enter a new
Default Package name if you prefer.
5. Leave the default settings on the Project 2 Name screen, and click Finish.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
69
Two projects display in JDeveloper:
PortalSharedLibrary. In the following steps you will use the PortalSharedLibrary
project to register the ADF shared library that you want to use in WebCenter
Portal in weblogic.xml. This project includes a WAR deployment profile called
extend.spaces.webapp. Later on, when you deploy to
extend.spaces.webapp.war, any additional custom shared libraries that you have
registered in weblogic.xml are included as dependencies of
extend.spaces.webapp.war and become available in WebCenter Portal.
PortalExtension. PortalExtension is a starter project which you can also use to
create custom ADF components, such as task flows, data controls, and managed
beans. If used, the PortalExtension project is deployed to an ADF Library JAR file
and should be added as a dependency to the extend.spaces.webapp.war shared
library file generated from the PortalSharedLibrary project.
Note: The example in this paper does not use the PortalExtension project.
6. By default, the PortalSharedLibrary project does not have a WebLogic Server
Deployment descriptor (weblogic.xml). To create one, right-click the
PortalSharedLibrary project, then select New.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
70
7. On the New Gallery screen, select Deployment Descriptors, select WebLogic
Deployment Descriptor, then click OK.
8. On the Select Descriptor screen, select weblogic.xml, then click Next.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
71
9. Select the WebLogic Server version this descriptor must support and click Next.
10. Click Finish to create the deployment descriptor.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
72
Now the project includes a weblogic.xml file, in which you can register the ADF shared
library JAR file you deployed earlier.
11. If the weblogic.xml file is not open, double click to open it.
12. Select Libraries from the tab menu on the left. You can use the Libraries page to specify
the names of any ADF shared libraries that you want to use in WebCenter Portal.
Note: Oracle recommends that you specify all ADF shared libraries that you want to use in
WebCenter Portal in the same WebCenter Portal Server Extension project. There is no need
to create a new project for each shared library. If for some reason you do create multiple
WebCenter Portal Server Extension projects, you must change the manifest files
configuration (MANIFEST.MF) to have different namespaces, if you deploy to the same
WebCenter managed server.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
73
13. Register the ADF shared library WAR you deployed earlier by adding the library name
and version information (extend.portal.training.generic.taskflow), as shown below.
Ensure that the information you specify here matches the version information specified
in the Deployer manifest file.
Note: You can register multiple ADF shared libraries. However, the components should have
different assets and resources names. For example, if you register a second ADF shared
library, the project included should have different data binding names.
14. To prevent deployment exceptions, you must increment the implementation version in
the MANIFEST.MF file. Open the MANIFEST.MF file and change the implementation
version for extend.spaces.webapp.war as shown.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
74
Now you can deploy the PortalSharedLibrary project to the WebCenter Portal managed
server(s).
NOTE: On the screen-shot above we extend the implementation version to higher number
11.1.9, as we did several tests. Every time you redeploy you have to increase that number
to be able to install newer version.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
75
Step 11: Deploy PotalSharedLibrary to WebCenter Portal
1. Right click PortalSharedLibrary, select Deploy, then select the default deployment
profile extend.spaces.webapp.
2. Select Deploy to Application Server, then click Next.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
76
3. Select the connection that points to the WebLogic Server where you want to deploy the
shared library. In this example, WebCenter Portal runs on VirtualBox (vmwls).
Note: This example demonstrates direct deployment from JDeveloper. If you prefer, you
can deploy the PortalSharedLibrary project to a WAR file (extend.spaces.webapp.war),
then use WLST scripts to deploy the WAR file in your environment.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
77
4. On the WebLogic Options screen, select the managed server(s) or cluster on which
WebCenter Portal Server is deployed (WC_Spaces in this example), as well as the
Deploy as a shared library option.
5. Check that the deployment log has no error messages and the deployment was
successful.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
78
6. Log in to the WebLogic Server Administration Console and confirm that the project was
deployed.
7. Restart the managed server(s) on which WebCenter Portal is running (WC_Spaces, in
this example). After restarting the server you will be able to access the sample task flow
in WebCenter Portal.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
79
Step 12: Register the Web Service Connection with WebCenter Portal
The custom sample task flow requires a web service connection, which must be configured in
your WebCenter Portal instance. To configure a web service connection for WebCenter Portal:
1. To be able to change and add the new configuration, you should use Enterprise
Manager (EM). Log in to EM with sufficient user rights.
2. Go to WebCenter->Portal->Spaces, then click on the WebCenter Portal application.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
80
3. From the WebCenter Portal menu, select ADF->Configure ADF Connections.
4. Add a new web service connection with the same name
(GenericUserWebServiceConnection) as that used in the ProxyFacade.java class (see
screen shot below). Click the Create Connection button to create the connection.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
81
5. The new connection should appear within the Web Service Connections section. Click
the connection name, and then click the Edit icon.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
82
6. Specify the connection properties as shown below, and then click OK to confirm.
7. Click the Apply button to apply the settings to MDS.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
83
Note that you do not have to restart the server after you create this connection.
Note: To move connections between environments, you can use the WLST command
importWebCenterPortalConnections, which was introduced with the WebCenter Portal 11.1.1.8
release. For more information about the connection property files, follow this link.
Step 13: Add the Sample Task Flow to a WebCenter Portal Resource Catalog
To make the sample task flow available for someone to drag and drop onto a portal page, you
must add it to a resource catalog:
Note: This example adds the task flow to a shared resource catalog (sometimes referred to as
an application-level resource catalog). You can add task flows to portal-level resource catalogs
as well.
1. Log in to WebCenter Portal as an Administrator or Application Specialist (that is, you
must have permissions to edit shared resource catalogs). Select Administration >Shared
Assets->Resource Catalogs.
2. Copy one of the default catalogs so you can change it. In this example, a copy of the
Default Home Portal Catalog is named ATeam Home Portal Catalog.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
84
3. Click Edit.
4. In the Edit Catalog window, click Add, then select Add From Library.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
85
5. In the list of resources, click Task Flows, then expand the Design Time folder.
6. Search for the sample task flow in the tree. The name of the task flow is the same as the
one used when the task flow was created; for example, generic-service-task-flow. Select
it and click Add to add it to the resource catalog.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
86
Note: The Edit Resource Catalog window allows you to sort or order the resources. It is
possible, for example, to create a new folder and include the task flow inside.
The task flow displays in the list as shown above.
Now the task flow can be consumed on portals, which are using the same resource catalog.
Note: The resource catalog must be assigned as the default resource catalog for the portal,
which should have access to the new task flow.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
87
7. Create a new page, switch to edit mode, and then drag and drop the task flow from the
resource catalog on to the page.
8. Save the page and test the task flow.
You can also test the task flow using the page preview functionality as shown bellow:
Development Lifecycle for Task Flows in Oracle WebCenter Portal
88
Step 14: Change the Sample Task Flow and Redeploy
If changes are applied to the task flow, you must redeploy an updated ADF library JAR file with
the task flow updates. To do this:
1. Update the sample task flow. For example, add a table that displays the users delivered
from the web service.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
89
2. Test the task flow locally as discussed earlier in this paper, by creating a test page and
binding a region with the task flow.
3. Run the test page to test the task flow changes locally.
If the test was successful, you can deploy the updated task flow to the portal server.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
90
4. Deploy the ViewController project to an ADF library JAR file, as shown here. There is no
need to change the deployment profile.
5. Refresh the ADF shared library dependencies from the Deployer project.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
91
6. Make sure that the GenericServiceConsumer library updates as well.
7. Increase the implementation version in the Deployer manifest file to prevent
deployment conflicts.
IMPORTANT: Make sure that there are NO changes to WEB.XML in the Deployer
project. If there are any changes, you must remove them. If you do not, you will not be
able to start the WebCenter Portal Server properly after redeployment and you will get
an error message, which is shown in the Troubleshooting section at the end of this
document.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
92
Remove the WEB.XML content, if any, as shown above.
8. Redeploy the ADF shared library WAR file to the WebCenter Portal managed server or
cluster. Use the same deployment profile you created earlier.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
93
9. In the WebCenter Portal Server Extension project, reference the new shared library
version in weblogic.xml as shown:
10. Increment the WebCenter Portal Server Extension version in the manifest.mf file.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
94
11. Deploy the updates to the PortalSharedLibrary project to the WebCenter Portal
managed server or cluster.
12. Restart the WebCenter Portal managed server(s) or cluster, to make the changes
available.
NOTE: The updated task flow automatically becomes available in WebCenter Portal. You do
not need to add the task flow to the resource catalog again.
13. Open the page containing the sample task flow to confirm that the latest, updated task
flow displays.
Development Lifecycle for Task Flows in Oracle WebCenter Portal
95
Troubleshooting
Issue: The following error message displays if the web.xml file in the Deployer project contains
an invalid configuration:
[WC_Spaces] [NOTIFICATION] [J2EE JSP-00008] [oracle.j2ee.jsp] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: anonymous] [ecid: 004uUEj1iPaFw000jzwkno00023J0000Zw,0:1] [APP: webcenter#11.1.1.4.0] [URI: /webcenter/] unable to dispatch JSP page: The following exception occurred:.[[ oracle.jsp.parse.JavaCodeException: Line # 13, oracle.jsp.parse.JspParseTagScriptlet@1d1311fe Error: Java code in jsp source files is not allowed in ojsp.next mode. at oracle.jsp.parse.JspParseTagCore.createNode(JspParseTagCore.java:263) at oracle.jsp.parse.JspUtils.createChildNodes(JspUtils.java:2511) at oracle.jsp.parse.JspParseTagFile.createTree(JspParseTagFile.java:475) at oracle.jsp.parse.OracleJsp2Java.transformImpl(OracleJsp2Java.java:535) at oracle.jsp.parse.OracleJsp2Java.transform(OracleJsp2Java.java:593) at oracle.jsp.runtimev2.JspPageCompiler.attemptCompilePage(JspPageCompiler.java:691) at oracle.jsp.runtimev2.JspPageCompiler.compileBothModes(JspPageCompiler.java:490) at oracle.jsp.runtimev2.JspPageCompiler.parseAndGetTreeNode(JspPageCompiler.java:457) at oracle.jsp.runtimev2.JspPageInfo.compileAndLoad(JspPageInfo.java:624) at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:645) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:389) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:842) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:766) at javax.servlet.http.HttpServlet.service(HttpServlet.java:821) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:185) at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:526) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:253) at weblogic.servlet.internal.ServletResponseImpl.sendError(ServletResponseImpl.java:731) at oracle.jsp.runtimev2.JspReportUtil.sendError(JspReportUtil.java:144) at oracle.jsp.runtimev2.JspReportUtil.reportException(JspReportUtil.java:201)
Development Lifecycle for Task Flows in Oracle WebCenter Portal
96
at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:694) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:389) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:842) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:766) at javax.servlet.http.HttpServlet.service(HttpServlet.java:821) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:27) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57) at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:181) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57) at oracle.wcps.client.PersonalizationFilter.doFilter(PersonalizationFilter.java:74) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57) at oracle.webcenter.content.integration.servlets.ContentServletFilter.doFilter(ContentServletFilter.java:168) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57) at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119) at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324) at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460) at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103) at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171) at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57) at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57) at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119) at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324) at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460) at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103) at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171) at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57) at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730) at
Development Lifecycle for Task Flows in Oracle WebCenter Portal
97
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256) at weblogic.work.ExecuteThread.run(ExecuteThread.java:221) ]]
Solution: Remove the invalid configuration within the Deployer WEB.XML file. The file should
look like shown below:
Development Lifecycle for Task Flows in Oracle WebCenter Portal
98
Development Lifecycle for Task Flows in Oracle
WebCenter Portal 11gR1 verson 11.1.1.8.0
December 2013
Author: Lyudmil Pelov
Oracle Corporation
World Headquarters
500 Oracle Parkway
Redwood Shores, CA 94065
U.S.A.
Worldwide Inquiries:
Phone: +1.650.506.7000
Fax: +1.650.506.7200
oracle.com
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
This document is provided for information purposes only, and the contents hereof are subject to change without notice. This
document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in
law, including implied warranties and conditions of merchantability or fitness for a particular purpose. We specifically disclaim any
liability with respect to this document, and no contractual obligations are formed either directly or indirectly by this document. This
document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our
prior written permission.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.