7.1.10

Sample JSF 11g application that uses UCM search SOAP API and HTTP basic authentication

Here are some steps to create an application that uses UCM search API (SOAP based) and shows the results in the web page. In addition I will explain how to setup HTTP basic authentication to enable calling UCM web services.

Create an application

 

You start with creating an application

image

image

image

Give descriptive name for the default web project

image

image

Create JSF page

 

image

image

image

By default we start with the quick start layout:

image

image

Create web service data control based on UCM search WSDL

 

In this part I’ve already downloaded the UCM WSDL descriptions using another UCM instance. The SOAP API is still the same but WSDL points to another hostname as the endpoint. We will modify this later.

 

image

Choose “All Technologies” tab in the left hand side + Web Service Data Control” in the right hand side:

image

Browsing for the search API WSDL file:

image

image

image

I only choose one operation to be used:

image

image

Just click next(s):

image

image

image

Please note that at this point the end point that was derived from WSDL is still pointing to a wrong installation, and I will correct this error later in this guide.

Changing the end point URL for web service (optional)

 

Navigate to the DataControls.dcx file

image

Look into the bottom left hand side Structure pane:

image

Press mouse right click button to open context menu. Choose “Edit Web Service Connection…”

image

Let’s change the hostname. Leave username and password fields intact since they are not used as http basic authentication.

image

image

Adding input parameter field for search text

 

Next I will build up a very simple search form for UCM documents:

Select “Input Text” from component palette and drag’n’drop into the left hand pane:

image 

image

You could change the field names and labels to something more descriptive:

image

Add search results table

 

Next I will drag’n’drop the search results control to the right hand side:

image

image

image

I will only choose some of the columns by deleting the unwanted columns.

image

Leave this dialog to be as-is, press OK.

image

Add search command button

 

Next I will create a command button that will actually execute the query (calls the web service API eventually).

Select the QuickSearch operation from data control and drag’n’drop it into the left pane:

image

image

image

Bind the parameter to the input field

 

Many cases JDeveloper will automatically bind the input parameters from UI to the web service parameters, but here I’ll show you one way to do it when web full automation is not possible.

Navigate to the web service “Parameters” folder and choose the “queryText” parameter. Drag’n’drop it to the input field in JSF page.

image

Bind the input text field:

image

Let the defaults be there and press Ok:

image

image

Binding from input field to the parameter is now done.

Add HTTP basic authentication policy

 

To enable HTTP basic authentication you need to define web service security settings. I start choosing DataControls.dcx which reveals me data control structure, where I select the wanted data control.

image

Press context menu and choose “Define Web Service Security…”:

image

Press “+” to add new security policy:

image

Choose “oracle/wss_http_token_client_policy”:

image

Press “Override Properties..:”

image

Press “New key…”

image

Enter username and password for the end point (actually these will be overriden in the later phase). Enter key name that will be used to find the username and password settings from at runtime.

image

image

Csf-key is important to remember since this will be used to store the username and password for the endpoint in domain keystore.

image

image

Create deployment profiles for project and application and deploy

 

You need to first create WAR deployment profile for the project.

Then you create EAR deployment profile for the application and define the dependency to the WAR deployment profile.

You should deploy the application (not WAR).

Define credentials key under oracle.wsm.security

 

Login to the Fusion Middleware Enterprise manager console. The URL is something like http://localhost:7001/em

image

Press “Create Key”. Key attribute here is the csf-key you defined earlier. In my example I used csf-key “demo-ucm-search”. These are the actual username and password that are used when initiating the connection to UCM.

image

image

Test and run

Deploy the application to the domain and you should be fine with the application based on UCM SOAP APIs.

image

UCM search API uses special search notation, so I wanted to search for UCM documents that had “visa” in the document title. I enter the query criteria dDocTitle <substring> `visa`.

image

19.11.09

UCM WebService CheckinUniversal and Setting Target Folder

Oracle Universal Content Management (UCM) 10g has built-in SOAP interfaces to integrate with surrounding applications and tools.

For check-in purposes there is “CheckInUniversal” SOAP operation where you can check-in new documents into UCM. By default you can set all the main metadata but not folder information.

There is a way to set the target folder, if you needed to show the document in “traditional” file folder structure. For some reason the information how to do this seems to be a bit hard to find, that is why I publish this for wider audience (search engines should find).

There are two extra CustomDocMetaData properties you could use:

  • xCollectionName

  • xCollectionID

You specify one of the above properties. The end result is something like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:chec="http://www.stellent.com/CheckIn/">
<soapenv:Header/>
<soapenv:Body>
<chec:CheckInUniversal>
<chec:dDocName>OracleLogoSmall</chec:dDocName>
<chec:dDocTitle>Oracle logo</chec:dDocTitle>
<chec:dDocType>DOCUMENT</chec:dDocType>
<chec:dDocAuthor>weblogic</chec:dDocAuthor>
<chec:dSecurityGroup>WebCenter</chec:dSecurityGroup>
<chec:dDocAccount></chec:dDocAccount>
<chec:CustomDocMetaData>
<chec:property>
<chec:name>xComments</chec:name>
<chec:value>This is Oracle small logo</chec:value>
</chec:property>
<!--
<chec:property>
<chec:name>xCollectionID</chec:name>
<chec:value>31</chec:value>
</chec:property>
-->
<chec:property>
<chec:name>xCollectionName</chec:name>
<chec:value>/Contribution Folders/Logos/</chec:value>
</chec:property>
</chec:CustomDocMetaData>
<chec:primaryFile>
<chec:fileName>oracle_logo_small.gif</chec:fileName>
<chec:fileContent>R0lGODlhhQASAPcAAP////8AAP/o6P/29v/a2v8vL/+Tk/+Uk/8BAP/6+v/+/v8wL/8yMv8zM//3
9//8/P8sLP+4uP9vb//X1//p6f8zMv/09P/9/f9eXv/7+/8CAv/f3/8BAf/19f8FBP+ysv/4+P/y
8v81Nf+Qj/8wMP/Ly/+Pj/8EBP9ubv8XF//V1f+UlP8VFP+0tP8HB/8qKv+Bgf/n5/9iYv8WFf/P
z/82Nv82Nf8iIv/i4v8fH/+np//W1v+5uf9fXv+xsf8WFv+mpv/b2/8TE/8aGv/v7/+urv9HR//Y
2P/AwP84OP/Z2f+vr/9zcv/l5f9AQP8nJ/8lJP99ff9cXP8dHP87Ov+2tv+/vv+zs//Gxv9ZWP8m
Jv+env+Vlf8SEv9JSf88PP9oaP/d3f9VVf/r6/9EQ//Jyf+6uv+oqP+trf80M//Nzf/c3P9dXf/u
7v+qqv/T0/8pKf/s7P/x8f8REP+Xl//R0f8NDf/e3v/MzP+3t/93d/9xcf8/P//m5v9LS/8hIf94
ef+IiP9NTP9OTv+Ghv+kpP8FBf+Liv88O//t7f9kZP80NP/Dw/+iov8gIP8ICP8KCv8VFf+cnP9M
TP/k5P9lZf+wsP8xMf8uLv8DAv/z8/9rav/ExP8eHv/S0v/Kyv/q6v8PDv+rq/8oKP9TUv8REf+K
if8MC/9hYf8eHf/w8P8gH/+npv+Skv+gn/8GBf/Dwv8OD/9eXf+0s/8QD/8tLP/9/v+Wlf+YmP/z
9P9OTP+Eg//a2/91dP8YF/96ev/u7f/Z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Gb4IMM7hZExZhROViLRFklVAgIAidSDVBSaCrloo2zlEZpSOQDqkbUcEAoq
EhwUpkIESW5AwyJdzMCCxRcTk1QmsHwqUDsvBgBFDBJd4AdShnwAABFqBgDGvV8GO+ZMAiNQWGja
kGRtAHtoC2IAQ+AgcABKPnDHVmQZIopEyggyaiMAPCC11FiwFgAcFiigz5qXfbnoip1BjFQ6gEgg
AQpnn422BOwQkghJgyAFRQlobrAKUk4QQSfRdgL/QMEXSNnsQg7f4KOER7gkNUgv41DxxReImEOF
hkgxAUA3SXGjqGYzkxQC0lJoAoACpJdeer8f+YiUF1CKRwEbhHHABQBX1DmQHGzEFYAjQJBUhxZI
OeNJMoZ5YAY64SCVAh5eI0WNkGghtUwH2grkNFIVaENDEAR07333QaigjRFFktIGgrYPpEAzSXFg
AOoJ0JPUmYsF4IEHJ9zvgQtJFXDMChxASihg8I87fO+ASpjAAFqBlEu84YAQ7F4Z4JAUDLSAFxH0
XgI/ggMyKOUPJChAARYwQhIWgATQCFwAhLAk9PHNIxk4RCaSgoJfCQQNRZKHLQQyBknoAAhA0IEO
6FjhBikEEAHQKVNS5rCIBZhQhCJcQDWMIAA6IMUemCjhE58oQh+UwFqF4QAJuDjCEj5hBSQJBj8G
phQyjIQ36fMIF3KQFC9cZgc1QMoPvMKWbZAAKSxgRC5+wUb3YIONQPuVFSIUmk607iNEiIcYdGcY
I2wBFBJZAlKekCqSqGAGTKFEFpKyC4+x5QrgGFscHkADCeTDMFCgUASkwUa6CaQJJvijXzRgBbYM
gAICCKYwhylMVwkEBMGMA7VIEodgxgAHGZhHDIL5HiEBUwAUoFYCxkDMbp4vatzspjgh4xFVjFOY
XfNIQAAAOw==
</chec:fileContent>
</chec:primaryFile>
</chec:CheckInUniversal>
</soapenv:Body>
</soapenv:Envelope>


Word of Warning





I recognized some in some situations inconsitent behaviour (somebody might call it bug ;). Once you create a new virtual folder and try to check in documents into this folder using SOAP interface and xCollectionName, for some reason the documents end up not having the folder name. I recognized that once I called the check-in service first time with xCollectionID and then continued with xCollectionName, everything seemed to work ok.




This seems to have something to do with UCM interface folder data structures not being populated properly when a new folder is created. Bouncing the UCM server after creating the folder didn’t have any effect so the recommendation is to use xCollectionID at least once to enable using xCollectionName later.

25.10.09

ADF 11g on WebLogic (class not found errors)

 

Simple use case is here:

1. You want to create your first ADF portal or other ADF 11g based application.

 

2. You wanted to deploy it on your custom WebLogic 11g (10.3.1) domain, which you extended with Oracle JRF libraries.

 

3. On deployment time you would get something like this:

 

[09:31:02 PM] Deploying Application...
[09:31:06 PM] [Deployer:149193]Operation 'deploy' on application 'harriportalapp' has failed on 'AdminServer'
[09:31:06 PM] [Deployer:149034]An exception occurred for task [Deployer:149026]deploy application harriportalapp on AdminServer.: Failed to load webapp: 'HarriPortal-PortalViewController-context-root'.
[09:31:06 PM] Weblogic Server Exception: weblogic.application.ModuleException: Failed to load webapp: 'HarriPortal-PortalViewController-context-root'
[09:31:06 PM] Caused by: java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet
[09:31:06 PM]   See server logs or server console for more details.
[09:31:06 PM] weblogic.application.ModuleException: Failed to load webapp: 'HarriPortal-PortalViewController-context-root'
[09:31:06 PM] ####  Deployment incomplete.  ####
[09:31:06 PM] Deployment Failed

 

The problem might be in weblogic.xml file where you need to replace the

 

<library-ref>
  <library-name>adf.oracle.domain</library-name>
</library-ref>

with:

<library-ref>
  <library-name>adf.oracle.domain.webapp</library-name>
</library-ref>

 

Remember to deploy the ADF application from the application contect menu, not from project deployment menu.

15.9.09

XML DB: Forced XSD Schema deregistering

I played with OracleDB 11.1.0.7 XML DB and ended up in the situation where I couldn’t get my registered schema to disappear from Enterprise manager console.

Tried with all the options in the deletion mode, still the schema appears in the schema list and I get ORA-31000 errors while trying to delete the schema both from EM console and SQL*Plus:

SQL> exec DBMS_XMLSCHEMA.DELETESCHEMA('http://www.oracle.com/emp.xsd', DBMS_XMLS
CHEMA.DELETE_CASCADE_FORCE);
BEGIN DBMS_XMLSCHEMA.DELETESCHEMA('http://www.oracle.com/emp.xsd', DBMS_XMLSCHEM
A.DELETE_CASCADE_FORCE); END;

*
ERROR at line 1:
ORA-31000: Resource 'http://www.oracle.com/emp.xsd' is not an XDB schema
document
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 106
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 102
ORA-06512: at line 1

Purging Schema

The solution for this is purging the schema. First of all, take a look at the registered schemas using SQL statement:

SQL> select schema_url from user_xml_schemas;

SCHEMA_URL
---------------------------------------------

http://www.oracle.com/emp.xsd

SQL>

select schema_id from user_xml_schemas;

SCHEMA_ID
--------------------------------
91429F33C64A4D60B16294C670DD86C7

Now, copy that schema ID as the parameter to PURGESCHEMA and execute following:

SQL> exec DBMS_XMLSCHEMA.PURGESCHEMA('91429F33C64A4D60B16294C670DD86C7');

PL/SQL procedure successfully completed.

After this you shouldn’t have that extra schema hanging in your schema list anymore.

11.9.09

SOA Suite 11g installation – How to start BAM and SOA servers the first time

 

After installing SOA Suite 11g there has been a few questions asked why SOA or BAM servers are not started up. After you start the Admin server from $ORACLE_HOME/user_projects/domains/soadomain –using startWebLogic.cmd, you will get the Admin server up with the built-in Enterprise Manager. When you login to the enterprise manager using http://hostname:port/em, you will see the status of other servers, like this:

image

Indication is that BAM server or SOA server are not started. You can try starting these servers from GUI (click on server and mouse right-click) if you have your node manager up and running. If you don’t, here are my steps to do this form command line (replace the “C:\product\FMW11G” with your installation directory and “soadomain” with your domain name) :

C:\product\FMW11G\user_projects\domains\soadomain\bin>startManagedWebLogic.cmd soa_server1

Enter username to boot WebLogic server: weblogic

Enter password to boot WebLogic server:

 

After this, the SOA server starts up and SOA server runtime files gets created under C:\product\FMW11G\user_projects\domains\soadomain\servers –directory.

To automate the startup, not having to enter username and password, you need to create file called boot.properties and place this under security directory. In my example the directory would be C:\product\FMW11G\user_projects\domains\soadomain\servers\soa_server1\security. You need to create this directory manually if you don’t have it.

Editing the boot.properties is familiar if you have dealt with WebLogic server:

username=weblogic
password=mypassword

Next time server is started up, it reads the credentials from boot.properties, encrypts them in this file and continues with startup process.

Above instructions apply to BAM server as well.

This should be the end result:

image

“Start all” script for Windows

Here is a sample Windows script to start all servers that belong to SOA Suite (defaults to being on SOA domain directory):

start "SOA Admin Server" startWebLogic.cmd
start "SOA Server" bin\startManagedWeblogic.cmd soa_server1
start "BAM Server" bin\startManagedWeblogic.cmd bam_server1

31.8.09

File name too long – Error on WebLogic Portal domain removal

Sometimes you need to recreate domain or just remove the domain for good. On Windows you might end up with situation where simple recursive WebLogic domain folder delete will cause “File Name too Long” errors and one or two files out of the domain directory cannot be deleted.

The reason for this is that the complete path (including sub-directories) is longer than 256 characters. The workaround is to reduce the names of the subdirectories one-by-one until you are able to delete the whole domain directory tree. You can start with “rename AdminServer 1” etc. until you are able to remove.