tag:blogger.com,1999:blog-84871427016562036042024-03-18T02:47:50.556-07:00Mark's BlogMark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.comBlogger80125tag:blogger.com,1999:blog-8487142701656203604.post-8031736109307207772015-03-02T20:06:00.000-08:002015-03-02T20:07:37.907-08:00Use Spring SimpleJdbcCall to invoke Oracle stored procedure with <span style="background-color: white; font-family: Times, 'Times New Roman', serif; font-size: large;">Here I would like to show a simple example of using Spring SimpleJdbcCall to invoke one Oracle stored procedure with out parameters as the table of the PL/SQL object. </span><br />
<span style="background-color: white; font-family: Times, 'Times New Roman', serif; font-size: large;"><br /></span>
<br />
<h4>
<span style="font-size: large;">Maven</span></h4>
<span style="background-color: white; font-family: Times, 'Times New Roman', serif; font-size: large;">The Oracle database is Oracle 11g and JDBC driver class used ojdbc6-11.2.0.4.jar. The below is Maven dependency in the project </span><span style="background-color: white; font-family: Times, 'Times New Roman', serif; font-size: large;">file.</span><br />
<pre class="prettyprint linenums"> <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.4</version>
</dependency>
</pre>
<span style="font-size: large;"><br /></span>
<br />
<h4>
<span style="font-size: large;">Table Schema</span></h4>
<span style="background-color: white; font-family: Times, 'Times New Roman', serif; font-size: large;">The below is DDL for the table BATCH</span><span style="background-color: white; font-family: Times, 'Times New Roman', serif; font-size: large;">.</span><br />
<pre class="prettyprint linenums"> CREATE TABLE "BATCH"
(
"ID" NUMBER NOT NULL,
"BATCH_NAME" VARCHAR2(256),
"BATCH_STATUS" VARCHAR2(20),
"LAST_UPDATE_DATE" DATE,
"CREATION_DATE" DATE,
"LAST_UPDATED_BY" VARCHAR2(100),
"CREATED_BY" VARCHAR2(100),
CONSTRAINT BATCH_PK PRIMARY KEY (ID)
) ;
</pre>
<span style="font-size: large;"><br /></span>
<br />
<h4>
<span style="font-size: large;">Object Type</span></h4>
<span style="background-color: white; font-family: Times, 'Times New Roman', serif; font-size: large;">In the database one object type: BATCH_REC is defined.</span><br />
<pre class="prettyprint linenums">CREATE or REPLACE
TYPE BATCH_REC as OBJECT (
BATCH_ID NUMBER(10,0),
BATCH_NAME VARCHAR2(256),
BATCH_STATUS VARCHAR2(20),
CREATION_DATE DATE,
INVOICES INVOICE_TAB
);
CREATE OR REPLACE
TYPE BATCH_TAB IS TABLE OF BATCH_REC;
/
</pre>
<span style="font-size: large;"><br /></span>
<br />
<h4>
<span style="font-size: large;">Stored Procedure</span></h4>
<span style="background-color: white; font-family: Times, 'Times New Roman', serif; font-size: large;">The stored procedure RETRIEVE_BATCH_BY_BATCHSTATUS is shown as below. This is used to retrieve a list of batches by using batchStatus. batchStatus is defined as in parameter and batches of t</span><span style="background-color: white; font-family: Times, 'Times New Roman', serif; font-size: large;">ype BATCH_TAB as out parameter.</span><br />
<pre class="prettyprint linenums">CREATE OR REPLACE PROCEDURE "RETRIEVE_BATCH_BY_BATCHSTATUS"
(
batchStatus in BATCH.BATCH_STATUS%TYPE,
batches out BATCH_TAB,
p_error_flag out varchar2,
p_error_code out varchar2,
p_error_message out varchar2
)
IS
BEGIN
batches := BATCH_TAB();
select BATCH_REC(bat.ID,
bat.BATCH_NAME,
bat.BATCH_STATUS,
bat.VENDOR_SITE_ID,
bat.CREATION_DATE,
bat.LAST_UPDATE_DATE,
bat.LAST_UPDATED_BY,
bat.CREATED_BY)
bulk collect into batches
from BATCH bat where bat.BATCH_STATUS=batchStatus;
p_error_flag := 'N';
EXCEPTION
WHEN OTHERS THEN
p_error_code := SQLCODE;
p_error_message := concat( concat( SQLERRM, ' '), dbms_utility.format_error_backtrace() );
p_error_flag := 'Y';
END;
</pre>
<span style="font-size: large;"><br /></span>
<br />
<h4>
<span style="font-size: large;">Spring Class</span></h4>
<span style="background-color: white; font-family: Times, 'Times New Roman', serif; font-size: large;">Here is the DAO class which will use Spring </span><span style="background-color: white; font-family: Times, 'Times New Roman', serif; font-size: large;">SimpleJdbcCall</span><span style="background-color: white; font-family: Times, 'Times New Roman', serif; font-size: large;"> to invoke the stored procedure: </span><span style="background-color: white; font-family: Times, 'Times New Roman', serif; font-size: large;">RETRIEVE_BATCH_BY_BATCHSTATUS</span><span style="background-color: white; font-family: Times, 'Times New Roman', serif; font-size: large;">. In order to return a list of batches from SimpleJdbcCall there are some points worth to be noticed: </span><br />
<br />
<ol>
<li><span style="font-family: Times, Times New Roman, serif; font-size: large;">When declaring out parameter batches, specify its type as Types.ARRAY and also specify its type name as "BATCH_TAB" which is collection type defined in the database.</span></li>
<li><span style="font-family: Times, Times New Roman, serif; font-size: large;">After the invocation the return value of batches will be casted into the object of oracle.sql.ARRAY, from which the array will be casted into array of Object.</span></li>
<li><span style="font-family: Times, Times New Roman, serif; font-size: large;">When looping each object in the arry cast each object into oracle.sql.STRUCT. From the object of STRUCT a list of attributes are obtained. The values of the attribute match the values of BATCH_REC.</span> </li>
</ol>
<br />
<pre class="prettyprint linenums">
public class BatchDAO {
private static String PROC_NAME="RETRIEVE_BATCH_BY_BATCHSTATUS";
private static String PARA_BATCHSTUS="batchStatus";
private static String PARA_BATCHES="batches";
private static String PARA_ERROR_FLAG="p_error_flag";
private static String PARA_ERROR_CODE="p_error_code";
private static String PARA_ERROR_MESSAGE="p_error_message";
private SimpleJdbcCall simpleJdbcCall;
@Autowired
public void setDataSource(DataSource dataSource) {
// Set up datasource
this.simpleJdbcCall = new SimpleJdbcCall(dataSource)
.withProcedureName(PROC_NAME)
.declareParameters(
new SqlParameter(PARA_BATCHSTUS, Types.VARCHAR),
new SqlOutParameter(PARA_BATCHES, Types.ARRAY, "BATCH_TAB"),
new SqlOutParameter(PARA_ERROR_FLAG, Types.VARCHAR),
new SqlOutParameter(PARA_ERROR_CODE, Types.VARCHAR),
new SqlOutParameter(PARA_ERROR_MESSAGE, Types.VARCHAR));
}
public List<Batch> getBatch(String status) throws ScanningException {
SqlParameterSource in = new MapSqlParameterSource().addValue(PARA_BATCHSTUS, status);
Map<String, Object> out = simpleJdbcCall.execute(status);
List<Batch> batches = new ArrayList<Batch>();
String errorFlag = (String)out.get(PARA_ERROR_FLAG);
if ( errorFlag.equals("N")) {
try {
ARRAY oracleObjectArray = (ARRAY)out.get(PARA_BATCHES);
Object[] objArr = (Object[])oracleObjectArray.getArray();
logger.info("Length of retrieved batches from database = "+objArr.length);
for (int i=0; i<objArr.length; i++) {
STRUCT st = (STRUCT)objArr[i];
Object[] obj = st.getAttributes();
Batch batch = new Batch();
batch.setBatchName((String)obj[1]);
batch.setStatus((String)obj[2]);
batch.setCreationDate((Date)obj[3]);
batches.add(batch);
}
} catch (SQLException ex) {
throw new ScanningException("SQLException occurred.", ex);
}
} else {
String errorCode = (String)out.get(PARA_ERROR_CODE);
String errorMessage = (String)out.get(PARA_ERROR_MESSAGE);
throw new ScanningException("Exception occurred in "+PROC_NAME);
}
return batches;
}
}
</pre>
Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com1tag:blogger.com,1999:blog-8487142701656203604.post-86646166724417837432014-10-16T21:04:00.000-07:002014-10-16T21:05:00.003-07:00AXF Redirect error from EBS workflow<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Recently I had one test regarding viewing the managed attachment from EBS workflow. During the test there was one error shown as the below when clicking on Managed Attachment. The issue happened from OAF page to redirect to UCM url. After some investigation I found one thing which causes this issue. In AXF schema of EBS database there is table called: OAF_AXF_PROPERTIES. One property is AXF_SOAP_USER. Its value is UCM admin user name. Because the wrong user name is put here it leads to the error. After the value is corrected the issue is solved. </span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-oeMFBAJufig/VECLqNhGBpI/AAAAAAAAAxA/-bK3lJCFJzI/s1600/OAF%2BRedirect.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-oeMFBAJufig/VECLqNhGBpI/AAAAAAAAAxA/-bK3lJCFJzI/s1600/OAF%2BRedirect.png" height="121" width="320" /></a></div>
<br />Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com0tag:blogger.com,1999:blog-8487142701656203604.post-22546285955625526992014-09-10T22:30:00.001-07:002014-09-26T22:59:05.002-07:00Responsibility in EBS<div class="MsoNormal" style="background: white;">
<span style="font-family: Times, Times New Roman, serif; font-size: large;">In EBS it uses responsibilities to control user
access to menus, forms, applications, data, functions and queries in Oracle
E-Business Suite. One EBS user is
assigned certain responsibilities so he can access the application or modules
to perform the works. Meanwhile the responsibility
also restricts him from other applications which are not open to the user.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white;">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Times, Times New Roman, serif; font-size: large;">Responsibilities are created and assigned through another responsibility called “System
Administrator”.<strong><span style="background: white; color: #494949; font-weight: normal;"><o:p></o:p></span></strong></span></div>
<div class="MsoNormal" style="background: white;">
<br /></div>
<div class="MsoNormal" style="background: white;">
<span style="font-family: Times, Times New Roman, serif; font-size: large;">Responsibility is associated with
application. One application can have multiple
responsibilities. One responsibility defines
the access level for associated application.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white;">
<br /></div>
<div class="MsoNormal" style="background: white;">
<span style="font-family: Times, Times New Roman, serif; font-size: large;">Oracle comes with many pre-defined
responsibilities. Custom
responsibility can be created.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white;">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Times, Times New Roman, serif; font-size: large;">A responsibility can be assigned to many users and a user can be
assigned many responsibilities. A user
with multiple responsibilities can switch responsibilities after login into
EBS.<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="line-height: 15.0pt;">
<span style="font-family: Times, Times New Roman, serif; font-size: large;">Behind the scene all these are stored in several
database tables: <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"> <i>FND_USER, </i></span></div>
<div class="MsoNormal">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><i> FND_APPLICATION, </i></span></div>
<div class="MsoNormal">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><i> FND_RESPONSIBILITY,</i></span></div>
<div class="MsoNormal">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><i> FND_RESPONSIBILITY_TL,</i></span></div>
<div class="MsoNormal">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><i> FND_SECURITY_GROUPS,</i></span></div>
<div class="MsoNormal">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><i> FND_USER_RESP_GROUPS</i><span style="background: white; color: #444444;"> <o:p></o:p></span></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="line-height: 15.0pt;">
<span style="font-family: Times, Times New Roman, serif; font-size: large;">Here the prefix <i>FND</i> stands for foundation table,
suffix <i>TL</i> means that this table is basically the same as the table without TL
but with language support.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 15.0pt;">
<br /></div>
<br />
<div class="MsoNormal" style="background: white;">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><i>FND_USER</i> table stores details about the application
user information such as name, email, encrypted password and etc.</span><o:p></o:p></div>
<div class="MsoNormal" style="background: white;">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><br /></span></div>
<div class="MsoNormal">
<b><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">FND_USER<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">Name Null Type <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">----------------------------- ------------------------------------------------
------------- <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: yellow; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-highlight: yellow; mso-shading: white;">USER_ID</span><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"> NOT NULL
NUMBER(15) <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: yellow; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-highlight: yellow; mso-shading: white;">USER_NAME</span><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"> NOT NULL
VARCHAR2(100) <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">EMAIL_ADDRESS VARCHAR2(240)
<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">ENCRYPTED_FOUNDATION_PASSWORD NOT NULL
VARCHAR2(100) <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">ENCRYPTED_USER_PASSWORD NOT NULL VARCHAR2(100) <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-color: white; color: #444444; font-size: 10pt;">………………..</span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="background: white;">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><i>FND_APPLICATION</i> table defines the information
about all applications in EBS.</span><o:p></o:p></div>
<div class="MsoNormal" style="background: white;">
<br /></div>
<div class="MsoNormal">
<b><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">FND_APPLICATION<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">Name Null Type <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">---------------------- -------- ------------ <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: yellow; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-highlight: yellow; mso-shading: white;">APPLICATION_ID</span><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"> NOT NULL NUMBER
<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: yellow; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-highlight: yellow; mso-shading: white;">APPLICATION_SHORT_NAME</span><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"> NOT NULL
VARCHAR2(50) <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">LAST_UPDATE_DATE NOT NULL DATE <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">LAST_UPDATED_BY NOT NULL NUMBER(15) <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">CREATION_DATE NOT NULL DATE <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">CREATED_BY NOT NULL NUMBER(15) <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">LAST_UPDATE_LOGIN NUMBER(15)
<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">BASEPATH VARCHAR2(20) <o:p></o:p></span></div>
<div class="MsoNormal" style="background: white;">
</div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">PRODUCT_CODE VARCHAR2(50)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal" style="line-height: 15.0pt;">
<span style="font-family: Times, Times New Roman, serif; font-size: large;">Responsibility is stored in the following tables:<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 15.0pt;">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><i>FND_RESPONSIBILITY<o:p></o:p></i></span></div>
<div class="MsoNormal" style="line-height: 15.0pt;">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><i>FND_RESPONSIBILITY_TL</i><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 15.0pt;">
<br /></div>
<div class="MsoNormal" style="background: white;">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><i>FND_RESPONSIBILTY</i> table defines the information
about all responsibilities in EBS. It
has responsibility Key which is the short name for responsibility. It also has its
associated application and data group which is related to table <i>FND_SECURITY_GROUPS</i>.</span><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">FND_RESPONSIBILITY<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">Name Null Type <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">---------------------- -------- ------------ <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: yellow; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-highlight: yellow; mso-shading: white;">APPLICATION_ID</span><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"> NOT NULL NUMBER(15) <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: yellow; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-highlight: yellow; mso-shading: white;">RESPONSIBILITY_ID</span><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"> NOT
NULL NUMBER(15) <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: yellow; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-highlight: yellow; mso-shading: white;">RESPONSIBILITY_KEY</span><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"> NOT NULL VARCHAR2(30)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">DATA_GROUP_ID NOT NULL NUMBER(15) <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">………………<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="line-height: 15.0pt;">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><i>FND_RESPONSIBILITY_TL</i> is almost same as <i>FND_RESPONSIBILITY</i>. But it has the name of responsibility, which
can is any user understandable name in specified language.</span><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">FND_RESPONSIBILITY_TL<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">Name Null Type <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">------------------- -------- -----------------------------------------------
<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: yellow; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-highlight: yellow; mso-shading: white;">APPLICATION_ID</span><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"> NOT NULL NUMBER <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: yellow; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-highlight: yellow; mso-shading: white;">RESPONSIBILITY_ID</span><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"> NOT NULL NUMBER
<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">LANGUAGE NOT NULL VARCHAR2(4)
<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: yellow; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-highlight: yellow; mso-shading: white;">RESPONSIBILITY_NAME</span><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"> NOT NULL VARCHAR2(100) <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">DESCRIPTION VARCHAR2(240)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">…………<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><i>FND_SECURITY_GROUP</i> Stores information about security groups used
to partition data.</span><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">FND_SECURITY_GROUPS<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">Name Null Type <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">------------------ -------- ------------ <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">SECURITY_GROUP_ID NOT
NULL NUMBER(15) <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">SECURITY_GROUP_KEY NOT NULL VARCHAR2(30) <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">…………….<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">SECURITY_GROUP_ID SECURITY_GROUP_KEY CREATED_BY CREATION_DATE LAST_UPDATED_BY
LAST_UPDATE_DATE LAST_UPDATE_LOGIN<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">-----------------
------------------------------ ---------- ------------- ---------------
---------------- -----------------<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">
0 STANDARD 1 09/OCT/98 2 22/OCT/01 0<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><i>FND_USER_RESP_GROUPS</i> will define the assigned responsibilities for
the users. It is here that user –
responsibility association is defined.</span><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">FND_USER_RESP_GROUPS</span></b><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"> <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">Name Null Type
<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">----------------------------- --------
---------- <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: yellow; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-highlight: yellow; mso-shading: white;">USER_ID</span><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"> NOT NULL NUMBER(15) <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: yellow; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-highlight: yellow; mso-shading: white;">RESPONSIBILITY_ID</span><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"> NUMBER <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: yellow; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-highlight: yellow; mso-shading: white;">RESPONSIBILITY_APPLICATION_ID</span><span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"> NOT NULL NUMBER <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">SECURITY_GROUP_ID NOT NULL NUMBER(15) <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">START_DATE DATE <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">END_DATE DATE <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">DESCRIPTION VARCHAR2() <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">CREATED_BY NUMBER <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">CREATION_DATE DATE <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">LAST_UPDATED_BY NUMBER <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">LAST_UPDATE_DATE DATE <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">LAST_UPDATE_LOGIN NUMBER <o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="background: white; color: #444444; font-size: 10.0pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">
</span></div>
<div class="MsoNormal">
<span style="font-family: Times, Times New Roman, serif; font-size: large;">After understanding the schema of the above tables we can have
some PL/SQL codes which can be used to query and manipulate the responsibility in
the background.</span><o:p></o:p><br />
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><br /></span>
<br />
<div class="MsoNormal">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Times, Times New Roman, serif; font-size: large;">Find the application short name by Responsibility name</span><o:p></o:p></div>
<pre class="prettyprint linenums">SELECT FA.APPLICATION_SHORT_NAME,
FR.RESPONSIBILITY_KEY,
FRG.SECURITY_GROUP_KEY,
FRT.DESCRIPTION
FROM FND_RESPONSIBILITY FR,
FND_APPLICATION FA,
FND_SECURITY_GROUPS FRG,
FND_RESPONSIBILITY_TL FRT
WHERE FR.APPLICATION_ID = FA.APPLICATION_ID
AND FR.DATA_GROUP_ID = FRG.SECURITY_GROUP_ID
AND FR.RESPONSIBILITY_ID = FRT.RESPONSIBILITY_ID
AND FRT.LANGUAGE = 'US'
AND FRT.RESPONSIBILITY_NAME = 'Payables Manager';
</pre>
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><br /></span>
<br />
<div class="MsoNormal">
<span style="font-family: Times, Times New Roman, serif; font-size: large;">Check the user’s responsibilities</span><o:p></o:p></div>
<pre class="prettyprint linenums">SELECT fu.USER_NAME,
frt.RESPONSIBILITY_NAME
FROM FND_USER_RESP_GROUPS furg,
FND_USER fu,
FND_RESPONSIBILITY_TL frt
WHERE furg.USER_ID = fu.USER_ID
AND furg.RESPONSIBILITY_ID = frt.RESPONSIBILITY_ID
AND fu.USER_NAME = 'CHEM307'
</pre>
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><br /></span>
<br />
<div class="MsoNormal">
<span style="font-family: Times, Times New Roman, serif; font-size: large;">Check the user’s responsibilities</span><o:p></o:p></div>
<pre class="prettyprint linenums">set serveroutput on format wrapped;
DECLARE
v_user_name VARCHAR2 (100) := 'CHEM307';
v_responsibility_name VARCHAR2 (100) := 'Payables Manager';
v_application_name VARCHAR2 (50);
v_responsibility_key VARCHAR2 (30);
v_security_group VARCHAR2 (30);
v_description VARCHAR2 (240);
BEGIN
---- Get the responsibility key, application name, security group and etc. for given responsibility name
SELECT fa.APPLICATION_SHORT_NAME,
fr.RESPONSIBILITY_KEY,
frg.SECURITY_GROUP_KEY,
frt.DESCRIPTION
INTO v_application_name,
v_responsibility_key,
v_security_group,
v_description
FROM FND_RESPONSIBILITY fr,
FND_APPLICATION fa,
FND_SCURITY_GROUPS frg,
FND_RESPONSIBILITY_TL frt
WHERE fr.APPLICATION_ID = fa.APPLICATION_ID
AND fr.DATA_GROUP_ID = frg.SECURITY_GROUP_ID
AND fr.RESPONSIBILITY_ID = frt.RESPONSIBILITY_ID
AND frt.LANGUAGE = 'US'
AND frt.RESPONSIBILITY_NAME = v_responsibility_name;
---- Invoke addresp in fnd_user_pkg to assign the responsibility to the user
fnd_user_pkg.addresp (username=> v_user_name,
resp_app=> v_application_name,
resp_key=> v_responsibility_key,
security_group => v_security_group,
description=> v_description,
start_date=> SYSDATE,
end_date=> NULL);
DBMS_OUTPUT.put_line ( 'Responsiblity ' || v_responsibility_name || ' is assigned to the user ' || v_user_name);
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line( 'Error occurred while assigning responsibility to the user. The error is '|| SQLERRM );
END;
</pre>
</div>
Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com1tag:blogger.com,1999:blog-8487142701656203604.post-82210327739516399962014-06-24T06:05:00.003-07:002015-03-02T20:08:05.898-08:00Change JDK used by JDeveloper<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">You can change JDK used by JDeveloper.</span><br />
<div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">The JDK configuration for JDeveloper is defined in the <b><i>jdev.conf</i></b> which located in your Jdeveloper folder JDeveloper\jdeveloper\jdev\bin.</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Open the file and find the item: <b>SetJavaHome</b>. Change its value to your new JDK folder.</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">In the below example I switch JDK from JDK 7 to JDK 6 by commenting out JDK 7 and adding a new item for JDK 6. </span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span></div>
<pre class="prettyprint linenums">#SetJavaHome C:\Java\jdk1.7.0_06
SetJavaHome C:\Program Files\Java\jdk1.6.0_45
</pre>
<div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">After saving the changes restart JDeveloper and it will use the new JDK set in jdev,conf.</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">You can check JDK used in JDeveloper from JDeveloper. From JDeveloper goes to Help->About. Then select the tab Properties and will find java.home properties now is set to the JDK specified in jdev.conf.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-PBtzzEVwJLs/U6l2qyCY6II/AAAAAAAAAv4/MJMikCQsQmM/s1600/A1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-PBtzzEVwJLs/U6l2qyCY6II/AAAAAAAAAv4/MJMikCQsQmM/s1600/A1.png" height="213" width="320" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com26tag:blogger.com,1999:blog-8487142701656203604.post-88871640269905301782014-06-09T23:14:00.000-07:002014-06-09T23:14:20.077-07:00Set the composite name using function ora:setCompositeInstanceTitle() <div class="MsoNormal">
<span style="color: #222222; font-family: Georgia, Times New Roman, serif; font-size: large; line-height: 115%;"><i>ora:setCompositeInstanceTitle()</i> can be used to set
the name of the composite instance. It
is very useful because you can set the name of the composite instance using the
values with business meaning. It would
be convenient for the support people to search for a particular instance by the
business value.<o:p></o:p></span><br />
<span style="color: #222222; font-family: Georgia, Times New Roman, serif; font-size: large; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="color: #222222; font-family: Georgia, Times New Roman, serif; font-size: large; line-height: 115%;">It is can be done in either BPEL component or
Mediator component.<o:p></o:p></span></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<div class="MsoNormal">
<span style="color: #222222; font-family: Georgia, Times New Roman, serif; font-size: large; line-height: 115%;">Within BPEL component what needs to be done is set
one variable using <i>ora:setCompositeInstanceTitle()</i> which can be found from
Advanced Functions.</span><span style="color: #222222; font-family: "Tahoma","sans-serif"; font-size: 12.0pt; line-height: 115%; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-AU;"> <o:p></o:p></span><br />
<span style="color: #222222; font-family: "Tahoma","sans-serif"; font-size: 12.0pt; line-height: 115%; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-AU;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-lZnvjRI4y30/U5ahSLgve2I/AAAAAAAAAvQ/-nUoZTopkRM/s1600/a1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-lZnvjRI4y30/U5ahSLgve2I/AAAAAAAAAvQ/-nUoZTopkRM/s1600/a1.PNG" height="255" width="320" /></a></div>
<span style="color: #222222; font-family: "Tahoma","sans-serif"; font-size: 12.0pt; line-height: 115%; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-AU;"><br /></span>
<pre class="prettyprint linenums"><variable name="CompositeTitle" type="xsd:string"/>
<assign name="SetInstanceName">
<copy>
<from expression="ora:setCompositeInstanceTitle(concat('Test :', ora:getCompositeInstanceId()) )"/>
<to variable="CompositeTitle"/>
</copy>
</assign>
</pre>
<span style="color: #222222; font-family: "Tahoma","sans-serif"; font-size: 12.0pt; line-height: 115%; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-AU;"><br /></span>
</div>
<div class="MsoNormal">
<span style="color: #222222; font-family: "Tahoma","sans-serif"; font-size: 12.0pt; line-height: 115%; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-AU;"><br /></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: #222222; font-family: "Tahoma","sans-serif"; font-size: 12.0pt; line-height: 115%; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-AU;"><br /></span></div>
<div class="MsoNormal">
<span style="color: #222222; font-family: Georgia, Times New Roman, serif; font-size: large; line-height: 115%;">Within Mediator component it is done by setting one
property using <i>ora:setCompositeInstanceTitle()</i>. Clicking on Assign Values button in the
below diagram will start to set the value to the property.<o:p></o:p></span><br />
<span style="color: #222222; font-family: Georgia, Times New Roman, serif; font-size: large; line-height: 115%;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-8LEW6BYSxP8/U5ahbZz3mUI/AAAAAAAAAvY/kBNuTwke62c/s1600/a2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-8LEW6BYSxP8/U5ahbZz3mUI/AAAAAAAAAvY/kBNuTwke62c/s1600/a2.PNG" height="75" width="320" /></a></div>
<span style="color: #222222; font-family: Georgia, Times New Roman, serif; font-size: large; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="color: #222222; font-family: Georgia, Times New Roman, serif; font-size: large; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="color: #222222; font-family: Georgia, Times New Roman, serif; font-size: large; line-height: 115%;">In Assign Value popup window To type is selected as
property and the property value is select as: tracking.compositeInstanceId.<o:p></o:p></span><br />
<span style="color: #222222; font-family: Georgia, Times New Roman, serif; font-size: large; line-height: 115%;"><br /></span>
<span style="color: #222222; font-family: Georgia, 'Times New Roman', serif; font-size: large; line-height: 27.600000381469727px;">From type is selected as expression. In the expression Builder select <i>ora:setCompositeInstanceTitle()</i> which can be found from Mediator Expression Functions.</span><br />
<span style="color: #222222; font-family: Georgia, Times New Roman, serif; font-size: large; line-height: 115%;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-Ttbj5DXXWqY/U5ahhmCX2-I/AAAAAAAAAvg/Phyh6LoZ154/s1600/a3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-Ttbj5DXXWqY/U5ahhmCX2-I/AAAAAAAAAvg/Phyh6LoZ154/s1600/a3.png" height="255" width="320" /></a></div>
<span style="color: #222222; font-family: Georgia, Times New Roman, serif; font-size: large; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="color: #222222; font-family: Georgia, 'Times New Roman', serif; font-size: large; line-height: 115%;"><br /></span>
<span style="color: #222222; font-family: Georgia, 'Times New Roman', serif; font-size: large; line-height: 115%;">Now the property is assigned which will set the
composite title in Mediator.</span></div>
<div class="MsoNormal">
<span style="color: #222222; line-height: 115%;"><span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-dngLan7-uHk/U5ahr3OvrsI/AAAAAAAAAvs/csx7MCZ9X6Y/s1600/a4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-dngLan7-uHk/U5ahr3OvrsI/AAAAAAAAAvs/csx7MCZ9X6Y/s1600/a4.png" height="192" width="320" /></a></div>
<span style="color: #222222; line-height: 115%;"><span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span></span></div>
Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com0tag:blogger.com,1999:blog-8487142701656203604.post-71481150700161610252014-05-25T19:41:00.000-07:002014-05-25T19:41:53.702-07:00Sending email with attachments in Oracle SOA 11g<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Here I show one generic BPLE service which will send the email with attachment. </span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<br />
<h2>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Generic Email Service Interface</span></h2>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span><span style="font-family: Georgia, Times New Roman, serif; font-size: large;">The service interface is defined by the below xsd file. In the request message apart from email to, from, subject and body elements there is one array of attachment elements which are sent with the email.</span><br />
<br />
<pre class="prettyprint linenums"><element name="NotificationRequest">
<complexType>
<sequence>
<element name="From" type="string" minOccurs="0"/>
<element name="To" type="string"/>
<element name="CC" type="string" minOccurs="0"/>
<element name="Subject" type="string"/>
<element name="Body" type="string" minOccurs="0"/>
<element name="Attachment" type="tns:AttachmentType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
<complexType name="AttachmentType">
<sequence>
<element name="MimeType" type="string"/>
<element name="AttachmentContent" type="anyType"/>
<element name="AttachmentName" type="string"/>
<element name="ContentEncoding" type="string"/>
</sequence>
</complexType> </pre>
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;"><br /></span>
<br />
<h2>
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">Oracle Notification Service</span></h2>
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">This service will use Notification service provided by Oracle SOA 11g. </span><span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Notification service uses Oracle User Messaging Service to send email, SMS, IM and etc. notification to the recipients. Notification service can be invoked from BPEL process. From JDeveloper you can choose the different notification channels. For sending email you need to choose Email as below.</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-sxHY37MNmts/U32ZjFbaB8I/AAAAAAAAAvA/vOZafoWTwxs/s1600/a1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-sxHY37MNmts/U32ZjFbaB8I/AAAAAAAAAvA/vOZafoWTwxs/s1600/a1.PNG" height="320" width="269" /></a></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">After dragging and dropping Email into BPEL process, NotificationService.wsdl and NotificationService.xsd are added to the project. These wsdl and xsd files define the interface to Oracle User Messaging Service. For request message which sends email is defined as EmailPayloadType. The key to send the email with attachments is to populate the appropriate values in EmailPayload</span>. <br />
<br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">EmailPayloadType defines the request message for invoking Oracle Notification service to send the email. </span><br />
<pre class="prettyprint linenums"><xsd:complexType name="ContentType">
<xsd:sequence>
<xsd:element name="MimeType" type="xsd:string" default="text/plain" minOccurs="0"/>
<xsd:element name="ContentBody" type="xsd:anyType" nillable="true"/>
<xsd:element name="ContentEncoding" type="xsd:string" nillable="true"/>
</xsd:sequence>
</xsd:complexType>
</pre>
<br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">ContentType defines the email content. Note here that ContentBody is defined as anyType. In order to include the attachments in email there are two things needed to be done:</span><br />
<br />
<ul>
<li><span class="Apple-tab-span" style="font-family: Georgia, 'Times New Roman', serif; font-size: large; white-space: pre;"> </span><span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">MimeType should be set as: multipart/mixed. </span></li>
<li><span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Georgia, Times New Roman, serif; font-size: large;"> </span></span><span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">ContentBody will use MultiPartType.</span><span class="Apple-tab-span" style="font-family: Georgia, 'Times New Roman', serif; font-size: large; white-space: pre;"> </span></li>
</ul>
<div>
<br /></div>
<br />
<pre class="prettyprint linenums"><xsd:complexType name="MultiPartType">
<xsd:sequence>
<xsd:element name="BodyPart" type="BodyPartType" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</pre>
<br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">The MultiPartType is an array of BodyPartType. First element in thus array is the email body itself and the subsequent elements are the attachments for the email.</span>
<br />
<pre class="prettyprint linenums"><xsd:complexType name="BodyPartType">
<xsd:sequence>
<xsd:element name="MimeType" type="xsd:string" default="text/plain" minOccurs="0"/>
<xsd:element name="ContentBody" type="xsd:anyType" nillable="true"/>
<xsd:element name="BodyPartName" type="xsd:string"/>
<xsd:element name="Disposition" type="dispositionEnum" default="inline" minOccurs="0"/>
<xsd:element name="ContentId" type="xsd:string" minOccurs="0"/>
<xsd:element name="ContentEncoding" type="contentEncodingEnum" nillable="true"/>
<xsd:element name="AttachmentContentEnclosed" type="xsd:boolean" default="true" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</pre>
<br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">BodyPartType defines the email body and attachment for the email. MimeType specifies the type of data in email. If the email body is HTML email the MimeType of email body(first Body Part) would be: "text/html; charset=UTF-8". Depending on the attachments with the email the MimeType in BodyParts for attachments can be set the values of proper Mime type. </span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Some of such values are shown below:</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: large;"><span class="Apple-tab-span" style="white-space: pre;"> </span>image/tiff; - tiff image file</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: large;"><span class="Apple-tab-span" style="white-space: pre;"> </span>image/jpeg; - jpeg image file </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: large;"><span class="Apple-tab-span" style="white-space: pre;"> </span>application/pdf; - PDF file</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: large;"><span class="Apple-tab-span" style="white-space: pre;"> </span>application/xml; - XML file </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: large;"><span class="Apple-tab-span" style="white-space: pre;"> </span>application/msword; - MS Word file</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Georgia, Times New Roman, serif; font-size: large;"> </span></span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">ContentBody in BodyPartType will be the actual data for email body and attachment. For the attachment the ContentEncoding will be set as base64.<span class="Apple-tab-span" style="white-space: pre;"> </span>BodyPartName will be set as the file name for the attachment.</span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">The below is one example of EmailPayload message which are populated with the data. The email will have one attachment of .tiff image file whose name is Testing.tif.</span>
<br />
<pre class="prettyprint linenums"><EmailPayload xsi:type="def:EmailPayloadType">
<FromAccountName>Default</FromAccountName>
<To>Mark_ke_chen@yahoo.com</To>
<ReplyToAddress/>
<Subject>Tesyimg email with one attachement</Subject>
<Content>
<ns:MimeType>multipart/mixed</ns:MimeType>
<ns:ContentBody>
<ns:MultiPart>
<ns:BodyPart>
<ns:MimeType>text/html; charset=UTF-8</ns:MimeType>
<ns:ContentBody>
...... Email body here
</ns:ContentBody>
<ns:BodyPartName/>
<Disposition>inline</Disposition>
</ns:BodyPart>
<ns:BodyPart>
<ns:MimeType>image/tiff;</ns:MimeType>
<ns:ContentBody>
.... Tiff image data
</ns:ContentBody>
<ns:BodyPartName>Testing.tif</ns:BodyPartName>
<ns:ContentEncoding>base64</ns:ContentEncoding>
<Disposition>attachment</Disposition>
</ns:BodyPart>
</ns:MultiPart>
</ns:ContentBody>
</Content>
<Cc/>
<Bcc/>
<NotificationContext/>
</EmailPayload>
</pre>
<br />
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">Here use xlst transformation to populate the Content element.</span>
<br />
<pre class="prettyprint linenums"><copy>
<from expression="ora:processXSLT('xsl/EmailContentBodyTransform.xsl', $NotificationRequest.payload)"/>
<to variable="varNotificationReq"
part="EmailPayload"
query="/EmailPayload/ns1:Content"/>
</copy>
</pre>
<br />
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">The below is the snippet of XSLT transformation.</span>
<br />
<pre class="prettyprint linenums"><ns:Content>
<ns:MimeType>multipart/mixed</ns:MimeType>
<ns:ContentBody>
<ns:MultiPart>
<ns:BodyPart>
<ns:MimeType >text/html; charset=UTF-8</ns:MimeType>
<ns:ContentBody>
<xsl:value-of select="/*[local-name()='NotificationRequest']/*[local-name()='Body']"/>
</ns:ContentBody>
<ns:BodyPartName/>
</ns:BodyPart>
<xsl:for-each select="/*[local-name()='NotificationRequest']/*[local-name()='Attachment']">
<ns:BodyPart >
<ns:MimeType>
<xsl:value-of select="./*[local-name()='MimeType']"/>
</ns:MimeType>
<ns:ContentBody >
<xsl:value-of select="./*[local-name()='AttachmentContent']"/>
</ns:ContentBody>
<ns:BodyPartName>
<xsl:value-of select="./*[local-name()='AttachmentName']"/>
</ns:BodyPartName>
<ns:ContentEncoding>
<xsl:value-of select="./*[local-name()='ContentEncoding']"/>
</ns:ContentEncoding>
</ns:BodyPart>
</xsl:for-each>
</ns:MultiPart>
</ns:ContentBody>
</ns:Content>
</pre>
<br />
<br />
<h2>
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">Testing Email service with attachments</span></h2>
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">In order to test this generic email service I have another BPEL service which will populate email body and attachment and then invoke the generic email service. The below shows the two assign activities used in the BPEL to set the email body and email attachment.</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;"><br /></span>
<pre class="prettyprint linenums"><assign name="AssignEmailBody">
<copy>
<from expression="ora:toCDATA( ora:processXSLT('xsl/TransformHTMLEmailBody.xsl', $Request.request, bpws:getVariableData('Parameters')) )"/>
<to variable="EmailNotificationRequest" part="payload"
query="/ns4:NotificationRequest/ns4:Body"/>
</copy>
</assign>
<assign name="AssignEmailAttachment">
<copy>
<from expression="ora:readFile( $ImageFileName) )"/>
<to variable="EmailNotificationRequest" part="payload"
query="/ns4:NotificationRequest/ns4:Attachment/ns4:AttachmentContent"/>
</copy>
</assign>
</pre>
<br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">One assign is used to set the email body. Since the email is HTML format the assign activity uses <b>ora:toCDATA</b> to wrap the html content. </span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Another assign activity uses <b>orad:readFile</b> function to read the physical file which is going to attach in the email.</span>Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com6tag:blogger.com,1999:blog-8487142701656203604.post-51282435120163073752014-05-20T18:06:00.001-07:002014-05-20T18:06:59.361-07:00Setting and Getting Configuration Property and Preference Variable in Oracle SOA Suite 11g <span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Configuration property and preference variable can be set in composite.xml. The advantage of using these is that the values can be set in the design time, deployment time and run time.</span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<h4>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Define the Properties and Preference Variables</span></h4>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">The configuration property and preference variable is defined in composite.xml</span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">In the component of the example composite one configuration property: ConfigVar is defined. Its value is set Value123 initially. One preference varaible PrefVar is also defined and its value is set to Value789 initially.</span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-UsBU3ZGSvwc/U3vudY8e6pI/AAAAAAAAAs0/m4tLidRGgtI/s1600/d15.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-UsBU3ZGSvwc/U3vudY8e6pI/AAAAAAAAAs0/m4tLidRGgtI/s1600/d15.PNG" height="56" width="320" /></a></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">In the reference of the example composite one configuration property: OUT_FILE_PATH is defined. This property is set when configuring the logical file path for File adpter. This property value is also defined in .jca file.</span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-LCtisCXT2P4/U3vuvf7C40I/AAAAAAAAAs8/wSad8-dvveg/s1600/d14.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-LCtisCXT2P4/U3vuvf7C40I/AAAAAAAAAs8/wSad8-dvveg/s1600/d14.PNG" height="79" width="320" /></a></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<h4>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Retrive the Values of the Properties and Preference Variables</span></h4>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">The component is the example composite is BPEL process where the configuration properties and preference variables can be retrived from winthin BPEL. The retrival can be done by using BPEL XPath Extension Functions: ora:getPreference() and ora: </span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-OGeTVSsnolE/U3vvBCGQceI/AAAAAAAAAtE/YnNlmxLTcrA/s1600/d6.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-OGeTVSsnolE/U3vvBCGQceI/AAAAAAAAAtE/YnNlmxLTcrA/s1600/d6.PNG" height="38" width="320" /></a></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<h4>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">View and Midify the Values in Enterprise Manager</span></h4>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">These values of the configuration properties and preference variables can be viewed and modified in run time with Enterprise Manager. </span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-KGq9YoKCIcw/U3vvR81i81I/AAAAAAAAAtM/YsQyKDeTnkw/s1600/c3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-KGq9YoKCIcw/U3vvR81i81I/AAAAAAAAAtM/YsQyKDeTnkw/s1600/c3.png" height="320" width="238" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-YZqxxyrk5nw/U3vvbPAuvsI/AAAAAAAAAtU/Zq_Zq06nAj8/s1600/c4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-YZqxxyrk5nw/U3vvbPAuvsI/AAAAAAAAAtU/Zq_Zq06nAj8/s1600/c4.png" height="260" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">After login into EM navigate into the domain and right click on the domain to invoke System MBean Browser. From System MBean Browser navigate to Application Defined MBeans/oracle.soa.config/Server: SOA_server1/SCAComposite. Expand it and expand SCAComposite: ConfigPreferenceProject[1.0]. </span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><a href="http://3.bp.blogspot.com/-8GPLoB_lDrU/U3vxFh0-8vI/AAAAAAAAAtc/ZYxQ96DqLwk/s1600/d16.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-8GPLoB_lDrU/U3vxFh0-8vI/AAAAAAAAAtc/ZYxQ96DqLwk/s1600/d16.PNG" height="320" width="104" /></a></span></div>
<br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">To view or modify the values defined for BPEL: select SCAComposite.SCAComponent and then click on BPELProcess1. Then click on properties in Attribute tab. All the configuration properties and preference variables defined in the BPEL are shown now. </span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-aC-F7SNvDY4/U3vyyUkh5UI/AAAAAAAAAto/SdltDBORY10/s1600/d17.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-aC-F7SNvDY4/U3vyyUkh5UI/AAAAAAAAAto/SdltDBORY10/s1600/d17.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-rKm8J_0N6QE/U3vz5r5LS1I/AAAAAAAAAuA/7L5FXyWYdZs/s1600/d3.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-rKm8J_0N6QE/U3vz5r5LS1I/AAAAAAAAAuA/7L5FXyWYdZs/s1600/d3.PNG" height="87" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-mO_fKa1ZIQw/U3v0CuYpI_I/AAAAAAAAAuI/iwaUEWnch6I/s1600/d4.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-mO_fKa1ZIQw/U3v0CuYpI_I/AAAAAAAAAuI/iwaUEWnch6I/s1600/d4.PNG" height="89" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">In order to change the value of one variable or property just type in the new value and then click on Apply button.</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-GECctUymz7E/U3vzqDf5rNI/AAAAAAAAAt4/JWVcGxJASXk/s1600/d10.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-GECctUymz7E/U3vzqDf5rNI/AAAAAAAAAt4/JWVcGxJASXk/s1600/d10.PNG" height="54" width="320" /></a></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">To view or modify the property values defined for reference: select SCAComposite.SCARefernce. All other steps are the same as the above.</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-zWlj6AK0fbQ/U3vy8O3nG0I/AAAAAAAAAtw/GpE1E1oCJsk/s1600/d13.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-zWlj6AK0fbQ/U3vy8O3nG0I/AAAAAAAAAtw/GpE1E1oCJsk/s1600/d13.PNG" /></a></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-c7-YxZnKp8s/U3v0aDaiVBI/AAAAAAAAAuQ/vq59CapqorA/s1600/d12.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-c7-YxZnKp8s/U3v0aDaiVBI/AAAAAAAAAuQ/vq59CapqorA/s1600/d12.PNG" height="126" width="320" /></a></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Similarily if there is any configuration property defined in SCAComposite.SCAService select SCAComposite,SCAService in order to view or modify the property values. </span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-_eZA9EEwCdY/U3v0qosh9hI/AAAAAAAAAuY/yFNxYW8RwYo/s1600/d7.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-_eZA9EEwCdY/U3v0qosh9hI/AAAAAAAAAuY/yFNxYW8RwYo/s1600/d7.PNG" height="80" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<h4>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Test the Composite with the Modified Values </span></h4>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">When testing the SCA composite using EM testing utility, the response will show the values of configuration and preference variable in BPEL process as :Value123 Value789".(This BPEL process simply concatenate these two values as the response for the process.) </span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-KOlTQaQcvu0/U3v3YzAW_jI/AAAAAAAAAug/X4MswDFSSDc/s1600/d7.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-KOlTQaQcvu0/U3v3YzAW_jI/AAAAAAAAAug/X4MswDFSSDc/s1600/d7.PNG" height="80" width="320" /></a></div>
<br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Next modify the value of configuration property to 123Value and preference value to 789Value and apply these changes. Then run the testing again. This time the response will show as the new values:</span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-OZSYZy8-TdM/U3v4GyAqn-I/AAAAAAAAAuo/_jEqFKhoEKw/s1600/d11.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-OZSYZy8-TdM/U3v4GyAqn-I/AAAAAAAAAuo/_jEqFKhoEKw/s1600/d11.PNG" height="83" width="320" /></a></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<h4>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Deploy the Composite with Environment Specific Values</span></h4>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">With configuration properties and preference variables in the component, service and references in SCA composite different </span><span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">deployment </span><span style="font-family: Georgia, Times New Roman, serif; font-size: large;">plans can be generated for various environments. In each deployment plan the values for these properties and variables are environment specific.</span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-WYyIJNEGXYk/U3v6y3ZZaxI/AAAAAAAAAuw/auO5FvB1tUE/s1600/d18.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-WYyIJNEGXYk/U3v6y3ZZaxI/AAAAAAAAAuw/auO5FvB1tUE/s1600/d18.PNG" height="167" width="320" /></a></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com0tag:blogger.com,1999:blog-8487142701656203604.post-20640804641226362452014-05-12T19:51:00.000-07:002014-05-16T19:35:58.569-07:00Develop and Deploy Jersey RESTful service using JDeveloper in Weblogic<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Jersey is one of reference implementations of JAX-WS specification which is to describe how REST should be implemented using annotation-driven POJO in Java. Jersey is the one that is most widely used in development and production. WebLogic Server ships with a set of pre-built shared libraries, packaged as Web applications. Jesery is one of these and it is required to run applications that are based on the Jersey JAX-RS RI. The version of Jsersey in weblogic 10.3 is 1.9 which implements JAX-RS 1.1.</span><br />
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">This jersey war file is located in: <i> $Middleware/wlserver_10.3/common/deployable-libraries/jersey-bundle-1.9.war</i>.</span><br />
<span style="font-family: Georgia, Times New Roman, serif;"><span style="font-size: large;"><br /></span>
</span><br />
<h3>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Register Jersey as the shared library in Weblogic server </span></h3>
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Before the REST application can be deployed and run on Weblogic the Jersey JAX-RS RI shared libraries needs to be registered in Weblogic Servcre instance. It can be done via Weblogic Console. </span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Login into Weblogic Console Click on Deployments in Domain Structure</span><br />
<span style="font-family: Georgia, Times New Roman, serif;"><span style="font-size: large;">Click on Lock & Edit button to enable Install button and then c</span><span style="font-size: large;">lick on Install button</span></span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-AfMiRdR2Y4w/U2zakpLNYDI/AAAAAAAAAog/gV6VWsNtuLE/s1600/b1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-AfMiRdR2Y4w/U2zakpLNYDI/AAAAAAAAAog/gV6VWsNtuLE/s1600/b1.png" height="102" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large; line-height: 115%;">The
path should be: <i>/u01/app/fmwsodev/Middleware/wlserver_10.3/common/deployable-libraries</i></span></div>
<div class="MsoNormal">
<span style="font-family: Georgia, Times New Roman, serif;"><span style="font-size: large;">Select <i>jersey-bundle-1.9.war </i>and c</span><span style="font-size: large;">lick on Next button</span></span></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-Y0aFT8GhJj4/U2zbXNnRDhI/AAAAAAAAAos/-0HmLju7uP4/s1600/b2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-Y0aFT8GhJj4/U2zbXNnRDhI/AAAAAAAAAos/-0HmLju7uP4/s1600/b2.png" height="107" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Georgia, Times New Roman, serif;"><span style="font-size: large;">Select Install this deployment as a library and c</span><span style="font-size: large;">lick on Next button</span></span></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-kMdALIbLkXg/U2zb3ecQ9yI/AAAAAAAAAo0/ADK1I-VLGZY/s1600/b3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-kMdALIbLkXg/U2zb3ecQ9yI/AAAAAAAAAo0/ADK1I-VLGZY/s1600/b3.png" height="118" width="320" /></a></div>
<div class="MsoNormal">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Select target and click on Next button</span><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-vHcocNBnBPw/U2zdF7Jt76I/AAAAAAAAApA/3Km_iI2SLdg/s1600/b4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-vHcocNBnBPw/U2zdF7Jt76I/AAAAAAAAApA/3Km_iI2SLdg/s1600/b4.png" height="181" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-AU; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Select target and click on Next button</span></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-dVApZmI1YNI/U2zd2ecMy6I/AAAAAAAAApI/I_Fh7IQ-n8s/s1600/b5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-dVApZmI1YNI/U2zd2ecMy6I/AAAAAAAAApI/I_Fh7IQ-n8s/s1600/b5.png" height="210" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Confirm the library name, version and implementation version as below and click on Finish button</span><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-fo7s71UvVJM/U2zeZTokZ4I/AAAAAAAAApQ/sX10JIpoXeQ/s1600/b6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-fo7s71UvVJM/U2zeZTokZ4I/AAAAAAAAApQ/sX10JIpoXeQ/s1600/b6.png" height="167" width="320" /></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span class="MsoHyperlink"><span style="color: windowtext; font-size: 12pt; line-height: 115%;"><br /></span></span></div>
<div class="MsoNormal">
<span style="font-family: Georgia, Times New Roman, serif;"><span class="MsoHyperlink"></span><span style="font-size: large;">Now Jersey JAX-RS RI is registered as shared library in Weblogic server. Any application deployed on the server can use this library for implementation of REST service using Jersey.</span></span><br />
<span style="font-family: Georgia, Times New Roman, serif;"><span style="font-size: large;"><br /></span>
<span style="font-size: large;"><br /></span>
</span><br />
<h3>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Develop Jersey REST service using JDeveloper</span></h3>
<div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span></div>
</div>
<div class="MsoNormal">
<span class="MsoHyperlink"><span style="color: windowtext; font-family: Georgia, Times New Roman, serif; font-size: large; line-height: 115%;">Create
a generic project in JDeveloper</span></span><span style="font-size: 12.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span class="MsoHyperlink"><span style="color: windowtext; font-size: 12pt; line-height: 115%;"><br /></span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-a6_yixCZSp8/U2zfXX4OcsI/AAAAAAAAApc/k4-4zZrHGG0/s1600/b7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-a6_yixCZSp8/U2zfXX4OcsI/AAAAAAAAApc/k4-4zZrHGG0/s1600/b7.png" height="239" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="MsoNormal">
<span style="line-height: 115%;"><span style="font-family: Times, Times New Roman, serif; font-size: large;"><br /></span></span>
<span style="font-family: Georgia, Times New Roman, serif;"><span style="line-height: 115%;"><span style="font-size: large;"><br /></span></span>
<span style="line-height: 115%;"><span style="font-size: large; line-height: normal;">In order to develop Java codes which use Jersey to implement RESTful service, two jar files are needed to add into User Managed Libraries in JDeveloper.</span></span></span><br />
<span style="font-family: Georgia, Times New Roman, serif;"><span style="line-height: 115%;"><span style="font-size: large; line-height: normal;"><br /></span></span>
<span style="line-height: 115%;"><span style="font-size: large; line-height: normal;">First jar is jersey-bundle-1.9.jar which can be downloaded from:</span></span></span><br />
<a href="http://repo1.maven.org/maven2/com/sun/jersey/jersey-bundle/1.9/jersey-bundle-1.9.jar" target="_blank"><span style="font-family: Georgia, Times New Roman, serif;">http://repo1.maven.org/maven2/com/sun/jersey/jersey-bundle/1.9/jersey-bundle-1.9.jar</span></a><br />
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-O0VjUKPxdZg/U2zgZSMdT_I/AAAAAAAAApo/_X7fSNhV6Zo/s1600/b8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-O0VjUKPxdZg/U2zgZSMdT_I/AAAAAAAAApo/_X7fSNhV6Zo/s1600/b8.png" height="228" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: start;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Since jersey-bundle-1.9.jar doesn't include JAX-RS API classes. So JAX-RS API jar is also needed. The jar file can be found from Weblogic server installation folder: <i>$Middleware/modules/javax.ws.rs_1.0.0.0_1-1-1.jar</i></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-size: 16px; line-height: 18.399999618530273px; text-align: start;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-4jE-cG9hmSk/U2zhIVr704I/AAAAAAAAApw/KvFl3RR9rOs/s1600/b9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-4jE-cG9hmSk/U2zhIVr704I/AAAAAAAAApw/KvFl3RR9rOs/s1600/b9.png" height="228" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">After two jar files are added into the libraries use these two libaries in the project: RESTProject by using Add Library in Libraries and Classpath from Project Properties... menu item.</span></div>
<div class="MsoNormal">
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-cCclhbmrq64/U2zh8OXO7wI/AAAAAAAAAp4/7npXsttM7Xk/s1600/b10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-cCclhbmrq64/U2zh8OXO7wI/AAAAAAAAAp4/7npXsttM7Xk/s1600/b10.png" height="228" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Now create a POJO which will implement the service:</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-VaBvXXnQ13s/U3AUYgoYSpI/AAAAAAAAAqU/AA9z9H_wH98/s1600/b12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-VaBvXXnQ13s/U3AUYgoYSpI/AAAAAAAAAqU/AA9z9H_wH98/s1600/b12.png" height="320" width="262" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">The source codes of Java class: RESTService are as below:</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
</div>
<pre class="prettyprint linenums">package com.toic.rest;
import com.toic.model.Folder;
import java.util.logging.Logger;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/folders")
public class RESTService {
private Logger logger = Logger.getLogger(RESTService.class.getName());
public RESTService() {
super();
}
@GET
@Path("/guid/{folderguid}")
@Produces(MediaType.APPLICATION_JSON)
public Response getFoldersByGUID(@PathParam("folderguid") String folderguid) {
Folder folder = Folder.makeFolders();
return Response.status(Response.Status.OK).entity(folder).build();
}
}
</pre>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">The below is one domain class Folder which is used in RESTService class.</span><br />
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><br /></span>
<br />
<pre class="prettyprint linenums">package com.toic.model;
import java.util.ArrayList;
import java.util.List;
public class Folder {
private String folderName;
private String owner;
private String folderGUID;
private String folderType;
private List<folder> childFolders = new ArrayList<folder>();
public Folder() {
super();
}
public String getFolderName() {
return folderName;
}
public void setFolderName(String folderName) {
this.folderName = folderName;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public String getFolderGUID() {
return folderGUID;
}
public void setFolderGUID(String folderGUID) {
this.folderGUID = folderGUID;
}
public String getFolderType() {
return folderType;
}
public void setFolderType(String folderType) {
this.folderType = folderType;
}
public List<folder> getChildFolders() {
return childFolders;
}
public void addChildFolder(Folder childFolder) {
this.childFolders.add(childFolder);
}
public static Folder makeFolders() {
Folder rootFolder = new Folder();
rootFolder.setFolderName("Root Folder");
rootFolder.setOwner("Mark");
rootFolder.setFolderGUID("123456");
rootFolder.setFolderType("NATIVE");
Folder childFolder1 = new Folder();
childFolder1.setFolderName("Folder1");
childFolder1.setOwner("Mark");
childFolder1.setFolderGUID("100234");
childFolder1.setFolderType("NATIVE");
Folder childFolder2 = new Folder();
childFolder2.setFolderName("Folder2");
childFolder2.setOwner("Mark");
childFolder2.setFolderGUID("200234");
childFolder2.setFolderType("NATIVE");
rootFolder.addChildFolder(childFolder1);
rootFolder.addChildFolder(childFolder2);
return rootFolder;
}
}
</folder></folder></folder></pre>
<br />
<br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">In RESTService.java editor click on Quick Fix to configure web.xml for this service.</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: large;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-7ERAsJ8faQc/U3AZIwYfDUI/AAAAAAAAAqk/ve4GYx-DLTg/s1600/b13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-7ERAsJ8faQc/U3AZIwYfDUI/AAAAAAAAAqk/ve4GYx-DLTg/s1600/b13.png" height="174" width="320" /></a></div>
<br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">web.xml is created under WEB-INF.</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-sPVwsUprDa8/U3Aaeh-s2rI/AAAAAAAAAqs/bZtLOPlIDaU/s1600/b14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-sPVwsUprDa8/U3Aaeh-s2rI/AAAAAAAAAqs/bZtLOPlIDaU/s1600/b14.png" height="124" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Update url-pattern to *</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-ZTKQ1QoMgww/U3AazFZsr-I/AAAAAAAAAq0/oWaqx93GrDs/s1600/b15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-ZTKQ1QoMgww/U3AazFZsr-I/AAAAAAAAAq0/oWaqx93GrDs/s1600/b15.png" height="71" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Then create Weblogic Deployment Descriptor</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-V8sQEr8Pgfs/U3Abi64-POI/AAAAAAAAArA/k0JIsv76kR0/s1600/b16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-V8sQEr8Pgfs/U3Abi64-POI/AAAAAAAAArA/k0JIsv76kR0/s1600/b16.png" height="228" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">weblogic.xml file is created under WEB-INF as shown as below:</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-50Gsk-GmQdg/U3Aq462q-kI/AAAAAAAAArQ/Tigmit051oA/s1600/b17.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-50Gsk-GmQdg/U3Aq462q-kI/AAAAAAAAArQ/Tigmit051oA/s1600/b17.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">In run time the deployed service will use the shared library of Weblogic. Here in weblogic.xml the library reference should be created as below:</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-2T46jd0xEZg/U3Arh9pfhII/AAAAAAAAArY/kqVuK9D2SYA/s1600/b18.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-2T46jd0xEZg/U3Arh9pfhII/AAAAAAAAArY/kqVuK9D2SYA/s1600/b18.png" height="52" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Next step is to update the deployment profile of the service which is deployed as web application,</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-xr9U17-7vcc/U3Ar-fxSrbI/AAAAAAAAArg/GpHdNH4kTEc/s1600/b19.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-xr9U17-7vcc/U3Ar-fxSrbI/AAAAAAAAArg/GpHdNH4kTEc/s1600/b19.png" height="228" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">The service is called RESTService.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-71AZn5xBdAc/U3AsVkVd4sI/AAAAAAAAAro/MfEo7WAM1Mg/s1600/b20.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-71AZn5xBdAc/U3AsVkVd4sI/AAAAAAAAAro/MfEo7WAM1Mg/s1600/b20.png" height="183" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Update the context root as: Demo.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-2oxtxKWjiXQ/U3AvqiGLZLI/AAAAAAAAAr0/yCA1D1GHqkU/s1600/b21.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-2oxtxKWjiXQ/U3AvqiGLZLI/AAAAAAAAAr0/yCA1D1GHqkU/s1600/b21.png" height="228" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><br /></span></div>
<h3>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Deploy Jersey REST service and test the service</span></h3>
<div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">After all is done the service is ready to deploy to Weblogic server from JDeveloper.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Times, Times New Roman, serif; font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-POuCCCXfTs4/U3BY24kZakI/AAAAAAAAAsE/GX_xxeX0vQo/s1600/b22.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-POuCCCXfTs4/U3BY24kZakI/AAAAAAAAAsE/GX_xxeX0vQo/s1600/b22.PNG" height="206" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-kA4gSKlP_IU/U3BY_xxG8jI/AAAAAAAAAsM/ITa6LEe1Y9g/s1600/b23.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-kA4gSKlP_IU/U3BY_xxG8jI/AAAAAAAAAsM/ITa6LEe1Y9g/s1600/b23.png" height="240" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">If the deployment is successful RESTService will appear in the deployments of Weblogic Console.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-3Ea7Ozk0PeU/U3BZHfuj_AI/AAAAAAAAAsU/LKxyLdCQqJ0/s1600/b24.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-3Ea7Ozk0PeU/U3BZHfuj_AI/AAAAAAAAAsU/LKxyLdCQqJ0/s1600/b24.PNG" height="30" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Click on RESTService and click on Testing tab</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-tmsA9LRMmPo/U3BZQtP6qDI/AAAAAAAAAsc/HxjOJAvGX6A/s1600/b25.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-tmsA9LRMmPo/U3BZQtP6qDI/AAAAAAAAAsc/HxjOJAvGX6A/s1600/b25.PNG" height="85" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Click on the Test Point URL to start browser and type in the url as: <a href="http://weblogicserverhost:8001/Demo/folders/guid/123456" target="_blank">http://weblogicserverhost:8001/Demo/folders/guid/123456</a> and the service will respond as below:</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-hZYEKBWuWIg/U3BZZay0ffI/AAAAAAAAAsk/zHHfXv0hM-s/s1600/b26.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-hZYEKBWuWIg/U3BZZay0ffI/AAAAAAAAAsk/zHHfXv0hM-s/s1600/b26.PNG" height="58" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com3tag:blogger.com,1999:blog-8487142701656203604.post-48961082940241147692014-04-20T06:53:00.000-07:002014-05-07T05:51:18.582-07:00Using Oracle AQ with Oracle SOA 11g & OSB 11g<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Georgia, serif; font-size: 18pt;">Oracle Advanced Queuing(AQ) is Oracle Database
message queuing mechanism which acts as the queuing infrastructure. With
AQ the different applications can communicate and exchange the message via
Oracle database queues. Oracle AQ provides the API to enqueue and dequeue
the messages to and from the queues in Oracle database.</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Georgia, serif; font-size: 18pt;"><br />
Oracel AQ is the integral part of Oracle database already. In this
tutorial Oracle XE 10g is used. Oracle AQ is available from
two built-in PL/SQL packages in Oracle database:</span><span style="font-family: Georgia, serif; font-size: 18pt;"> </span><b><span style="font-family: Georgia, serif; font-size: 18pt;">DBMS_AQADM</span></b><span style="font-family: Georgia, serif; font-size: 18pt;"> </span><span style="font-family: Georgia, serif; font-size: 18pt;">and</span><span style="font-family: Georgia, serif; font-size: 18pt;"> </span><b><span style="font-family: Georgia, serif; font-size: 18pt;">DBMS_AQ</span></b><span style="font-family: Georgia, serif; font-size: 18pt;">.</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Georgia, serif; font-size: 18pt;"><br />
<b>DBMS_AQADM</b></span><span style="font-family: Georgia, serif; font-size: 18pt;"> </span><span style="font-family: Georgia, serif; font-size: 18pt;">package provides PL/SQL procedures to manage the AQ
configuration and administration. Some basic functionality in</span><span style="font-family: Georgia, serif; font-size: 18pt;"> </span><b><span style="font-family: Georgia, serif; font-size: 18pt;">DBMS_AQADM</span></b><span style="font-family: Georgia, serif; font-size: 18pt;"> </span><span style="font-family: Georgia, serif; font-size: 18pt;">are
like: Create the queue table, create the queue, start the queue, stop queue.</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Georgia, serif; font-size: 18pt;"><br />
<b>DBMS_AQ</b></span><span style="font-family: Georgia, serif; font-size: 18pt;"> </span><span style="font-family: Georgia, serif; font-size: 18pt;">package provides the interface to other
applications to AQ. DEQUEUE and ENQUEUE are two procedures for enqeuing
and deqeuing the AQ queue.</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Georgia, serif; font-size: 18pt;"><br />
After one AQ queue is created and started the application such as
PL/SQL procedures can enqueue the message into the queue and
other application such as one SOA component can dequeue the message from
this queue.</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Georgia, serif; font-size: 18pt;"><br />
The below are the steps showing how one AQ queue is created from the scratch
and how a message is enqueued in the queue and etc. After these the steps
of creating one SOA component to dequeue the message from AQ queue.</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br /></div>
<div class="MsoNormal">
<b><span style="font-family: Georgia, serif; font-size: 18pt;">Setup
AQ queue in Oracle XE 10g</span></b><b><span style="font-family: 'Times New Roman', serif; font-size: 18pt;"><o:p></o:p></span></b></div>
<br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Georgia, serif; font-size: 18pt;">There are several steps in setting up one AQ queue
in Oracle database:</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;">
<!--[if !supportLists]--><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">1.<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><!--[endif]--><span style="font-family: Georgia, serif; font-size: 18pt;">Create one user in database. This user will
be granted with the roles: <b>AQ_ADMINISTRATOR_ROLE</b>,</span><span style="font-family: Georgia, serif; font-size: 18pt;"> </span><b><span style="font-family: Georgia, serif; font-size: 18pt;">AQ_USER_ROLE</span></b><span style="font-family: Georgia, serif; font-size: 18pt;">. Log into Oracle XE 10g as the sysdba and
then create one user called EVENT_USER and then grant
certain privileges to this user.</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt;">
<br /></div>
<pre class="prettyprint linenums">sqlplus sys@localhost:1521/xe as sysdba
create user EVENT_USER identified by oracle;
grant create session, resource, AQ_ADMINISTRATOR_ROLE,AQ_USER_ROLE to EVENT_USER;
grant execute on DBMS_AQADM to EVENT_USER;
grant execute on DBMS_AQ to EVENT_USER;
</pre>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt;">
<br /></div>
<div class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;">
<!--[if !supportLists]--><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">2.<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><!--[endif]--><span style="font-family: Georgia, serif; font-size: 18pt;">Create a queue table. Before one type called
invoice_type is created. This type is used as the payload type of the
message in AQ queue. </span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt;">
<br /></div>
<pre class="prettyprint linenums"><a href="https://www.blogger.com/blogger.g?blogID=8487142701656203604" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><a href="https://www.blogger.com/blogger.g?blogID=8487142701656203604" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><a href="https://www.blogger.com/blogger.g?blogID=8487142701656203604" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><a href="https://www.blogger.com/blogger.g?blogID=8487142701656203604" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><a href="https://www.blogger.com/blogger.g?blogID=8487142701656203604" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><a href="https://www.blogger.com/blogger.g?blogID=8487142701656203604" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><a href="https://www.blogger.com/blogger.g?blogID=8487142701656203604" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a>create or replace type invoice_type as object(
invoice_id number,
invoice_number varchar2(60),
vendor_id number
);
/
exec DBMS_AQADM.CREATE_QUEUE_TABLE (
queue_table => 'EVENT_USER.invoice_queue_table',
queue_payload_type => 'EVENT_USER.invoice_type');
SELECT queue_table,type,object_type,recipients FROM USER_QUEUE_TABLES;
</pre>
<div class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;">
<!--[if !supportLists]--><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">3.<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><!--[endif]--><span style="font-family: Georgia, serif; font-size: 18pt;">After the queue table is created create a queue</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<pre class="prettyprint linenums">exec DBMS_AQADM.CREATE_QUEUE (
queue_name =>'EVENT_USER.invoice_queue',
queue_table=>'EVENT_USER.invoice_queue_table');
select name, queue_table, queue_type from user_queues;
</pre>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt;">
<span style="font-family: Georgia, serif; font-size: 18pt;">After the execution of above PL/SQL scripts some
database objects are created for this AQ queue as shown below. </span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span><br />
<a href="https://www.blogger.com/blogger.g?blogID=8487142701656203604" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="https://www.blogger.com/blogger.g?blogID=8487142701656203604" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="https://www.blogger.com/blogger.g?blogID=8487142701656203604" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="https://www.blogger.com/blogger.g?blogID=8487142701656203604" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="https://www.blogger.com/blogger.g?blogID=8487142701656203604" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="https://www.blogger.com/blogger.g?blogID=8487142701656203604" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="https://www.blogger.com/blogger.g?blogID=8487142701656203604" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><span style="font-family: Georgia, serif; font-size: 18pt;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-OEiqP8Iz0xg/U1PQ-d7XIeI/AAAAAAAAAm0/e-cwzexVQjQ/s1600/Capture.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-OEiqP8Iz0xg/U1PQ-d7XIeI/AAAAAAAAAm0/e-cwzexVQjQ/s1600/Capture.PNG" height="209" width="320" /></a></div>
<span style="font-family: Georgia, serif; font-size: 18pt;"><br /></span></div>
<div align="center" class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt; text-align: center;">
<a href="http://4.bp.blogspot.com/--rrGBAVtfrY/U0vgtnvsLbI/AAAAAAAAAkw/zRdWdLE81GM/s1600/Capture.PNG"><span style="color: blue; font-family: "Times New Roman","serif"; font-size: 13.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-AU; mso-no-proof: yes; text-decoration: none; text-underline: none;"><!--[if gte vml 1]><v:shapetype id="_x0000_t75"
coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe"
filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="Picture_x0020_1" o:spid="_x0000_i1025" type="#_x0000_t75"
alt="https://4.bp.blogspot.com/--rrGBAVtfrY/U0vgtnvsLbI/AAAAAAAAAkw/zRdWdLE81GM/s1600/Capture.PNG"
href="http://4.bp.blogspot.com/--rrGBAVtfrY/U0vgtnvsLbI/AAAAAAAAAkw/zRdWdLE81GM/s1600/Capture.PNG"
style='width:240pt;height:156.75pt;visibility:visible;mso-wrap-style:square'
o:button="t">
<v:imagedata src="file:///C:\Users\markchen\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png"
o:title="proxy?url=http%3A%2F%2F4.bp.blogspot.com%2F--rrGBAVtfrY%2FU0vgtnvsLbI%2FAAAAAAAAAkw%2FzRdWdLE81GM%2Fs1600%2FCapture"/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span></a><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;">
<!--[if !supportLists]--><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">4.<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><!--[endif]--><span style="font-family: Georgia, serif; font-size: 18pt;">Last step is to start the queue. It can be
done by executing the below procedure from DBMS_AQADM.</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
</div>
<pre class="prettyprint linenums">exec DBMS_AQADM.START_QUEUE('EVENT_USER.invoice_queue');
</pre>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt;">
<span style="font-family: 'Courier New'; font-size: 10pt;"><br /></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt;">
<span style="font-family: 'Courier New'; font-size: 10pt;"><br /></span></div>
<div class="MsoNormal">
<b><span style="font-family: Georgia, serif; font-size: 18pt;">Enqueue
AQ queue with PL/SQL package</span></b><b><span style="font-family: 'Times New Roman', serif; font-size: 18pt;"><o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Georgia, serif; font-size: 18pt;">Now the queue is ready to enqueue a message in the AQ queue just created and started. In this example one PL/SQL procedure from DBMS_AQ
package is used to enqueue the AQ queue.</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
</div>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 18pt;">
<br /></div>
<pre class="prettyprint linenums">DECLARE
enqueue_options dbms_aq.enqueue_options_t;
message_properties dbms_aq.message_properties_t;
message_handle RAW(16);
message invoice_type ;
message_id NUMBER;
BEGIN
message := invoice_type (10, 'ABCD123', 80);
enqueue_options.VISIBILITY := DBMS_AQ.ON_COMMIT;
enqueue_options.SEQUENCE_DEVIATION := null;
message_properties.EXPIRATION := DBMS_AQ.NEVER;
DBMS_AQ.ENQUEUE (
queue_name => 'invoice_queue',
enqueue_options => enqueue_options,
message_properties => message_properties,
payload => message,
msgid => message_handle);
COMMIT;
END;
/
</pre>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 18pt;">
<span style="font-family: 'Courier New'; font-size: 10pt;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Georgia, serif; font-size: 24px;">The message just enqueued can be browsed using the below query:</span><br />
<pre class="prettyprint linenums">SELECT count(*) FROM aq$invoice_queue_table
SELECT user_data FROM aq$invoice_queue_table;</pre>
<div class="MsoNormal" style="-webkit-text-stroke-width: 0px; color: black; font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0cm 0cm 0.0001pt 18pt; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">
<div style="margin: 0px;">
<span style="font-family: 'Courier New'; font-size: 10pt;"><br /></span></div>
</div>
<span style="font-family: Georgia, serif; font-size: 24px;"><br /></span>
<b><span style="font-family: Georgia, serif; font-size: 18pt;">Consume
the message in AQ queue from Oracle SOA component</span></b><b><span style="font-family: 'Times New Roman', serif; font-size: 18pt;"><o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Georgia, serif; font-size: 18pt;">Oracle SOA component(BPEL and Mediator) can
consume the message from AQ queue(dequeue) or produce the message into
the queue(enqueue). It is done by using Oracle SOA uses JCA adapter for AQ.</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Georgia, serif; font-size: 18pt;">In order to use AQ adapter some configurations need
to be done.</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;">
<!--[if !supportLists]--><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">1.<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><!--[endif]--><span style="font-family: Georgia, serif; font-size: 18pt;">Create the data source in Weblogic console via
Domain Structure->Services->Data Sources. </span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt;">
<span style="font-family: Georgia, serif; font-size: 18pt;">This data source will point to the Oracle database
where AQ queue resides on. In this example it is Oracle XE 10g running on
local machine. Here AQEvent data source is created and its JNDI name is set as <b>jdbc/AQEvent</b>. </span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div align="center" class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt; text-align: center;">
<a href="http://4.bp.blogspot.com/-l6ASt3OsBiA/U1JpO1WsUJI/AAAAAAAAAlI/LH5zSdJ8Mds/s1600/Capture1.PNG"><span style="color: blue; font-family: "Times New Roman","serif"; font-size: 13.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-AU; mso-no-proof: yes; text-decoration: none; text-underline: none;"><!--[if gte vml 1]><v:shapetype id="_x0000_t75"
coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe"
filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="Picture_x0020_2" o:spid="_x0000_i1030" type="#_x0000_t75"
alt="https://4.bp.blogspot.com/-l6ASt3OsBiA/U1JpO1WsUJI/AAAAAAAAAlI/LH5zSdJ8Mds/s1600/Capture1.PNG"
href="http://4.bp.blogspot.com/-l6ASt3OsBiA/U1JpO1WsUJI/AAAAAAAAAlI/LH5zSdJ8Mds/s1600/Capture1.PNG"
style='width:240pt;height:105.75pt;visibility:visible;mso-wrap-style:square'
o:button="t">
<v:imagedata src="file:///C:\Users\markchen\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png"
o:title="proxy?url=http%3A%2F%2F4.bp.blogspot.com%2F-l6ASt3OsBiA%2FU1JpO1WsUJI%2FAAAAAAAAAlI%2FLH5zSdJ8Mds%2Fs1600%2FCapture1"/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span></a><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt;">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-k_o8hRE3icY/U1PQr3XIlII/AAAAAAAAAmk/-czROyKml-U/s1600/Capture1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-k_o8hRE3icY/U1PQr3XIlII/AAAAAAAAAmk/-czROyKml-U/s1600/Capture1.PNG" height="141" width="320" /></a></div>
<div style="text-align: center;">
<br /></div>
</div>
<div align="center" class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt; text-align: center;">
<a href="http://2.bp.blogspot.com/-KVusc-Z23zw/U1JpDo4jAVI/AAAAAAAAAlA/ZwLsstSv0-k/s1600/Capture2.PNG"><span style="color: blue; font-family: "Times New Roman","serif"; font-size: 13.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-AU; mso-no-proof: yes; text-decoration: none; text-underline: none;"><!--[if gte vml 1]><v:shape id="Picture_x0020_3"
o:spid="_x0000_i1029" type="#_x0000_t75" alt="https://2.bp.blogspot.com/-KVusc-Z23zw/U1JpDo4jAVI/AAAAAAAAAlA/ZwLsstSv0-k/s1600/Capture2.PNG"
href="http://2.bp.blogspot.com/-KVusc-Z23zw/U1JpDo4jAVI/AAAAAAAAAlA/ZwLsstSv0-k/s1600/Capture2.PNG"
style='width:240pt;height:88.5pt;visibility:visible;mso-wrap-style:square'
o:button="t">
<v:imagedata src="file:///C:\Users\markchen\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png"
o:title="proxy?url=http%3A%2F%2F2.bp.blogspot.com%2F-KVusc-Z23zw%2FU1JpDo4jAVI%2FAAAAAAAAAlA%2FZwLsstSv0-k%2Fs1600%2FCapture2"/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span></a><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt;">
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-YuzrgzufFOs/U1PQ0JUfb5I/AAAAAAAAAms/lTKoHm350QA/s1600/Capture2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-YuzrgzufFOs/U1PQ0JUfb5I/AAAAAAAAAms/lTKoHm350QA/s1600/Capture2.PNG" height="119" width="320" /></a></div>
<div style="text-align: center;">
<br /></div>
</div>
<div class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;">
<!--[if !supportLists]--><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">2.<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><!--[endif]--><span style="font-family: Georgia, serif; font-size: 18pt;">Create AQAdpater instance in Weblogic console via
Domain Structure->Deployments->Deployments->AQAdapter. </span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt;">
<span style="font-family: Georgia, serif; font-size: 18pt;">An new AQ adapter instance is created as <b>eis/AQ/LocalEventConnection</b> whose
XADataSourceName is set as: <b>jdbc/AQEvent</b>.</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div align="center" class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt; text-align: center;">
<span style="color: blue; font-family: "Times New Roman","serif"; font-size: 13.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-AU; mso-no-proof: yes; text-decoration: none; text-underline: none;"><!--[if gte vml 1]><v:shape id="Picture_x0020_4"
o:spid="_x0000_i1028" type="#_x0000_t75" alt="https://3.bp.blogspot.com/-pMeGR1Luf6k/U1JphBkallI/AAAAAAAAAlQ/DkUq5HQA1a0/s1600/Capture3.PNG"
href="http://3.bp.blogspot.com/-pMeGR1Luf6k/U1JphBkallI/AAAAAAAAAlQ/DkUq5HQA1a0/s1600/Capture3.PNG"
style='width:240pt;height:94.5pt;visibility:visible;mso-wrap-style:square'
o:button="t">
<v:imagedata src="file:///C:\Users\markchen\AppData\Local\Temp\msohtmlclip1\01\clip_image005.png"
o:title="proxy?url=http%3A%2F%2F3.bp.blogspot.com%2F-pMeGR1Luf6k%2FU1JphBkallI%2FAAAAAAAAAlQ%2FDkUq5HQA1a0%2Fs1600%2FCapture3"/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div align="center" class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt; text-align: center;">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-MsokpRU2JSE/U1PQZyA6B7I/AAAAAAAAAmU/1lo6swHFnLc/s1600/Capture3.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-MsokpRU2JSE/U1PQZyA6B7I/AAAAAAAAAmU/1lo6swHFnLc/s1600/Capture3.PNG" height="126" width="320" /></a></div>
<br /></div>
<div align="center" class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt; text-align: center;">
<a href="http://2.bp.blogspot.com/-AYi1Cqf_eps/U1Jpuopp0pI/AAAAAAAAAlY/qEHaAgVUibY/s1600/Capture4.PNG"><span style="color: blue; font-family: "Times New Roman","serif"; font-size: 13.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-AU; mso-no-proof: yes; text-decoration: none; text-underline: none;"><!--[if gte vml 1]><v:shape id="Picture_x0020_5"
o:spid="_x0000_i1027" type="#_x0000_t75" alt="https://2.bp.blogspot.com/-AYi1Cqf_eps/U1Jpuopp0pI/AAAAAAAAAlY/qEHaAgVUibY/s1600/Capture4.PNG"
href="http://2.bp.blogspot.com/-AYi1Cqf_eps/U1Jpuopp0pI/AAAAAAAAAlY/qEHaAgVUibY/s1600/Capture4.PNG"
style='width:240pt;height:98.25pt;visibility:visible;mso-wrap-style:square'
o:button="t">
<v:imagedata src="file:///C:\Users\markchen\AppData\Local\Temp\msohtmlclip1\01\clip_image007.png"
o:title="proxy?url=http%3A%2F%2F2.bp.blogspot.com%2F-AYi1Cqf_eps%2FU1Jpuopp0pI%2FAAAAAAAAAlY%2FqEHaAgVUibY%2Fs1600%2FCapture4"/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span></a><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div align="center" class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt; text-align: center;">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-dS72wU92cH8/U1PQgghBuaI/AAAAAAAAAmc/_n9ZRbvzoEU/s1600/Capture4.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-dS72wU92cH8/U1PQgghBuaI/AAAAAAAAAmc/_n9ZRbvzoEU/s1600/Capture4.PNG" height="131" width="320" /></a></div>
<br /></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt;">
<br /></div>
<div class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;">
<!--[if !supportLists]--><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">3.<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><!--[endif]--><span style="font-family: Georgia, serif; font-size: 18pt;">Use AQAdapter in JDeveloper</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt;">
<span style="font-family: Georgia, serif; font-size: 18pt;">Here the AQAdapter will be used as the service to
consume the message from the AQ queue specified in adapter jca file. This jca file also specifies the AQ
connection factory which is configured as <b>eis/AQ/LocalEventConnection
</b>in the above step.</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-bnOIKbjafoQ/U1PNudh2iwI/AAAAAAAAAmI/5ju5VVHz4hY/s1600/Capture5.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-bnOIKbjafoQ/U1PNudh2iwI/AAAAAAAAAmI/5ju5VVHz4hY/s1600/Capture5.PNG" height="154" width="320" /></a></div>
<span style="font-family: Georgia, serif; font-size: 18pt;"><br /></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt;">
<br /></div>
<pre class="prettyprint linenums"><adapter-config adapter="AQ Adapter" name="AQEventService" wsdllocation="AQEventService.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
<connection-factory location="eis/AQ/LocalEventConnectionen" uiconnectionname="LocalEventConnectionen">
<endpoint-activation operation="Dequeue" porttype="Dequeue_ptt">
<activation-spec classname="oracle.tip.adapter.aq.inbound.AQDequeueActivationSpec">
<property name="SchemaValidation" value="false">
<property name="QueueName" value="INVOICE_QUEUE">
<property name="DatabaseSchema" value="EVENT_USER">
</property></property></property></activation-spec>
</endpoint-activation>
</connection-factory>
</adapter-config>
</pre>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 36pt;">
</div>
<div align="center" class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center;">
<br /></div>
<div align="center" class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Georgia, serif; font-size: 18pt;">After the SOA project is deployed to the server,
the AQAdapter will start to poll the message in AQInvoice queue.</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div align="center" class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center;">
<a href="http://4.bp.blogspot.com/-ygkjdpu-08A/U1JqTeWSvJI/AAAAAAAAAlo/zdy-KgeSGv0/s1600/Capture6.PNG"><span style="color: blue; font-family: "Georgia","serif"; font-size: 18.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-AU; mso-no-proof: yes; text-decoration: none; text-underline: none;"><!--[if gte vml 1]><v:shape
id="Picture_x0020_7" o:spid="_x0000_i1025" type="#_x0000_t75" alt="https://4.bp.blogspot.com/-ygkjdpu-08A/U1JqTeWSvJI/AAAAAAAAAlo/zdy-KgeSGv0/s1600/Capture6.PNG"
href="http://4.bp.blogspot.com/-ygkjdpu-08A/U1JqTeWSvJI/AAAAAAAAAlo/zdy-KgeSGv0/s1600/Capture6.PNG"
style='width:240pt;height:96.75pt;visibility:visible;mso-wrap-style:square'
o:button="t">
<v:imagedata src="file:///C:\Users\markchen\AppData\Local\Temp\msohtmlclip1\01\clip_image011.png"
o:title="proxy?url=http%3A%2F%2F4.bp.blogspot.com%2F-ygkjdpu-08A%2FU1JqTeWSvJI%2FAAAAAAAAAlo%2Fzdy-KgeSGv0%2Fs1600%2FCapture6"/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span></a><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0.0001pt 18pt;">
</div>
<div class="MsoNormal">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-ein7CpieONU/U1PIK5AWFWI/AAAAAAAAAl4/pI-z7vVySQs/s1600/Capture6.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-ein7CpieONU/U1PIK5AWFWI/AAAAAAAAAl4/pI-z7vVySQs/s1600/Capture6.PNG" height="129" width="320" /></a></div>
<br />
<b><span style="font-family: Georgia, serif; font-size: 18pt;">Consume the message in AQ queue from OSB</span></b><br />
<span style="font-family: Georgia, serif; font-size: 24px;">In OSB JCA adapter is also used to poll the message in AQ queue. Here the AQ JCA used in SOA will be used to generate one proxy service. Also assume that the same data source and AQAdapter instance are configured in OSB server.</span><br />
<span style="font-family: Georgia, serif; font-size: 24px;"><br /></span>
<span style="font-family: Georgia, serif; font-size: 24px;">Create one OSB project as AQTestProject.</span><br />
<span style="font-family: Georgia, serif; font-size: 24px;">Copy the below files from JDeveloper to the OSB project:</span><br />
<span style="font-family: Georgia, serif; font-size: 24px;"> AQEventService_aq.jca</span><br />
<span style="font-family: Georgia, serif; font-size: 24px;"> AQEventService.wsdl</span><br />
<span style="font-family: Georgia, serif; font-size: 24px;"> xsd/EVENT_USER_INVOICE_TYPE.xsd</span><br />
<span style="font-family: Georgia, serif; font-size: 24px;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-sJmkPVA0XK0/U2jZOHTPEuI/AAAAAAAAAnE/ZS0LBpozq_g/s1600/osb1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-sJmkPVA0XK0/U2jZOHTPEuI/AAAAAAAAAnE/ZS0LBpozq_g/s1600/osb1.png" height="173" width="320" /></a></div>
<span style="font-family: Georgia, serif; font-size: 24px;"><br /></span>
<span style="font-family: Georgia, serif; font-size: 24px;">From .jca file to generate the OSB proxy service.</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-sFk9LsDy9Wk/U2jZxvByGwI/AAAAAAAAAnM/8CuClWFypPk/s1600/osb2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-sFk9LsDy9Wk/U2jZxvByGwI/AAAAAAAAAnM/8CuClWFypPk/s1600/osb2.png" height="190" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-4fLuweTQLhk/U2jaW_6JXgI/AAAAAAAAAnY/kBl8tEoyy-s/s1600/osb3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-4fLuweTQLhk/U2jaW_6JXgI/AAAAAAAAAnY/kBl8tEoyy-s/s1600/osb3.png" height="244" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, serif; font-size: 24px;">The generated proxy service will be as the below:</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-xdDDpESMkl4/U2jbZ5aIalI/AAAAAAAAAno/W1Cu6t8Rb2k/s1600/osb4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-xdDDpESMkl4/U2jbZ5aIalI/AAAAAAAAAno/W1Cu6t8Rb2k/s1600/osb4.png" height="114" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-AI52OSoEM04/U2jb9Gcxc7I/AAAAAAAAAns/hUGTwpK9T-s/s1600/osb5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-AI52OSoEM04/U2jb9Gcxc7I/AAAAAAAAAns/hUGTwpK9T-s/s1600/osb5.png" height="192" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-RAHlI6xWnz8/U2jcOvHBl6I/AAAAAAAAAn0/jvTmgWBpXMc/s1600/osb6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-RAHlI6xWnz8/U2jcOvHBl6I/AAAAAAAAAn0/jvTmgWBpXMc/s1600/osb6.png" height="192" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, serif; font-size: 24px;">Design the message flow as below:</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-UnL3UdeU4YY/U2jcp2xQ_CI/AAAAAAAAAn8/5S_BQ-NJE0w/s1600/osb7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-UnL3UdeU4YY/U2jcp2xQ_CI/AAAAAAAAAn8/5S_BQ-NJE0w/s1600/osb7.png" height="218" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, serif; font-size: 24px;">After the OSB project is deployed on the server it will start to consume the message in AQ.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, serif; font-size: 24px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-q-dtazIzmhY/U2jeDhoowhI/AAAAAAAAAoM/OsJSqIcy4IY/s1600/osb8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-q-dtazIzmhY/U2jeDhoowhI/AAAAAAAAAoM/OsJSqIcy4IY/s1600/osb8.png" height="54" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, serif; font-size: 24px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, serif; font-size: 24px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<span style="font-family: Georgia, serif; font-size: 24px;"><br /></span></div>
<!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F3.bp.blogspot.com%2F-pMeGR1Luf6k%2FU1JphBkallI%2FAAAAAAAAAlQ%2FDkUq5HQA1a0%2Fs1600%2FCapture3.PNG&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://3.bp.blogspot.com/-pMeGR1Luf6k/U1JphBkallI/AAAAAAAAAlQ/DkUq5HQA1a0/s1600/Capture3.PNG" --><!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F4.bp.blogspot.com%2F-ygkjdpu-08A%2FU1JqTeWSvJI%2FAAAAAAAAAlo%2Fzdy-KgeSGv0%2Fs1600%2FCapture6.PNG&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://4.bp.blogspot.com/-ygkjdpu-08A/U1JqTeWSvJI/AAAAAAAAAlo/zdy-KgeSGv0/s1600/Capture6.PNG" --><!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F4.bp.blogspot.com%2F-l6ASt3OsBiA%2FU1JpO1WsUJI%2FAAAAAAAAAlI%2FLH5zSdJ8Mds%2Fs1600%2FCapture1.PNG&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://4.bp.blogspot.com/-l6ASt3OsBiA/U1JpO1WsUJI/AAAAAAAAAlI/LH5zSdJ8Mds/s1600/Capture1.PNG" --><!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F4.bp.blogspot.com%2F--rrGBAVtfrY%2FU0vgtnvsLbI%2FAAAAAAAAAkw%2FzRdWdLE81GM%2Fs1600%2FCapture.PNG&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://4.bp.blogspot.com/--rrGBAVtfrY/U0vgtnvsLbI/AAAAAAAAAkw/zRdWdLE81GM/s1600/Capture.PNG" --><!-- Blogger automated replacement: "https://4.bp.blogspot.com/-l6ASt3OsBiA/U1JpO1WsUJI/AAAAAAAAAlI/LH5zSdJ8Mds/s1600/Capture1.PNG" with "https://4.bp.blogspot.com/-l6ASt3OsBiA/U1JpO1WsUJI/AAAAAAAAAlI/LH5zSdJ8Mds/s1600/Capture1.PNG" --><!-- Blogger automated replacement: "https://4.bp.blogspot.com/--rrGBAVtfrY/U0vgtnvsLbI/AAAAAAAAAkw/zRdWdLE81GM/s1600/Capture.PNG" with "https://4.bp.blogspot.com/--rrGBAVtfrY/U0vgtnvsLbI/AAAAAAAAAkw/zRdWdLE81GM/s1600/Capture.PNG" --><!-- Blogger automated replacement: "https://2.bp.blogspot.com/-KVusc-Z23zw/U1JpDo4jAVI/AAAAAAAAAlA/ZwLsstSv0-k/s1600/Capture2.PNG" with "https://2.bp.blogspot.com/-KVusc-Z23zw/U1JpDo4jAVI/AAAAAAAAAlA/ZwLsstSv0-k/s1600/Capture2.PNG" --><!-- Blogger automated replacement: "https://3.bp.blogspot.com/-pMeGR1Luf6k/U1JphBkallI/AAAAAAAAAlQ/DkUq5HQA1a0/s1600/Capture3.PNG" with "https://3.bp.blogspot.com/-pMeGR1Luf6k/U1JphBkallI/AAAAAAAAAlQ/DkUq5HQA1a0/s1600/Capture3.PNG" --><!-- Blogger automated replacement: "https://4.bp.blogspot.com/-ygkjdpu-08A/U1JqTeWSvJI/AAAAAAAAAlo/zdy-KgeSGv0/s1600/Capture6.PNG" with "https://4.bp.blogspot.com/-ygkjdpu-08A/U1JqTeWSvJI/AAAAAAAAAlo/zdy-KgeSGv0/s1600/Capture6.PNG" --><!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F2.bp.blogspot.com%2F-AYi1Cqf_eps%2FU1Jpuopp0pI%2FAAAAAAAAAlY%2FqEHaAgVUibY%2Fs1600%2FCapture4.PNG&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://2.bp.blogspot.com/-AYi1Cqf_eps/U1Jpuopp0pI/AAAAAAAAAlY/qEHaAgVUibY/s1600/Capture4.PNG" --><!-- Blogger automated replacement: "https://2.bp.blogspot.com/-AYi1Cqf_eps/U1Jpuopp0pI/AAAAAAAAAlY/qEHaAgVUibY/s1600/Capture4.PNG" with "https://2.bp.blogspot.com/-AYi1Cqf_eps/U1Jpuopp0pI/AAAAAAAAAlY/qEHaAgVUibY/s1600/Capture4.PNG" --><!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F2.bp.blogspot.com%2F-KVusc-Z23zw%2FU1JpDo4jAVI%2FAAAAAAAAAlA%2FZwLsstSv0-k%2Fs1600%2FCapture2.PNG&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://2.bp.blogspot.com/-KVusc-Z23zw/U1JpDo4jAVI/AAAAAAAAAlA/ZwLsstSv0-k/s1600/Capture2.PNG" -->Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com5tag:blogger.com,1999:blog-8487142701656203604.post-75000571996170907462014-03-13T05:03:00.001-07:002014-04-20T18:28:18.882-07:00DbAdapter instance is not setup correctly in cluster environment<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Recently I had the issue one Oracle SOA DbAdapter instance in the cluster environment. The DbAdapter is created in the single node development environment. Everything is working fine but after moving to testing environment which is cluster environment. DbAdapter is created following the same steps as did for development environment. Things start to go wrong sometimes. The faults occurred complains that</span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">the Resource Adapters RAR file has not been deployed successfully to the WebLogic Application server or</span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">element in weblogic-ra.xml has not been set to the created DbApater instance. However the DbApater instance looks completely correct from Weblogic Console. After some while of investigation it is realized that it might be the resource adapter plan file is not set up correctly in both nodes or one of node. Checking the Plan.xml files on each node verifies this. After copying the Plan which is set correctly to another node everything starts to work fine.</span><br />
<span style="font-family: Georgia, Times New Roman, serif;"><span style="font-size: large;"><br /></span>
<span style="font-size: large;">There is one wonderful blog which explains this very clearly.</span></span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">http://myexperienceswithsoa.blogspot.com.au/2012/02/planxml-not-getting-updated-across.html</span><br />
<span style="font-family: Georgia, Times New Roman, serif;"><span style="font-size: large;"><br /></span>
<span style="font-size: large;">So next time when you are working with resource adapter in cluster environment keep this in mind. </span></span>Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com0tag:blogger.com,1999:blog-8487142701656203604.post-48158140754641445252013-11-19T05:03:00.000-08:002014-04-27T06:29:27.783-07:00Installing Oracle WebCenter Content 11g<span style="font-family: Georgia, Times New Roman, serif;"><span style="font-size: large;">In this blog I would like to briefly show the steps to install Oracle WebCenter Content 11g. Oracle WebCenter 11g is based on Weblogic server now and they also need database schemas created just as other Oracle Fusion applications.</span></span><br />
<br />
<span style="font-family: Georgia, Times New Roman, serif;"><span style="font-size: large;">I will install them in my laptop with Windows 7 and use Oracle XE 10g as the database where the schemas reside.</span><span style="font-size: large;"> </span></span><br />
<span style="font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">You can download Oracle XE, Weblogic 10.3.6 and RCU 11.1.1.7 from this url: <a href="http://www.oracle.com/technetwork/middleware/soasuite/downloads/index.html" target="_blank">http://www.oracle.com/technetwork/middleware/soasuite/downloads/index.html</a></span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">You can download Oracle WebCenter Content from the url: <a href="http://www.oracle.com/technetwork/middleware/webcenter/content/downloads/index.html" target="_blank">http://www.oracle.com/technetwork/middleware/webcenter/content/downloads/index.html </a></span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<br />
<span style="font-size: large;"><b><span style="font-family: Georgia, Times New Roman, serif;">Step 1: Install Weblogic </span></b></span><br />
<span style="font-size: large;"><b><span style="font-family: Georgia, Times New Roman, serif;"><br /></span></b></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">If you already have Weblogic installed you can skip this step.</span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">My laptop runs on Windows 7 64-bit so the download of Oracle Weblogic 10.3.6 is <i>wls1036_generic.jar</i>. To start the installer just use the following command.</span><br />
<br />
<pre class="prettyprint linenums"> java -jar wls1036_generic.jar</pre>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-5gjBu7yRQew/UotHzMih-_I/AAAAAAAAAeg/fMYj7FgAE7M/s1600/wls1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-5gjBu7yRQew/UotHzMih-_I/AAAAAAAAAeg/fMYj7FgAE7M/s320/wls1.png" height="230" width="320" /></a></div>
<b><span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span></b>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-5Iqx6JVBSyI/UotH6pP1SEI/AAAAAAAAAeo/0t_Vvr1zBkw/s1600/wls2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-5Iqx6JVBSyI/UotH6pP1SEI/AAAAAAAAAeo/0t_Vvr1zBkw/s320/wls2.png" height="230" width="320" /></a></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-q-NlztzgDno/UotIA4JAcPI/AAAAAAAAAew/k6TvYbGcmxM/s1600/wls3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-q-NlztzgDno/UotIA4JAcPI/AAAAAAAAAew/k6TvYbGcmxM/s320/wls3.png" height="231" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-yVA-fmi4Ei4/UotIG_zcsoI/AAAAAAAAAe4/QNJ9QcUrJMU/s1600/wls4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-yVA-fmi4Ei4/UotIG_zcsoI/AAAAAAAAAe4/QNJ9QcUrJMU/s320/wls4.png" height="231" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-Y0ngPCuOXRA/UotIP3f3wgI/AAAAAAAAAfA/a7IaSMc5hBI/s1600/wls5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-Y0ngPCuOXRA/UotIP3f3wgI/AAAAAAAAAfA/a7IaSMc5hBI/s320/wls5.png" height="231" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-gxfapYWs0no/UotIUvgpKZI/AAAAAAAAAfI/zWiRxDwMUsE/s1600/wls6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-gxfapYWs0no/UotIUvgpKZI/AAAAAAAAAfI/zWiRxDwMUsE/s320/wls6.png" height="231" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-PhUe1yGHeLU/UotIat6bXaI/AAAAAAAAAfQ/7clTJluhTSk/s1600/wls7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-PhUe1yGHeLU/UotIat6bXaI/AAAAAAAAAfQ/7clTJluhTSk/s320/wls7.png" height="231" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-akPJc_nZ4E4/UotIii8j_MI/AAAAAAAAAfY/j-PTkDnunpI/s1600/wls8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-akPJc_nZ4E4/UotIii8j_MI/AAAAAAAAAfY/j-PTkDnunpI/s320/wls8.png" height="231" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">After the successful installation there is new folder as the below:</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-gFsHMamxn7Y/UotIoK3susI/AAAAAAAAAfg/U1i9R5aEAW8/s1600/wls9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-gFsHMamxn7Y/UotIoK3susI/AAAAAAAAAfg/U1i9R5aEAW8/s320/wls9.png" height="159" width="320" /></a></div>
<b><span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span></b>
<b><span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span></b>
<b><span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span></b>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><b>Step 2: Install database schemas using RCU </b></span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><b><br /></b></span>
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">My RCU download is </span><span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><i>ofm_rcu_win_11.1.1.7.0_32_disk1_1of1.zip</i>. Unzuip this file into the folder RCU and run the following command. Here it is assumed that Oracle XE 10g is installed already. </span><br />
<br />
<pre class="prettyprint linenums"> set RCU_JDBC_TRIM_BLOCKS=TRUE
echo %RCU_JDBC_TRIM_BLOCKS%
cd RCU/rcuHome/BIN
rcu.bat </pre>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-mudR7eUJEHE/UotR6FaUeXI/AAAAAAAAAfw/q1BB3ZFN_ro/s1600/rcu1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-mudR7eUJEHE/UotR6FaUeXI/AAAAAAAAAfw/q1BB3ZFN_ro/s320/rcu1.png" height="240" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-fAK5txONS-4/UotSACMPa2I/AAAAAAAAAf4/IKfTFBJESuo/s1600/rcu2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-fAK5txONS-4/UotSACMPa2I/AAAAAAAAAf4/IKfTFBJESuo/s320/rcu2.png" height="240" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-2i5RAX7uBpM/UotUJflix_I/AAAAAAAAAgM/u8H0IzxP_UU/s1600/rcu4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-2i5RAX7uBpM/UotUJflix_I/AAAAAAAAAgM/u8H0IzxP_UU/s320/rcu4.png" height="133" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-DL96coZufd4/UotUEXmOQQI/AAAAAAAAAgE/Z4XqFzZAx8c/s1600/rcu3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-DL96coZufd4/UotUEXmOQQI/AAAAAAAAAgE/Z4XqFzZAx8c/s320/rcu3.png" height="240" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-ltJpOtSAcVU/UotUbf4zMWI/AAAAAAAAAgU/5VIisW9aJFE/s1600/rcu5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-ltJpOtSAcVU/UotUbf4zMWI/AAAAAAAAAgU/5VIisW9aJFE/s320/rcu5.png" height="216" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-Ms0SR329Gl0/UotUgXXnDyI/AAAAAAAAAgc/Dd9ooxgSDoc/s1600/rcu6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-Ms0SR329Gl0/UotUgXXnDyI/AAAAAAAAAgc/Dd9ooxgSDoc/s320/rcu6.png" height="161" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-5GNNuzfei3M/UotUl65C4tI/AAAAAAAAAgk/Y7SxEYbaoCg/s1600/rcu7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-5GNNuzfei3M/UotUl65C4tI/AAAAAAAAAgk/Y7SxEYbaoCg/s320/rcu7.png" height="216" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-szZHwabOCIo/UotUrnV7gjI/AAAAAAAAAgs/InyaS1pM8zI/s1600/rcu8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-szZHwabOCIo/UotUrnV7gjI/AAAAAAAAAgs/InyaS1pM8zI/s320/rcu8.png" height="216" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">After RCU installation is done, several schemas are created in Oracle XE. </span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-3UigvrAH93c/UotWzzwvQPI/AAAAAAAAAg4/4o5GxGhJ5Jw/s1600/rcu11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-3UigvrAH93c/UotWzzwvQPI/AAAAAAAAAg4/4o5GxGhJ5Jw/s320/rcu11.png" height="103" width="320" /></a></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><b><br /></b></span>
<b style="font-family: Georgia, 'Times New Roman', serif; font-size: x-large;"><br /></b>
<b style="font-family: Georgia, 'Times New Roman', serif; font-size: x-large;">Step 3: Install Oracle WebCenter Content 11g</b><br />
<b style="font-family: Georgia, 'Times New Roman', serif; font-size: x-large;"><br /></b>
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">The download of WebCenter Content 11g are two zip files: </span><span style="font-family: Georgia, Times New Roman, serif; font-size: large;">ofm_wcc_generic_11.1.1.8.0_disk1_1of2.zip and ofm_wcc_generic_11.1.1.8.0_disk1_2of2.zip.</span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Unzip two files into the folders: Disk1 and Disk2.</span><br />
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Use the following command to </span><br />
<br />
<pre class="prettyprint linenums">cd C:\MyDownload\OracleWebCenter\Disk1
setup -jreLoc C:\Java\jdk1.7.0_06</pre>
<br />
<span style="font-size: large;"><b style="font-family: Georgia, 'Times New Roman', serif;"><br /></b></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-LG3X0BRV5CY/UoteFFNHHsI/AAAAAAAAAhI/RlA5Xo0gSwE/s1600/wc1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-LG3X0BRV5CY/UoteFFNHHsI/AAAAAAAAAhI/RlA5Xo0gSwE/s320/wc1.PNG" height="259" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-9SoeALry8VA/UoteU4kjBfI/AAAAAAAAAhQ/5JQ9nUTkxtc/s1600/wc2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-9SoeALry8VA/UoteU4kjBfI/AAAAAAAAAhQ/5JQ9nUTkxtc/s320/wc2.PNG" height="259" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-XSWCt0zAMHs/UoteaTWjQsI/AAAAAAAAAhY/h2QN_UmFxOs/s1600/wc3.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-XSWCt0zAMHs/UoteaTWjQsI/AAAAAAAAAhY/h2QN_UmFxOs/s320/wc3.PNG" height="259" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">Oracle Middleware Home is: C:\Oracle\Middleware and Oracle Home Directory is: Oracle_ECM1.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-zvnOgmu5RTI/UotegPIJfJI/AAAAAAAAAhg/9HN-xFYQUQI/s1600/wc4.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-zvnOgmu5RTI/UotegPIJfJI/AAAAAAAAAhg/9HN-xFYQUQI/s320/wc4.PNG" height="259" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-F9AIqhjd5uw/Uotemq9JtsI/AAAAAAAAAho/1jHKDaNMwwQ/s1600/wc5.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-F9AIqhjd5uw/Uotemq9JtsI/AAAAAAAAAho/1jHKDaNMwwQ/s320/wc5.PNG" height="259" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-9XrzT5WnnpM/UoteznWXAcI/AAAAAAAAAhw/Y7OuL-EyKY4/s1600/wc6.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-9XrzT5WnnpM/UoteznWXAcI/AAAAAAAAAhw/Y7OuL-EyKY4/s320/wc6.PNG" height="259" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-CliSRoY8Zf8/Uote5441UgI/AAAAAAAAAh4/bZ4p2IjmTqc/s1600/wc7.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-CliSRoY8Zf8/Uote5441UgI/AAAAAAAAAh4/bZ4p2IjmTqc/s320/wc7.PNG" height="259" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-QcWkfI8Y3-w/UotfBT7iGoI/AAAAAAAAAiA/5RoKtAgH_E8/s1600/wc8.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-QcWkfI8Y3-w/UotfBT7iGoI/AAAAAAAAAiA/5RoKtAgH_E8/s320/wc8.PNG" height="259" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">After the installation there will be one Oracle_ECM1 folder created under Oracle Middleware.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-fyOKP1BWNZc/Uotfn0rW44I/AAAAAAAAAiI/74DS3swQJ4w/s1600/wc25.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-fyOKP1BWNZc/Uotfn0rW44I/AAAAAAAAAiI/74DS3swQJ4w/s1600/wc25.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<span style="font-size: large;">
<b style="font-family: Georgia, 'Times New Roman', serif;">Step 4: </b><b><span style="font-family: Georgia, Times New Roman, serif;">Create WebCenter Content Domain</span></b></span><br />
<span style="font-size: large;"><b><span style="font-family: Georgia, Times New Roman, serif;"><br /></span></b></span>
<span style="font-size: large;"><span style="font-family: Georgia, Times New Roman, serif;">In this step one domain for WebCenter Content will be created. Use the following command to start Conifguration Wizard.</span></span><br />
<span style="font-size: large;"><b><span style="font-family: Georgia, Times New Roman, serif;"><br /></span></b></span>
<br />
<pre class="prettyprint linenums">C:\Oracle\Middleware\Oracle_ECM1\common\bin\config.cmd</pre>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-efbgOZdLlYY/Uotf1X54n6I/AAAAAAAAAiQ/h68pPhF95Hk/s1600/wc9.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-efbgOZdLlYY/Uotf1X54n6I/AAAAAAAAAiQ/h68pPhF95Hk/s320/wc9.PNG" height="230" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Choose the products: WebCenter Content and WebCenter Imaging.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-TeuTubjrVqw/Uotf6oNf_hI/AAAAAAAAAiY/LVafkfTb-3c/s1600/wc10.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-TeuTubjrVqw/Uotf6oNf_hI/AAAAAAAAAiY/LVafkfTb-3c/s320/wc10.PNG" height="230" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">The domain name is: ecm_domain.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-GZZoLG0YZs4/Uotf_Ys1IpI/AAAAAAAAAig/khzhlxtC8TE/s1600/wc11.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-GZZoLG0YZs4/Uotf_Ys1IpI/AAAAAAAAAig/khzhlxtC8TE/s320/wc11.PNG" height="230" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">User name: weblogic and password: welcome1</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-EFeX-VTSffQ/UotgEvmHOrI/AAAAAAAAAio/JthnHm5J23M/s1600/wc12.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-EFeX-VTSffQ/UotgEvmHOrI/AAAAAAAAAio/JthnHm5J23M/s320/wc12.PNG" height="230" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-XPTNPRmJThA/UotgKCyms8I/AAAAAAAAAiw/nS3p5Sd54wY/s1600/wc13.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-XPTNPRmJThA/UotgKCyms8I/AAAAAAAAAiw/nS3p5Sd54wY/s320/wc13.PNG" height="230" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Change the schema owner name if they are not correct.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-GWe0w9Uj0gU/UotgPR9OTEI/AAAAAAAAAi4/NjwJ4n7Ei5k/s1600/wc14.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-GWe0w9Uj0gU/UotgPR9OTEI/AAAAAAAAAi4/NjwJ4n7Ei5k/s320/wc14.PNG" height="230" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-nvF-HYYUxww/UotgUwbiiWI/AAAAAAAAAjA/rjhH2gCfT3Y/s1600/wc15.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-nvF-HYYUxww/UotgUwbiiWI/AAAAAAAAAjA/rjhH2gCfT3Y/s320/wc15.PNG" height="230" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-uzt38BdpSng/UotgZzkzZPI/AAAAAAAAAjI/YPXI2h54pGU/s1600/wc16.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-uzt38BdpSng/UotgZzkzZPI/AAAAAAAAAjI/YPXI2h54pGU/s320/wc16.PNG" height="230" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-8tECDRMVu9Q/UotgfkoiKGI/AAAAAAAAAjQ/285ns60Jtgo/s1600/wc17.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-8tECDRMVu9Q/UotgfkoiKGI/AAAAAAAAAjQ/285ns60Jtgo/s320/wc17.PNG" height="230" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-VzIUFx5S6Nc/Uotgk4P20aI/AAAAAAAAAjY/TFBAskIUElk/s1600/wc18.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-VzIUFx5S6Nc/Uotgk4P20aI/AAAAAAAAAjY/TFBAskIUElk/s320/wc18.PNG" height="230" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Create the cluster whose name is: WCC_Cluster.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-P1rhxxhqlqg/Uotgye5hzrI/AAAAAAAAAjo/NiBGdp39lMY/s1600/wc19.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-P1rhxxhqlqg/Uotgye5hzrI/AAAAAAAAAjo/NiBGdp39lMY/s320/wc19.PNG" height="230" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-dt1r4ebjon0/Uotg7akJ7HI/AAAAAAAAAjw/PNvGiW8dmKQ/s1600/wc20.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-dt1r4ebjon0/Uotg7akJ7HI/AAAAAAAAAjw/PNvGiW8dmKQ/s320/wc20.PNG" height="230" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Create the machine whose name is: LocalMachine.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-WuT55VxNvtM/UothA2mIGoI/AAAAAAAAAj4/gvDsqXJWlwA/s1600/wc21.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-WuT55VxNvtM/UothA2mIGoI/AAAAAAAAAj4/gvDsqXJWlwA/s320/wc21.PNG" height="230" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-_e-RnkyZvvg/UothFqbEYSI/AAAAAAAAAkA/cRAcF22pcbM/s1600/wc22.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-_e-RnkyZvvg/UothFqbEYSI/AAAAAAAAAkA/cRAcF22pcbM/s320/wc22.PNG" height="230" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-2sgmEb4g_fE/UothMI2GaXI/AAAAAAAAAkI/qiYUDcyuiWI/s1600/wc23.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-2sgmEb4g_fE/UothMI2GaXI/AAAAAAAAAkI/qiYUDcyuiWI/s320/wc23.png" height="230" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-_j8y_Vz4z4Y/UothQ1A-egI/AAAAAAAAAkQ/e5czSAb2R88/s1600/wc24.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-_j8y_Vz4z4Y/UothQ1A-egI/AAAAAAAAAkQ/e5czSAb2R88/s320/wc24.png" height="230" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-XuKWqNIu7KU/Uowq_1z5ZPI/AAAAAAAAAkg/DpKH4ZknrCo/s1600/wc26.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-XuKWqNIu7KU/Uowq_1z5ZPI/AAAAAAAAAkg/DpKH4ZknrCo/s320/wc26.png" height="57" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<span style="font-size: large;"><b style="font-family: Georgia, 'Times New Roman', serif;">Step 5: </b><b><span style="font-family: Georgia, Times New Roman, serif;">Start WebCenter Content 11g</span></b></span><br />
<span style="font-size: large;"><b><span style="font-family: Georgia, Times New Roman, serif;"><br /></span></b></span>
<span style="font-size: large;"><span style="font-family: Georgia, Times New Roman, serif;">Now WebCenter Content 11g can be started.</span></span><br />
<span style="font-size: large;"><span style="font-family: Georgia, Times New Roman, serif;">This command is used to start the Admin server.</span></span><br />
<br />
<pre class="prettyprint linenums">C:\Oracle\Middleware\user_projects\domains\ecm_domain\bin\startWebLogic.cmd</pre>
<span style="font-size: large;"><span style="font-family: Georgia, Times New Roman, serif;"><br /></span></span>
<span style="font-size: large;"><span style="font-family: Georgia, Times New Roman, serif;">These commands are used to start the managed servers.</span></span><br />
<br />
<pre class="prettyprint linenums">C:\Oracle\Middleware\user_projects\domains\ecm_domain\bin\startManagedWebLogic.cmd UCM_server1 http://localhost:7001
C:\Oracle\Middleware\user_projects\domains\ecm_domain\bin\startManagedWebLogic.cmd IPM_server1 http://localhost:7001
C:\Oracle\Middleware\user_projects\domains\ecm_domain\bin\startManagedWebLogic.cmd IBR_server1 http://localhost:7001</pre>
<br />
<br />
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span>Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com1tag:blogger.com,1999:blog-8487142701656203604.post-35113053103640908222013-09-27T06:23:00.002-07:002013-12-16T16:47:33.431-08:00Apply Authorization Policy to SOA Composite<span style="font-size: large;">This blog demonstrates how to use Oracle authorization policy to restrict the access to one SOA composite in Oracle SOA 11g.</span><br />
<span style="font-size: large;">In this example SOA composite is consisted of a simple BPEL component which is exposed as Web service. </span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">In order to protect the SOA composite from unauthorized access Oracle policy <i><span style="color: #0b5394;">oracle/binding_permission_authorization_policy</span></i> need to be applied the service of the SOA composite. This policy will ensure that the authenticated subject has the permission to access the resource specified in the policy. In Oracle the application policy defines the resource to be protected, the permission class which is used to check the permission. Here the permission class is: <i><span style="color: #0b5394;">oracle.wsm.security.WSFunctionPermission</span></i>. The application policy also associates the resource with the application role, user or group. So the only authenticated subject which belongs to the application roles can will be granted to permission to the resource.</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">The authenticated subject is the entity that has been authenticated. Thus before the authorization is applied the authentication is needed to apply first. So the authentication policy <i><span style="color: #0b5394;">oracle/wss_username_token_service_policy</span></i> is also required.</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">The user and group are defined in Oracle Weblogic Admin Console and the application policy and application role are defined in Enterprise Manager. The below diagram shows the the relationship:</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/--650dgkw6M0/UkUAWFeuH9I/AAAAAAAAAZk/OXLe1pLmmgc/s1600/owsm+security1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="108" src="http://2.bp.blogspot.com/--650dgkw6M0/UkUAWFeuH9I/AAAAAAAAAZk/OXLe1pLmmgc/s320/owsm+security1.png" width="320" /></a></div>
<br />
<br />
<span style="font-size: large;"><b>Create the User and Group in Oracle Administrator Console</b></span><br />
<span style="font-size: large;">Login into Oracle Weblogic Administrator console.</span><br />
<span style="font-size: large;">Go to Security Realm->myrealm->Users and Groups->Users->New</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-FWK4tmyjzCo/UkUYo1iU8mI/AAAAAAAAAZ0/i_wyYzlZUWU/s1600/Capture1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="248" src="http://3.bp.blogspot.com/-FWK4tmyjzCo/UkUYo1iU8mI/AAAAAAAAAZ0/i_wyYzlZUWU/s320/Capture1.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Type in your user name and password and click on OK button.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-8ygqajPCMSg/UkUZSQJa7lI/AAAAAAAAAZ8/QEOMtia811g/s1600/Capture2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="133" src="http://3.bp.blogspot.com/-8ygqajPCMSg/UkUZSQJa7lI/AAAAAAAAAZ8/QEOMtia811g/s320/Capture2.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Go to Security Realm->myrealm->Users and Groups->Groups->New</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-fM_kq93GTSA/UkUaf5v7PiI/AAAAAAAAAaI/q5v4JIEt_ks/s1600/Capture3.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="http://4.bp.blogspot.com/-fM_kq93GTSA/UkUaf5v7PiI/AAAAAAAAAaI/q5v4JIEt_ks/s320/Capture3.PNG" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="font-size: large;">Type in your group and click on OK button.</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-RvdV8N0ZeP4/UkUgOrtERbI/AAAAAAAAAaY/Py-x58tI8kM/s1600/Capture5.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="160" src="http://4.bp.blogspot.com/-RvdV8N0ZeP4/UkUgOrtERbI/AAAAAAAAAaY/Py-x58tI8kM/s320/Capture5.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<span style="font-size: large;">Go to Security Realm->myrealm->Users and Groups->Users. Then click on the user: premium and then click on Group tab.</span><br />
<span style="font-size: large;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-BqE0XZ59zzA/UkUl1SYqfJI/AAAAAAAAAao/Y0dQEYrwFfU/s1600/Capture6.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="120" src="http://3.bp.blogspot.com/-BqE0XZ59zzA/UkUl1SYqfJI/AAAAAAAAAao/Y0dQEYrwFfU/s320/Capture6.PNG" width="320" /></a></div>
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">Select the group CustomerManager and add to chosen. </span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-qJ4wveJGMJo/UkUmylcAj9I/AAAAAAAAAa0/KE1W64ro9MQ/s1600/Capture7.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="120" src="http://2.bp.blogspot.com/-qJ4wveJGMJo/UkUmylcAj9I/AAAAAAAAAa0/KE1W64ro9MQ/s320/Capture7.PNG" width="320" /></a></div>
<br />
<span style="font-size: large;">Click on OK button.</span><br />
<span style="font-size: large;"><br /></span>
<b style="font-size: x-large;">Create the Application Role in Enterprise Manager console</b><br />
<b style="font-size: x-large;"><br /></b>
<span style="font-size: large;">Login into Oracle Enterprise Manager console</span><br />
<span style="font-size: large;">Go to Farm_soa_domain->SOA and then right click on soa-infra and choose Security->Application Roles.</span><br />
<span style="font-size: large;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-cADCVYwFYbo/UkUvKtEcEhI/AAAAAAAAAbA/lWxbp1MB4CM/s1600/Capture8.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="116" src="http://4.bp.blogspot.com/-cADCVYwFYbo/UkUvKtEcEhI/AAAAAAAAAbA/lWxbp1MB4CM/s320/Capture8.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Click on Create... and then type in the group information.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-Hi0cGm_o2Nc/UkUzF2Nt2VI/AAAAAAAAAbM/LpLptly7tfg/s1600/Capture9.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="139" src="http://1.bp.blogspot.com/-Hi0cGm_o2Nc/UkUzF2Nt2VI/AAAAAAAAAbM/LpLptly7tfg/s320/Capture9.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">In Members click Add...</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-F0UT5vsWzac/UkU7W6r0PBI/AAAAAAAAAbc/OHv5sMWcPK4/s1600/Capture11.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="313" src="http://2.bp.blogspot.com/-F0UT5vsWzac/UkU7W6r0PBI/AAAAAAAAAbc/OHv5sMWcPK4/s320/Capture11.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Change the type as Group and then click Search button. Select the group: CustomerManager which is defined in Admin Console. Then click on OK button.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-BONzymqlSSg/UkU-TerocjI/AAAAAAAAAbo/NeezFt_8JjE/s1600/Capture12.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="161" src="http://1.bp.blogspot.com/-BONzymqlSSg/UkU-TerocjI/AAAAAAAAAbo/NeezFt_8JjE/s320/Capture12.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Click on Save button.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-KXEYm-fbRdo/UkU_QrV7IXI/AAAAAAAAAbw/Xr54Lptp0UI/s1600/Capture13.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="141" src="http://2.bp.blogspot.com/-KXEYm-fbRdo/UkU_QrV7IXI/AAAAAAAAAbw/Xr54Lptp0UI/s320/Capture13.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b style="font-size: x-large;">Create the Application Policy in Enterprise Manager console</b></div>
<div class="separator" style="clear: both; text-align: left;">
<b style="font-size: x-large;"><br /></b></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Go to Farm_soa_domain->SOA and then right click on soa-infra and choose Security->Application Policies.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-TCv73sOjU28/UkVAdCzaK5I/AAAAAAAAAb8/7tVb5DYTSBI/s1600/Capture14.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="111" src="http://3.bp.blogspot.com/-TCv73sOjU28/UkVAdCzaK5I/AAAAAAAAAb8/7tVb5DYTSBI/s320/Capture14.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Click on Create... </span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-size: large;"><a href="http://2.bp.blogspot.com/-P4rezYKtzSs/UkVBnTYTlSI/AAAAAAAAAcI/b_TQyL18aT4/s1600/Capture15.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="152" src="http://2.bp.blogspot.com/-P4rezYKtzSs/UkVBnTYTlSI/AAAAAAAAAcI/b_TQyL18aT4/s320/Capture15.PNG" width="320" /></a></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Click on Grantee->Add</span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-size: large;"><a href="http://2.bp.blogspot.com/-xO3ywV2pP6A/UkVCsRDwJMI/AAAAAAAAAcU/BLnHo1FrQKI/s1600/Capture16.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="236" src="http://2.bp.blogspot.com/-xO3ywV2pP6A/UkVCsRDwJMI/AAAAAAAAAcU/BLnHo1FrQKI/s320/Capture16.PNG" width="320" /></a></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Search Principal with type as Application Role and select the application role: CustomerManagerRole and then click on OK button.</span></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-znXFr56rHXo/UkVoEYKnO7I/AAAAAAAAAck/wq805SI3Y_c/s1600/Capture17.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="96" src="http://3.bp.blogspot.com/-znXFr56rHXo/UkVoEYKnO7I/AAAAAAAAAck/wq805SI3Y_c/s320/Capture17.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Click on Permissions->Add</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-ecM5PmRzE08/UkVpGdhAtoI/AAAAAAAAAcw/4XRZiT3VxgQ/s1600/Capture18.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="177" src="http://1.bp.blogspot.com/-ecM5PmRzE08/UkVpGdhAtoI/AAAAAAAAAcw/4XRZiT3VxgQ/s320/Capture18.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Click on Continue button. Type in oracle.wsm.security.WSFunctionPermission in Permission Class.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">and http://www.toic.com/customer/wsdl/UpdateCustomerService#update in Rescource Name and invoke in Permission Actions.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-MhKOnI8KR8Q/UkVrdJ1CQQI/AAAAAAAAAdE/dPbDovkt7Hw/s1600/Capture19.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="104" src="http://1.bp.blogspot.com/-MhKOnI8KR8Q/UkVrdJ1CQQI/AAAAAAAAAdE/dPbDovkt7Hw/s320/Capture19.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Click on Select button.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-TkmpBBV7d5I/UkVsBJFAB6I/AAAAAAAAAdM/faXB3IYxyH4/s1600/Capture20.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="152" src="http://3.bp.blogspot.com/-TkmpBBV7d5I/UkVsBJFAB6I/AAAAAAAAAdM/faXB3IYxyH4/s320/Capture20.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Click on OK button.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-YdLwtJdelu8/UkVskDHOs2I/AAAAAAAAAdY/faiWtCAakyw/s1600/Capture21.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="167" src="http://1.bp.blogspot.com/-YdLwtJdelu8/UkVskDHOs2I/AAAAAAAAAdY/faiWtCAakyw/s320/Capture21.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<b style="font-size: x-large;">Add the policies to the service of SOA composite in JDeveloper</b></div>
<div class="separator" style="clear: both; text-align: left;">
<b style="font-size: x-large;"><br /></b></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">In JDeveloper right click on the service of the SOA composite and choose the menu item Configure WS Policies...</span></div>
<div class="separator" style="clear: both; text-align: left;">
<b style="font-size: x-large;"><br /></b></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-DDkMde3T20M/UkV8Vud3q7I/AAAAAAAAAdo/ap2tG6k5dhI/s1600/Capture22.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="121" src="http://2.bp.blogspot.com/-DDkMde3T20M/UkV8Vud3q7I/AAAAAAAAAdo/ap2tG6k5dhI/s320/Capture22.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Click on add icon of Security to add </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-ZGONeTi5R0I/UkV_vTO0juI/AAAAAAAAAeI/CkX2l1KSYBI/s1600/Capture24.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="175" src="http://3.bp.blogspot.com/-ZGONeTi5R0I/UkV_vTO0juI/AAAAAAAAAeI/CkX2l1KSYBI/s320/Capture24.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Choose oracle/binding_permission_authorization_policy and then click on OK button.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Do the same to add the oracle/wss_username_token_service_policy.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-8h8hEHzUkgk/UkWAqaEOjFI/AAAAAAAAAeQ/keBmtB1yITQ/s1600/Capture23.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://2.bp.blogspot.com/-8h8hEHzUkgk/UkWAqaEOjFI/AAAAAAAAAeQ/keBmtB1yITQ/s320/Capture23.PNG" width="288" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Then click on OK button. </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Deploy the SOA composite to the SOA server.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<b style="font-size: x-large;">Test the authorization using soapUI</b></div>
<div class="separator" style="clear: both; text-align: left;">
<b style="font-size: x-large;"><br /></b></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">The first message is the one with right user name and password: premium/welcome1 which is set up in Oracle Admin console.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />
<pre class="prettyprint linenums"><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://www.toic.com/customer">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>premium</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">welcome1</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<cus:UpdateCustomerRequest>
<cus:CustomerID>1234567</cus:CustomerID>
</cus:UpdateCustomerRequest>
</soapenv:Body>
</soapenv:Envelope>
</pre>
<span style="font-size: large;">The SOA composite will be successfully invoked. The response message comes back correctly without authorization error.</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">
</span>
<span style="font-size: large;">If the user name/password is changed to weblogic/welcome1 which is valid user set up in Oracle Weblogic Admin console. But this user doesn't belong to the application role which has the permission to invoke the SOA composite in the policy.</span>
<span style="font-size: large;">
</span>
<span style="font-size: large;">Now the response message shows that the authorization is not successful.</span>
<br />
<pre class="prettyprint linenums"><env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<env:Fault xmlns:ns0="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<faultcode>ns0:FailedAuthorization</faultcode>
<faultstring>FailedAuthorization : failure in authorization</faultstring>
<faultactor/>
</env:Fault>
</env:Body>
</env:Envelope>
</pre>
Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com7tag:blogger.com,1999:blog-8487142701656203604.post-90352120845460385402013-08-21T16:05:00.001-07:002013-09-27T06:27:13.794-07:00Use logical directory path in File Adapter<span style="font-size: large;">Oracle SOA File adapter provides both physical and logical directory path in configuring File adapter. By its name the physical path is the physical path of the server. Obviously it is not so flexible to use physical path in the design time. Logical path provides advantages over the physical path. Firstly you can deploy the same composite into the various environments where the actual physical path may be different. For example in development environment the path is /u90/uminput while in the production the path is /u100/shared/uminput. Also with logical path you can change the physical path during the runtime without redeployment. </span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;"><b>Set logical path in FILE Adapter Configuration Wizard</b> </span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">The first step is to select to use logical path when configuring the file adapter as shown in the below. Here XML_FILE_PATH is the logical name of the directory path for the File adapter.
</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-W3a76_fCzm4/UhVGwKb2AQI/AAAAAAAAAYw/lVLM7AZRiLI/s1600/File+Adapter+1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-W3a76_fCzm4/UhVGwKb2AQI/AAAAAAAAAYw/lVLM7AZRiLI/s320/File+Adapter+1.png" /></a></div>
<br />
<span style="font-size: large;"><b><br /></b></span>
<span style="font-size: large;"><b>composite.xml </b></span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">After the configuration the file adapter using File Adapter Wizard there will one property called XML_FILE_PATH for the service in composite.xml.
</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-bppXpatGwHc/UhVG9hIVuPI/AAAAAAAAAY4/JqYrEey1bb8/s1600/File+Adapter+2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-bppXpatGwHc/UhVG9hIVuPI/AAAAAAAAAY4/JqYrEey1bb8/s320/File+Adapter+2.png" /></a></div>
<span style="font-size: large;"><b><br /></b></span>
<span style="font-size: large;"><b>cfgplan.xml</b> </span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">For each environment the different value can be set for the property XML_FILE_PATH in the configuration plan. The value is the actual physical path in the environment.
</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-Se0IZMG9ss4/UhVHCxI6LtI/AAAAAAAAAZA/xW1PwApSwKk/s1600/File+Adapter+3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-Se0IZMG9ss4/UhVHCxI6LtI/AAAAAAAAAZA/xW1PwApSwKk/s320/File+Adapter+3.png" /></a></div>
<br />
<span style="font-size: large;"><b>Enterprise Manager Console</b> </span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">Also the value for XML_FILE_PATH can be set at runtime by using Enterprise Manager Console as shown in below.
</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-gVYW-lYTlBk/UhVIEiv0kQI/AAAAAAAAAZU/I4a6q8-wBS0/s1600/File+Adapter+4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="133" src="http://2.bp.blogspot.com/-gVYW-lYTlBk/UhVIEiv0kQI/AAAAAAAAAZU/I4a6q8-wBS0/s320/File+Adapter+4.png" width="320" /></a></div>
<span style="font-size: large;"><br /></span>
<span style="font-size: large;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com0tag:blogger.com,1999:blog-8487142701656203604.post-80973142763921452162013-07-17T18:45:00.000-07:002013-09-27T06:26:33.683-07:00File Adapter in Oracle SOA 11g cluster environmentA couple days ago I had an issue with Oracle SOA Adapter in cluster environment. File Adapter is used as inbound file reader in the composite. It works fine with the development environment which is single node. The issue is that the file will be read twice, each time by a File Adapter instance on one cluster node. <br />
<br />
From the search for the solution of this issue there are two ways to tackle this problem:<br />
<br />
1. Use Singleton property for the inbound endppoint for SOA composite. <br />
To enable this just add singletom property to composite.xml.<br />
<br />
<pre class="prettyprint linenums">
<service name="InvoiceXMLReader" ui:wsdlLocation="InvoiceXMLReader.wsdl">
<interface.wsdl interface="http://xmlns.oracle.com/pcbpel/adapter/file/EInvoiceProcessing/InvoiceXMLReader/InvoiceXMLReader#wsdl.interface(Read_ptt)"/>
<binding.jca config="InvoiceXMLReader_file.jca">
<b><i><span style="color: red;"><property name="singleton">true</property></span></i></b>
</binding.jca>
</service>
</pre>
<br />
<br />
<br />
2. To use HAFielAdapter for File Adapter.<br />
<br />
Thus in the .jca fiel change to use eis/HAFileAdapter instead of eis/FileAdapter.<br />
<br />
<pre class="prettyprint linenums">
<adapter-config name="InvoiceXMLReader" adapter="File Adapter" wsdlLocation="InvoiceXMLReader.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
<connection-factory UIexcludeWildcard="*.tif;*.lock" <b>location="<i><span style="color: #cc0000;">eis/HAFileAdapter</span></i>"</b> UIincludeWildcard="*.*"/>
<endpoint-activation portType="Read_ptt" operation="Read">
<activation-spec className="oracle.tip.adapter.file.inbound.FileActivationSpec">
<property name="DeleteFile" value="false"/>
<property name="MinimumAge" value="0"/>
<property name="PhysicalDirectory" value="/u01/shared/einvoice"/>
<property name="Recursive" value="true"/>
<property name="PollingFrequency" value="10"/>
<property name="IncludeFiles" value=".*\..*"/>
<property name="UseHeaders" value="false"/>
<property name="ExcludeFiles" value=".*\.tif;.*\.lock"/>
</activation-spec>
</endpoint-activation>
</adapter-config>
</pre>
<br />
Behind HAFileAdapter is the database used as mutex to ensure the one file is only handled by one instance. By default it uses jdbc/SOADataSource. When using HAFileAdapter in OSB this jdbc/SOADataSource should also target the OSB server nodes as well.<br />
This also invovles some configuration changes for File Adapter. You need to set Deployments->File Adapter->Configuration->Outbound Connection Pools->javax.resource.cci.ConnectionFactory->eisHAFileAdapter->controlDir to some shared localtion.<br />
<br />
To my understanding the first way is to force to seralize the inbound file processing, which means only one File Adapter is processing a file at one time. HAFileAdapter is using some mutex to ensure one file is only processed by one FileAdapter instance. But the multiple HAFileAdapter can process the different file at the same time. So this is the real solution for high availability environment. <br />
<div>
<br /></div>
Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com2tag:blogger.com,1999:blog-8487142701656203604.post-30420489298616770182013-07-15T16:38:00.001-07:002013-09-27T06:26:11.711-07:00Comparison of XSLT and XQuery<span style="font-size: large;">Recently I am working on one project which gets involved in transforming a large XML document in Oracle SOA Suite 11g. Initially this transformation is done using XSLT. We did the end-to-end testing with a large payload and noticed that the XSLT transformation took the most of the message processing time. Later someone suggests that with large payload XQuery is more efficient than XSLT. So we decided to implement the same transformation using XQuery. The comparison result is a bit surprise to me. </span>
<br />
<pre class="prettyprint linenums">
<ein:ProcessRequest>
<ein:DocumentID>4.IPM_013407</ein:DocumentID>
<ein:InvoiceNumber>12345</ein:InvoiceNumber>
<ein:InvoiceType>PO</ein:InvoiceType>
<ein:InvoiceDescription>LYRECO JUN 2013</ein:InvoiceDescription>
<ein:SupplierName>LYRECO PTY LTD</ein:SupplierName>
<ein:SupplierSiteName>E-INVOICE</ein:SupplierSiteName>
<ein:POInvoice>
<ein:POInvoiceItems>
<ein:InvoiceNo>2331940908</ein:InvoiceNo>
<ein:Amount>195.42</ein:Amount>
<ein:GSTAmount>17.77</ein:GSTAmount>
<ein:InvoiceDate>2013-05-01</ein:InvoiceDate>
<ein:Description>Some description text</ein:Description>
<ein:Quantity>1</ein:Quantity>
<ein:UnitPrice>195.42</ein:UnitPrice>
<ein:ExpenseType>STATIONERY</ein:ExpenseType>
<ein:ProjectNumber>200363</ein:ProjectNumber>
<ein:TaskNumber>11040</ein:TaskNumber>
<ein:ExpenditureType>Office Supplies</ein:ExpenditureType>
</ein:POInvoiceItems>
............
</ein:POInvoice>
<ein:ProcessRequest>
</pre>
<pre class="prettyprint linenums"></pre>
<span style="font-size: large;">Firstly I tried the transformation of a XML message like the above but with over 2700 <POInvoiceItems> elements using XMLSpy. The result shows XQuery is much faster than XSLT when transforming this message. Roughly XQuery is 3~4 times faster. </span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">Then I put these two transformations into one Oracle SOA application respectively and invoke the application with the same large message payload. The comparison show that under Oracle Weblogic environment there is no obvious difference between XQuery and XSLT and XSLT is even faster than XQuery. I am not quite sure what cause the different results using XMLSpy and Oracle Weblogic. Maybe it is related to the implementation of XQuery and XSLT enegines within XMLSpy and Oracle Weblogic.</span>Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com3tag:blogger.com,1999:blog-8487142701656203604.post-58435106916204709102013-07-15T16:06:00.002-07:002013-09-27T06:25:39.279-07:00BigNumber vs Double<span style="font-size: large;">Recently I worked on one project which involved using JAXB to generate XML message fro the excel file. Some data in the file are financial amount and tax amount. When it is read from the excel it is represented as the floating number. However in the generated XML message these data occurs to have something like the below:</span><br />
<span style="font-size: large;"><br /></span>
<br />
<pre class="prettyprint linenums"> <GSTAmount>26.789999999999999999999999999967899</GSTAmount></pre>
<br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">In schema GSTAmount is defined as xsd:decimal and the rounding is done before marshaling by JAXB. I did some serach using Google and learned some tips when dealing with financial amount in Java.</span><br />
<span style="font-size: large;"><br /></span>
<br />
<ol>
<li><span style="font-size: large;">Use BigDecimal rather than double when defining the financial amount.</span></li>
<li><span style="font-size: large;">When using BigDecimal use its string conductor.</span></li>
</ol>
<div>
<span style="font-size: large;">Here is the excellent link which explains this issue very clearly. </span><a href="http://www.opentaps.org/docs/index.php/How_to_Use_Java_BigDecimal:_A_Tutorial"><span style="font-size: large;">How to Use Java BigDecimal: A Tutorial</span></a></div>
Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com0tag:blogger.com,1999:blog-8487142701656203604.post-26561442136782768492013-06-18T19:32:00.002-07:002013-06-18T19:32:55.555-07:00 Use ROWNUM in PL/SQL<br />
<ol>
<li><span style="font-family: Georgia, Times New Roman, serif; font-size: large;">ROWNUM is a pseudo column. It acts like a column but it doesn’t exist in a real table. It only exists in the result set returned from a query. </span></li>
<li><span style="font-family: Georgia, Times New Roman, serif; font-size: large;"> ROWNUM numbers the records in a result set. The first record is assigned 1 to ROWNUM and it always starts from 1. Each subsequent record is assigned incrementally. </span></li>
<li><span style="font-family: Georgia, Times New Roman, serif; font-size: large;"> ROWNUM assignment is done after the select statement returns the result set and before the result set is ordered.</span></li>
</ol>
<div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;">Here are some examples that demonstrate how to use ROWNUM correctly.</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: large;"><br /></span></div>
<br />
<div>
<span style="font-size: large;"><span style="font-family: Georgia, Times New Roman, serif;">Example 1:</span> </span></div>
<div>
<span style="font-size: large;"><br /></span></div>
<div>
<span style="font-size: large;"></span><br />
<div>
<span style="font-size: large;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><i>select * from pa_tasks where task_name = 'ICT Costs'</i></span></span></div>
<span style="font-size: large;">
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><i><br /></i></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-yZEnfqJ8m6c/UcEXmAMjTII/AAAAAAAAAXs/omWIO4pG_yY/s1600/ROWNUM+1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="135" src="http://3.bp.blogspot.com/-yZEnfqJ8m6c/UcEXmAMjTII/AAAAAAAAAXs/omWIO4pG_yY/s320/ROWNUM+1.png" width="320" /></a></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><i><br /></i></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;">This is a normal query which returns the row without order.</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;">Example 2:</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> </span></div>
<div style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">
<br /></div>
<div style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">
<i>select rownum, TASK_ID, PROJECT_ID, TASK_NUMBER, CREATION_DATE from pa_tasks where task_name = 'ICT Costs'</i></div>
</div>
<div style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-uLVKto923ls/UcEXr20yUGI/AAAAAAAAAX0/kYP2wuLRqFs/s1600/ROWNUM+2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="192" src="http://4.bp.blogspot.com/-uLVKto923ls/UcEXr20yUGI/AAAAAAAAAX0/kYP2wuLRqFs/s320/ROWNUM+2.png" width="320" /></a></div>
<div style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">
<br /></div>
<div style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">
<br /></div>
<div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;">This is a normal query but with rownum displayed as the part of the result set.</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;">Example 3:</span></div>
<div>
</div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">select * from pa_tasks where task_name = 'ICT Costs' order by task_id;</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-30jzdwQDukk/UcEXxb2oxOI/AAAAAAAAAX8/4tvgiRQlIJI/s1600/ROWNUM+3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="135" src="http://3.bp.blogspot.com/-30jzdwQDukk/UcEXxb2oxOI/AAAAAAAAAX8/4tvgiRQlIJI/s320/ROWNUM+3.png" width="320" /></a></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;">This is a normal query with ordering by TASK_ID.</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;">Example 4:</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><i>select * from pa_tasks where task_name = 'ICT Costs' and rownum <= 3 order by task_id;</i></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-EVDQgQUlEdM/UcEX0qvIZoI/AAAAAAAAAYE/cDNfy9QUGeI/s1600/ROWNUM+4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="61" src="http://4.bp.blogspot.com/-EVDQgQUlEdM/UcEX0qvIZoI/AAAAAAAAAYE/cDNfy9QUGeI/s320/ROWNUM+4.png" width="320" /></a></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;">This query tries to select the first 3 rows of the result set ordered by TASK_ID. From the result shown above it doesn’t do what is expected to do. Because ordering happens after the ROWNUM is assigned.</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;">The correct way is using subquery as shown in example 5.</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;">Example 5:</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><i>select * from (select * from pa_tasks where task_name='ICT Costs' order by task_id) where rownum <= 3;</i></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-6acxqnc9Ms4/UcEX7QDXflI/AAAAAAAAAYM/r_Vqd5A6xFs/s1600/ROWNUM+5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="61" src="http://1.bp.blogspot.com/-6acxqnc9Ms4/UcEX7QDXflI/AAAAAAAAAYM/r_Vqd5A6xFs/s320/ROWNUM+5.png" width="320" /></a></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;">Example 6:</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><i>select * from pa_tasks where task_name = 'ICT Costs' and rownum > 3</i></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-F4d8w1Hc0Zs/UcEYAxnqLMI/AAAAAAAAAYU/lz97SwGHrGw/s1600/ROWNUM+6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="61" src="http://2.bp.blogspot.com/-F4d8w1Hc0Zs/UcEYAxnqLMI/AAAAAAAAAYU/lz97SwGHrGw/s320/ROWNUM+6.png" width="320" /></a></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;">This query tries to select rows starts from 4. But unfortunately no records will be selected from the query because rownum > 3 contradicts with rownum must start with 1. So when using rownum in where clause always use it with “<” or “<=”.</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;">In order to achieve what is expected the correct way to do is use the subquery where rownum is assigned and displayed as the field value.</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;">Example 7:</span></div>
<div>
<span style="font-family: Georgia, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><i>select * from (select rownum r, TASK_ID, PROJECT_ID, TASK_NUMBER, CREATION_DATE from pa_tasks where task_name = 'ICT Costs') where r > 3</i></span></div>
</div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><i><br /></i></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-uXIc_DUqdBY/UcEYF2KGwJI/AAAAAAAAAYc/nyy6R5dYfSo/s1600/ROWNUM+7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="190" src="http://1.bp.blogspot.com/-uXIc_DUqdBY/UcEYF2KGwJI/AAAAAAAAAYc/nyy6R5dYfSo/s320/ROWNUM+7.png" width="320" /></a></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><i><br /></i></span></div>
<div style="font-family: Georgia, 'Times New Roman', serif;">
<br /></div>
</span></div>
Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com1tag:blogger.com,1999:blog-8487142701656203604.post-92054555881530543102013-04-08T05:11:00.000-07:002013-04-08T05:14:37.067-07:00Use preceding-sibling to find all unique elementsRecently I need to write a xpath expression to find all unique elements from one XML message. The below is the simplified XML document that demonstrate the problem to be solved. Here I want to get a list of all unique of all a elements. The of values in the result list should be 123, 120, 129,345 and 340.<br />
<br />
<pre class="prettyprint linenums"><?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy v2008 sp1 (http://www.altova.com)-->
<db:p>
<span class="Apple-tab-span" style="white-space: pre;"> </span><db:ss>
<span class="Apple-tab-span" style="white-space: pre;"> </span><db:tt>
<span class="Apple-tab-span" style="white-space: pre;"> </span><db:a>123</db:a>
<span class="Apple-tab-span" style="white-space: pre;"> </span><db:a>120</db:a>
<span class="Apple-tab-span" style="white-space: pre;"> </span></db:tt>
<span class="Apple-tab-span" style="white-space: pre;"> </span><db:tt>
<span class="Apple-tab-span" style="white-space: pre;"> </span><db:a>123</db:a>
<span class="Apple-tab-span" style="white-space: pre;"> </span><db:a>129</db:a>
<span class="Apple-tab-span" style="white-space: pre;"> </span></db:tt>
<span class="Apple-tab-span" style="white-space: pre;"> </span></db:ss>
<span class="Apple-tab-span" style="white-space: pre;"> </span><db:ss>
<span class="Apple-tab-span" style="white-space: pre;"> </span><db:tt>
<span class="Apple-tab-span" style="white-space: pre;"> </span><db:a>345</db:a>
<span class="Apple-tab-span" style="white-space: pre;"> </span><db:a>120</db:a>
<span class="Apple-tab-span" style="white-space: pre;"> </span><db:a>123</db:a>
<span class="Apple-tab-span" style="white-space: pre;"> </span><db:a>340</db:a>
<span class="Apple-tab-span" style="white-space: pre;"> </span></db:tt>
<span class="Apple-tab-span" style="white-space: pre;"> </span></db:ss>
</db:p>
</pre>
<br />
After some tries I come out with the following xpath expression.<br />
<br />
<pre class="prettyprint linenums">/*:p/*:ss/*:tt/*:a[ not(. = ../preceding-sibling::*/*:a) and not(. = ../../preceding-sibling::*/*:tt/*:a)]
</pre>
<br />
Here I use two preceding-sibling because <a> element is under <ss> and <tt> elements.Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com0tag:blogger.com,1999:blog-8487142701656203604.post-66713578560355005382013-02-26T04:36:00.000-08:002013-02-26T04:37:22.414-08:00GlassFish Clustering Setup<br />
<h3>
1. Detailed steps to create the domain, cluster and clustered instances in Glassfish</h3>
<br />
It is assumed that one cluster is created across two servers: un128desb1, un128desb2. Within the cluster there are two instances that will reside in un128desb1 and un128desb2 respectively.<br />
<br />
asadamin commands must be executed in the user name of jcaps.<br />
<br />
<br />
<h4>
1.1 Steps to create domain with cluster profile and start the domain on the server un128desb1</h4>
<div>
1) Execute the asadmin command: create-domain on un128desb1</div>
<div>
<br /></div>
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin create-domain \
--portbase $PORTBASE \
--user $ADMIN_USER_NAME \
--passwordfile $PASSWORD_FILE \
--profile cluster \
$DOMAIN_NAME
</pre>
<br />
where<br />
PORTBASE is base port number for this domain<br />
ADMIN_USER_NAME is the admin user name for this domain.<br />
PASSWORD_FILE is the name of the password file which contains the admin password for this domain.<br />
DOMAIN_NAME is the name of domain to be created.
<br />
<br />
<br />
2) Execute the asadmin command: start-domain on un128desb1<br />
<br />
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin start-domain \
--user $ADMIN_USER_NAME \
--passwordfile $PASSWORD_FILE \
$DOMAIN_NAME
</pre>
<br />
where ADMIN_USER_NAME is the admin user name for this domain.<br />
PASSWORD_FILE is the name of the password file which contains the admin password for this domain.<br />
DOMAIN_NAME is the name of domain to be created.<br />
<br />
<h4>
1.2 Steps to create node agent in one machine that has DAS</h4>
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin create-node-agent \
--host $HOST_NAME \
--port $ADMIN_PORT \
$NODE_NAME
</pre>
<br />
where<br />
HOST_NAME is the machine name where the new node agent will reside. Here it is un128desb1.
ADMIN_PORT is the admin port number. It is PORTBASE+48.<br />
NODE_NAME is the name of created node agent.<br />
<br />
2) After the command is executed successfully a new folder node1 is created /opt/JCAPS62/appserver/nodeagents/node1 on machine un128desb1.<br />
node 1 is the name of node agent
created.<br />
Also new created node agent is added into /opt/JCAPS62/appserver/domains/dmlusterUtilities/config/domain.xml in un128desb1 where DAS
resides.<br />
<br />
<br />
<node-agents><br />
<node-agent name="node1" ......><br />
</node-agent><br />
</node-agents><br />
<br />
<br />
After the node agent is created this node agent is not displayed on Admin console page until the node agent is started.<br />
<br />
3) Execute the asadmin command: start-node-agent<br />
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin start-node-agent \
--user $ADMIN_USER_NAME \
--password $PASSWORD_FILE \
$NODE_NAME
</pre>
<br />
where NODE_NAME is the name of node that is to be started.<br />
<br />
<br />
<h4>
1.3 Steps to create domain with cluster profile and start the domain on the server un128desb2</h4>
Creating one domain with cluster profile on un128desb2 is the same as on un128desb1. The command is executed on un128desb2<br />
<br />
<br />
<h4>
1.4 Steps to create node agent talked to DAS in remote machine on the server un128desb2</h4>
<div>
<div>
1) Execute the asadmin command: create-node-agent on un128desb2 (un128desb2 is the another machine where the created node agent will reside in)</div>
</div>
<div>
<br /></div>
<br />
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin create-node-agent \
--host $HOST_NAME \
--port $ADMIN_PORT \
--user $ADMIN_USER_NAME \
--password $PASSWORD_FILE \
$NODE_NAME
</pre>
<br />
where<br />
HOST_NAME is the machine that hosts DAS. Here it is un128desb1<br />
ADMIN_PORT is the admin port for this host.<br />
ADMIN_USER_NAME and PASSWORDFILE are the admin user name and admin password for the server where the node agent is created.
Here it is un128desb2.<br />
<br />
2) After the command is executed successfully
A new folder is created /opt/JCAPS62/appserver/nodeagents/node2 on machine un128desb2. node 2 is the name of the node agent
created.<br />
Also new created node agent is added into /opt/JCAPS62/appserver/domains/dmlusterUtilities/config/domain.xml in un128desb1 where DAS
resides.<br />
<br />
Note it is domain.xml on un128desb1 not un128desb2.<br />
<br />
<br />
<node-agents><br />
<node-agent name="node2" ....><br />
</node-agent><br />
</node-agents><br />
After the node agent is created this node agent is not displayed on Admin console page until the node agent is started.<br />
<br />
3) Execute the asadmin command: start-node-agent on un128desb2<br />
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin start-node-agent \
--user $ADMIN_USER_NAME \
--password $PASSWORD_FILE \
$NODE_NAME
</pre>
<br />
where ADMIN_USER_NAME, PASSWORD_FILE are the admin user name and the name of the password file for the host where DAS
resides.<br />
Here the host is un128desb2.<br />
<br />
After the command is executed successfully this node agent will be displayed on Admin Console on the host where DAS resides. Here it is
un128desb1.<br />
<br />
<br />
<br />
Figure2: Node agents from the AdmonConsole<br />
<br />
Note: There is no node agent displayed on Admin Console on the host un128desb2 since the created node agent: node5 is associated to DAS on un128desb1.<br />
<br />
<br />
<h4>
1.5 Steps to create cluster on un128desb1</h4>
1) Execute the asadmin command: create-cluster on the server un128desb1<br />
<br />
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin create-cluster \
--user $ADMIN_USER_NAME \
--passwordfile $PASSWORD_FILE \
--host $HOST_NAME \
--port $ADMIN_PORT \
$CLUSTER_NAME
</pre>
<br />
where<br />
HOST_NAME and ADMIN_PORT are the host name and admin port number for the host where cluster resides respectively. Here it
is un128desb1.<br />
ADMIN_USER_NAME and PASSWORDFILE are admin user and password file name for the host.
CLUSTER_NAME is the name of the cluster that is to be created.<br />
<br />
2) After the command is executed successfully one new cluster is displayed in Admin Console on un128desb1.<br />
<br />
Note: Since no configuration is specified when creating the cluster the new configuration called CLUSTER_NAME-config is created and is
used by the created cluster<br />
<br />
Figure3: Clusters from AdminConsole<br />
<br />
<br />
<h4>
1.6 Steps to create cluster instances on un128desb1</h4>
1) Execute the asadmin command: create-instance on un128desb1 to create instance 1 which resides on the machine where node agent node1 resides<br />
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin create-instance \
--user $ADMIN_USER_NAME \
--passwordfile $PASSWORD_FILE \
--host $HOST_NAME \
--port $ADMIN_PORT \
--nodeagent $NODE1_NAME \
--cluster $CLUSTER_NAME \
$INSTANCE1_NAME
</pre>
<br />
where<br />
HOST_NAME and ADMIN_PORT are the host name and admin port number.<br />
ADMIN_USER_NAME and PASSWORD_FILE are the user name and password file for the host
NODE1_NAME is the node agent that is used to manage the created instance.<br />
CLUSTER_NAME is the name of cluster to which the created instance belongs.<br />
INSTANCE1_NAME is the name of created instance.<br />
<br />
2) After the successful execution of this command a new folder is created /opt/JCAPS62/appserver/nodeagents/node1/instance1 on machine
un128desb1.<br />
From Admin Console on un128desb1 shows the new created cluster instance.<br />
<br />
<br />
<br />
Figure4: New created cluster instance from AdminConsole<br />
<br />
<h4>
1.7 Steps to create cluster instances on un128desb2</h4>
<br />
1) Execute the asadmin command: create-instance on un128desb1 to create instance 2 which resides on the remote machine: un128desb2<br />
<br />
Note: This command is executed on machine: un128desb1 rather than un128desb2. But the instance2 created resides on un128desb2<br />
<br />
<br />
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin create-instance \
--user $ADMIN_USER_NAME \
--passwordfile $PASSWORD_FILE \
--host $HOST_NAME \
--port $ADMIN_PORT \
--nodeagent $NODE2_NAME \
--cluster $CLUSTER_NAME \
$INSTANCE2_NAME
</pre>
<br />
where<br />
HOST_NAME and ADMIN_PORT are the host name and admin port number.<br />
ADMIN_USER_NAME and PASSWORD_FILR are the
user name and password file for the host.
NODE2_NAME is the node agent that is used to manage the created instance. Here NODE2_NAME resides on un128desb2.<br />
CLUSTER_NAME is the cluster to which the created instance belong to.<br />
INSTANCE2_NAME is the name of created instance.<br />
<br />
2) After the successful execution of this command a new folder is created /opt/JCAPS62/appserver/nodeagents/node5/instance2 on machine
un128desb2.<br />
From Admin Console on un128desb1 shows the new created cluster instance.<br />
<br />
<br />
Figure5: New Created Cluster Instance from AdminConsole<br />
<h4>
1.8 Steps to start the cluster on un128desb1</h4>
1) Execute the asadmin command: start-cluster on un128desb1 to start the cluster<br />
<br />
<br />
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin start-cluster \
--host $HOST_NAME \
--port $ADMIN_PORT \
--user $ADMIN_USER_NAME \
--passwordfile $PASSWORD_FILE \
$CLUSTER_NAME
</pre>
<br />
2) This command will take some time to finish. After the successful execution of this command the cluster and the instances within the
cluster will be started.<br />
From Admin Console on un128desb1 shows the new created cluster instance.<br />
<br />
Figure6: Started cluster from AdminConsole<br />
Figure7: Cluster instances within the cluster<br />
<br />
<br />
<h4>
1.9 Steps to delete the cluster instance</h4>
Instances can be deleted from AdminConsole or from asadmin command.<br />
<br />
1) Execute the asadmin command: delete-instance on un128desb1 to start the cluster<br />
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin delete-instance \
--user $ADMIN_USER_NAME \
--passwordfile $PASSWORD_FILE \
--host $HOST_NAME \
--port $ADMIN_PORT \
$INSTANCE_NAME \
</pre>
<br />
Where<br />
HOST_NAME and ADMIN_PORT are the host name and admin port number of the domain where the cluster resides.<br />
ADMIN_USER_NAME and PASSWORD_FILE are the user name and password file for the domain.
INSTANCE_NAME is the name of the instance to be deleted.<br />
<br />
2) Select the cluster instances to be deleted and then click on the Delete button to delete the selected instances<br />
<br />
<br />
Figure8 Selecting the cluster instance to be deleted from AdminConsole<br />
<h4>
1.10 Steps to delete the node agents</h4>
Node agents can be deleted from AdminConsole or from asadmin command.<br />
1) Execute the asadmin command: delete-nodeagent on un128desb1 to start the cluster<br />
<br />
<br />
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin delete-nodeagent \
$NODEAGENT_NAME
</pre>
<br />
where<br />
NODEAGENT_NAME is the name of node agent that is to be deleted.<br />
<br />
2) Select the node agent to be deleted and then click on the Delete button to delete the selected node agent.<br />
<br />
<br />
Figure9 Selecting the node agent to be deleted from AdminConsole<br />
<br />
<h3>
2 Create resources in a cluster</h3>
To create resources in a cluster is the same as to a standalone server. The only difference is to add one cluster from Available Targets as one of Selected Targets.<br />
<br />
<br />
<br />
Figure10: Selecting targets for deployed resources from AdminConsole<br />
<h3>
3 Deploy the applications to a cluster</h3>
To deploy the applications to a cluster is the same as to a standalone server. The only difference is to add one cluster as one of Selected Targets<br />
<br />
Figure11: Selecting targets for deployed applications from AdminConsole<br />
<br />
<br />
Note: When creating Oracle JDBC resources make sure the Oracle JDBC driver jar: ojdbc5.jar is in both GlassFish installation on the server machines.<br />
<br />
In the example ojdbc5.jar are located in the folder: /opt/JCAPS62/appserver/lib on the machines: un128desb1 and un128desb2.<br />
<br />
<br />
<h3>
4 Deploy ESB to a cluster</h3>
To deploy ESB (service assemblies, BC, service engines or shared libraries) to a cluster is the same as to a standalone server. The only<br />
difference is to add one cluster from Available Targets as one of Selected Targets.<br />
<h3>
5 Operation steps in a cluster</h3>
<h4>
5.1 Start and stop the node agents</h4>
In order to start the cluster and cluster instances the node agents associated with the cluster must be started first.<br />
Whether the instances are started when the node agent is started depends on the setting for the node agent.<br />
There is one checkbox in AdminConsole for each node: Start Instances On Startup. If it is checked when the node agent is started all instances associated with it will be started as well.<br />
<br />
<br />
Figure12: Node agent status from AdminConsole<br />
<br />
However when the node agent is stopped the instances associated with this node agent will be stopped as well.<br />
At the moment it seems there is no way to start the node agents from Admin Console. Node agents can be started by using the asadmin command:<br />
<br />
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin start-node-agent \
--user $ADMIN_USER_NAME \
--passwordfile $PASSWORD_FILE \
$NODE_NAME
</pre>
<br />
where<br />
ADMIN_USER_NAME and PASSWORD_FILR are the user name and password file for the host.
NODE_NAME is the node agent to be started.<br />
<br />
<br />
Figure13: Node agents from AdminConsole<br />
Likewise node agents can be stopped by using the asadmin command:<br />
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin stop-node-agent \
$NODE_NAME
</pre>
<br />
where<br />
NODE_NAME is the node agent to be stopped.<br />
<br />
<br />
<br />
Figure14: Node agent status from AdminConsole<br />
Note: start-node-agent command and stop-node-agent are executed on the machine where the node agent is associated with the host name. For example node 2 is associated with the host un128desb1 and node3 with the host un128desb2. In order to start and stop node2 the asadmin commands are executed on un128desb1 and to start and stop node3 the asadmin commands are executed on un128desb2.<br />
<br />
<br />
<h4>
5.2 Start and stop the cluster</h4>
After the node agents are started the cluster can be started and stopped. Whenever the cluster is started or stopped all instances within the cluster will be started or stoped.<br />
The cluster can be started and stopped from either AdminConsole or asadmin commands.<br />
From the Clusters page in AdminConsole select the cluster to be started or stopped then click on Start Cluster button if it is to start cluster or Stop Cluster button if it is to stop the cluster.<br />
<br />
<br />
Figure15: Start and stop of cluster from AdminConsole<br />
<br />
The cluster can be started by using the asadmin command:<br />
<br />
<br />
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin start-cluster \
--user $ADMIN_USER_NAME \
--passwordfile $PASSWORD_FILE \
--host $HOST_NAME \
--port $ADMIN_PORT \
$CLUSTER_NAME
</pre>
<br />
Where<br />
HOST_NAME and ADMIN_PORT are the host name and admin port number of the domain where the cluster resides.<br />
ADMIN_USER_NAME and PASSWORD_FILE are the user name and password file for the domain.
CLUSTER_NAME is the name of the instance to be stopped.<br />
<h4>
5.3 Start and stop the cluster instances </h4>
Each cluster instances can be started and stopped individually from either Admin Console or asadmin command.<br />
<br />
<br />
Figure16: Start and stop of one cluster instance from AdminConsole<br />
The cluster instance can be stopped by using the asadmin command:<br />
<br />
<br />
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin stop-instance \
--host $HOST_NAME \
--port $ADMIN_PORT \
--user $ADMIN_USER_NAME \
--passwordfile $PASSWORD_FILE \
$INSTANCE_NAME
</pre>
<br />
where<br />
HOST_NAME and ADMIN_PORT are the host name and admin port number of the domain where the instance resides.<br />
ADMIN_USER_NAME and PASSWORD_FILE are the user name and password file for the domain.
INSTANCE_NAME is the name of the instance to be started.<br />
<br />
The cluster instance can be stopped by using the asadmin command:<br />
<br />
<br />
<pre class="prettyprint linenums">/opt/JCAPS62/appserver/bin/asadmin start-instance \
--host $HOST_NAME \
--port $ADMIN_PORT \
--user $ADMIN_USER_NAME \
--passwordfile $PASSWORD_FILE \
$INSTANCE_NAME
</pre>
<br />
where<br />
HOST_NAME and ADMIN_PORT are the host name and admin port number of the domain where the instance resides.<br />
ADMIN_USER_NAME and PASSWORD_FILE are the user name and password file for the domain.Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com0tag:blogger.com,1999:blog-8487142701656203604.post-44731985063408254172013-02-24T06:10:00.000-08:002013-02-24T06:10:57.770-08:00Configure OSB 11g for Message-Level Security<a href="http://4.bp.blogspot.com/-vil0iw7AJOs/USoe7GOvS-I/AAAAAAAAAXQ/ktc03E_aJYA/s1600/OWSM+Security.png" imageanchor="1"><img border="0" height="210" src="http://4.bp.blogspot.com/-vil0iw7AJOs/USoe7GOvS-I/AAAAAAAAAXQ/ktc03E_aJYA/s400/OWSM+Security.png" width="400" /></a>Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com1tag:blogger.com,1999:blog-8487142701656203604.post-36704634713800633602013-02-21T19:30:00.001-08:002013-02-22T04:17:17.377-08:00Objects in JavaScript<span style="font-family: Times, "Times New Roman", serif; font-size: large;">In JavaScript all objects are equal by nature. This means that</span><br />
<span style="font-family: Times, "Times New Roman", serif; font-size: large;"></span><br />
<ul><span style="font-family: Times, "Times New Roman", serif; font-size: large;">
</span>
<li><span style="font-family: Times, "Times New Roman", serif; font-size: large;">There is no class difference in JavaScript objects. They are just objects and there is no class birth mark with them. In Java any object must belong to one class and it will always be so in its life cycle. </span></li>
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">
</span>
<li><span style="font-family: Times, "Times New Roman", serif; font-size: large;">JavaScript objects can change themselves dynamically. </span></li>
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">
</span></ul>
<span style="font-family: Times, "Times New Roman", serif; font-size: large;"></span><br />
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">Conceptually JavaScript object is the container of properties which are the name-value pair. The property value can be the primitive values, or other object(including the functions because they are also objects). Physically object is the structure that hold these properties of the object.</span><br />
<span style="font-family: Times, "Times New Roman", serif; font-size: large;"></span><br />
<h3>
Creation of Object</h3>
<span style="font-family: Times, "Times New Roman", serif; font-size: large;"></span><br />
<span style="font-size: large;"><span style="font-family: Times, "Times New Roman", serif;">So how a JavaScript come into life? There are several ways to do so. One
normal way is using constructor function. What is constructor function? <span style="mso-spacerun: yes;"> </span>Constructor function is a normal function but it
is invoked with the keyword <i>new</i>. <span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span>It is kind of magic.<span style="mso-spacerun: yes;"> </span>When the function is invoked in such way
three things will happen within the function: An object is created, <i>this</i> is
resolved for this new created object and the new object is returned even you
don't do so explicitly in the function. The below are two examples that use constructor functions to create a Car object. One is with named function and another with anonymous function. The results are the same.<o:p></o:p></span></span><br />
<pre class="prettyprint linenums">function Car(model, make, year) {
this.make = make;
this.model = model;
this.year = year;
}
var myCar1 = new Car('Honda', 'Accord', 2010);
</pre>
<br />
<pre class="prettyprint linenums">var Car = function (model, make, year) {<o:p></o:p>
this.make = make;
this.model = model;
this.year = year;
}
var myCar2 = new Car('Honda', 'Accord', 2010);
</pre>
<br />
<span style="font-size: large;"><span style="font-family: Times, "Times New Roman", serif;">But when this
function is invoked without the keyword <i>new</i>.<span style="mso-spacerun: yes;">
</span>The magic of object creation will not happen.</span><span style="mso-spacerun: yes;"> </span><o:p></o:p></span><br />
<br />
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">All objects in JavaScript are created with constructor function.<span style="mso-spacerun: yes;"> </span>With an object you can check its constructor
function using the below statement</span><o:p></o:p><br />
<br />
<pre class="prettyprint linenums">myObj.constructor<o:p></o:p></pre>
<br />
<span style="font-size: large;"><span style="font-family: Times, "Times New Roman", serif;">It will return the constructor function used to create the object. In above examples myCar1.constructor will return <i>Car()</i> function and myCar2 will return </span></span><span style="font-family: Times, 'Times New Roman', serif; font-size: large;">anonymous</span><span style="font-family: Times, 'Times New Roman', serif; font-size: large;"> function.</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: large;"><br /></span>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-size: large;"><span style="font-family: Times, "Times New Roman", serif;">Apart from using constructor function to create objects, JavaScript provides another way or shortcut to create the objects: Literal.<span style="mso-spacerun: yes;"> </span>The below are two examples of using literal to create objects.<o:p></o:p></span></span><br />
<span style="font-size: large;"><span style="font-family: Times, "Times New Roman", serif;"><br /></span></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
</div>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
</div>
<pre class="prettyprint linenums">var myCarLiteral = { make:'Honda',
model: 'Accord',
year: 2013};
</pre>
<div class="prettyprint linenums">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;">
<span style="font-size: large;"><span style="font-family: Times, "Times New Roman", serif;">Actually these creation are the same as we use the constructor functions. But if you check the constructor function of this object you will find that it is <i>function Object()</i>.<o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
</div>
<br />
<br />
<h3>
Operators Used to Check the Type of Objects</h3>
<div>
<br /></div>
<span style="font-family: Times, 'Times New Roman', serif; font-size: large;">There are two operators that can be used to check the type of the objects: <i>typeof </i>and <span style="font-style: italic;">instanceof</span>.</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: large;"><i>typeof </i>operator is used to return the type of object. It wil return the string that is the name of object type. For all objects it will return <i>object</i>. </span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: large;"> </span><span style="font-family: Times, 'Times New Roman', serif; font-size: large; font-style: italic;">instanceof </span><span style="font-family: Times, 'Times New Roman', serif; font-size: large;">is used to decide if an object is created from one constructor function. It will return a boolean value. </span><br />
<pre class="prettyprint linenums"> function Car(model, make, year) {
this.make = make;
this.model = model;
this.year = year;
}
var myCar1 = new Car('Honda', 'Accord', 2010);
var myCar3 = { make:'Honda',
model: 'Accord',
year: 2013};
console.log(myCar1 instanceof Car);
console.log(myCar3 instanceof Object);
console.log(typeof Car);
console.log(typeof myCar1);
console.log(typeof myCar3);
</pre>
<h3>
<span style="font-family: Times, 'Times New Roman', serif; font-size: large; font-weight: normal;">The above log output will be: <i>true, true, function, object, object</i>.</span></h3>
<div>
<span style="font-family: Times, 'Times New Roman', serif; font-size: large; font-weight: normal;"><br /></span></div>
<h3>
Built-in Objects or Native Objects</h3>
<div>
<br /></div>
<span style="font-family: Times, 'Times New Roman', serif; font-size: large;">The above examples arex custom-made constructor function.</span><span style="mso-spacerun: yes;"> </span><span style="font-family: Times, 'Times New Roman', serif; font-size: large;">Actually JavaScript provides many built-in
constructor functions already.</span>
<span style="mso-spacerun: yes;"> </span>
<span style="font-family: Times, 'Times New Roman', serif; font-size: large;">These
are: </span>
<span style="font-family: Times, 'Times New Roman', serif; font-size: large;"><i>Object(),Number(),String(),Array(),Function(),Date(),RegExp(),Error(). </i></span>
<span style="font-family: Times, 'Times New Roman', serif; font-size: large;">In these the most interesting one is
Object().</span><span style="mso-spacerun: yes;"> </span><span style="font-family: Times, 'Times New Roman', serif; font-size: large;">This is the root of all
JavaScript objects.</span><br />
<span style="font-family: Times, "Times New Roman", serif; font-size: large;"></span><br />
<span style="font-size: large;"><span style="font-family: Times, "Times New Roman", serif;">Here we can use Obect() to create myCar object which we create using custom
constructor function.<o:p></o:p></span></span><br />
<br />
<pre class="prettyprint linenums">var myCar = new Object();
myCar.make = "Honda";
myCar.model = "Accord";
myCar.yaer = 2013;
</pre>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">Here this myCar object actually
is the same as myCar using Car constructor function even the constructor functions
they use are different.<span style="mso-spacerun: yes;"> </span>But obviously
the customer constructor function is more convenient in creating multiple
instances sharing the same properties of Car.</span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
</div>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<br /></div>Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com0tag:blogger.com,1999:blog-8487142701656203604.post-32911803641044103982013-02-18T23:08:00.001-08:002013-02-18T23:08:49.989-08:00Recover from UKASH virus attackLast week my laptop unfortunately got infected with one kind of UKASH virus. It was really nasty. It loked up my machine. Whenever the lasptop is started this vrius will take over. It will display one warning page from AFP saying that you are violated some laws in Australia and you are fined A$100 if you have internet connection. If my lasptop has no access to the internet it will show one blank screen. It even turns on the cam in the laptop.<br />
<br />
I did some search with Google and found out that there are many useful information about this virus. I tried the several suggestions from this link: <a href="http://www.pcrisk.com/removal-guides/6984-remove-computer-locked-ukash-virus">http://www.pcrisk.com/removal-guides/6984-remove-computer-locked-ukash-virus</a>. It is very good and provides many useful suggestions. Many thanks to the author.<br />
<br />
First I tried to boot my machine with Safe Mode with Networking(Pressing key F8 during the stating process). It tured out that the UKASH virus I got affected seems smart enough. It will shutdown the machine automatically when trying Safe Mode with Networking.<br />
<br />
The next thing I tried is to boot the machine with Safe Mode with Command Prompt. It was successful. <br />
<br />
After that I did the system restore using the command: <br />
<br />
C:\Windows\system32>cd restore<br />
C:\Windows\system32\restore>rstrui.exe<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-wimpgliZKY0/USMilwZzxJI/AAAAAAAAAWg/6X-mIdONYgo/s1600/systemrestore1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="http://1.bp.blogspot.com/-wimpgliZKY0/USMilwZzxJI/AAAAAAAAAWg/6X-mIdONYgo/s320/systemrestore1.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: left;">
Click on Next button.</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-ALEZ1jVTdqg/USMi_s8DYlI/AAAAAAAAAWo/fC5e41f-LEU/s1600/systemrestore2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="http://1.bp.blogspot.com/-ALEZ1jVTdqg/USMi_s8DYlI/AAAAAAAAAWo/fC5e41f-LEU/s320/systemrestore2.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: left;">
Then I select one restore point since I knew when my laptop got affected. I chose the one that was before the affection time. Then click on Next button.</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-ZMUlddM29TQ/USMjxSEuGhI/AAAAAAAAAW0/Y7eeyLOhdMk/s1600/systemrestore3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="http://4.bp.blogspot.com/-ZMUlddM29TQ/USMjxSEuGhI/AAAAAAAAAW0/Y7eeyLOhdMk/s320/systemrestore3.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: left;">
Make sure the restore point is correct. Then click on Finish button. There is a confimation and warning popup and click on Yes button. Then system restore is started. It will take a while. </div>
<div class="separator" style="clear: both; text-align: left;">
After the system restore is done I boot my laptop again and this time it was successful to do so.</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com6tag:blogger.com,1999:blog-8487142701656203604.post-46364970023435187162013-02-12T00:15:00.000-08:002013-02-17T20:24:02.241-08:00Configure Weblogic JMS Resources<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: Arial; font-size: large;"></span><br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">Before we can configure Weblogic JMS resources such as ConnectionFactory, Queue, Topic, it is better to understand some concepts in Weblogic JMS. </span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<h3 style="text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">JMS Server</span></h3>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">JMS server is the management container for JMS resources defined in JMS modules targeted to. A JMS server's main responsibility is to maintain persistent storage for these resources, maintain the state of durable subscriber and etc.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">JMS servers are persisted in the domain's config.xml file and multiple JMS servers can be configured on the various WebLogic Server instances in a cluster, as long as they are uniquely named.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">One domain can have one or more than one JMS server. </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">A JMS server can manage one or more JMS modules.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">One cluster node has own JMS server targeted to managed node.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">For example there are two managed nodes in a clustered environment: osb_ms1 and osb_ms2.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">We create two JMS servers: OSB_JMSServer_01 and OSB_JMSServer_02 which are targeting osb_ms01 and osb_ms02 respectively.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;"><br /></span></div>
<h3 style="text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">JMS Module</span></h3>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">JMS modules group JMS configuration resources (such as queues, topics, and connections factories). These are outside domain configuration. </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">JMS module targets the servers. If it is clustered environment it will target all servers in the cluster.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;"><br /></span></div>
<h3 style="text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">Subdeployment</span></h3>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">Subdeployment is also known as Advanced Targeting. </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">Subdeployment resource is a bridge between the group of JMS resources and JMS Servers. Without Subdeployment the JMS resources cannot target any JMS server.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">When you create a JMS resource you need to choose one Subdeployment.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">In clustered environment one Subdeployment targets multiple JMS server for each cluster node.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">The below diagram shows the relationship between them.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-iTK1r-raeJ0/URoZB_5fooI/AAAAAAAAAUE/J6DWIv99Jtw/s1600/WeblogicJMS.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-iTK1r-raeJ0/URoZB_5fooI/AAAAAAAAAUE/J6DWIv99Jtw/s1600/WeblogicJMS.png" /></a></div>
<h3 class="separator" style="clear: both; text-align: left;">
<br /> </h3>
<h3 class="separator" style="clear: both; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">Steps to configure JMS resources</span></h3>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;"><br /></span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">The following is an example which demostrate the configuration steps for JMS resources in Oracle using Oracle Weblogic Console. This example is done with a single node environment. </span></span><br />
<h4>
</h4>
<h4>
<span style="font-size: large;">1. Create JMS Server</span></h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">The first step is to create a JMS server. Select the domain in Console. Then click on YourDomain-->Services-->Messaging-->JMS Servers. In the right panel click on New button. And then type in the name for JMS server to be created and select the Persistence Store. If Persistemce Store doesn't exist create a new Persistence Store. Then click on Next button.</span><br />
<span style="font-family: Arial; font-size: large;"></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-RM3yq2ANyFc/USGoAuLqpSI/AAAAAAAAAUU/JAx8o3Zlsyg/s1600/WeblogicJMS1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="347" src="http://2.bp.blogspot.com/-RM3yq2ANyFc/USGoAuLqpSI/AAAAAAAAAUU/JAx8o3Zlsyg/s640/WeblogicJMS1.png" width="640" /></a></div>
<span style="font-family: Arial; font-size: large;"></span><br />
<span style="font-family: Arial; font-size: large;">Select the Weblogic server node and then click on Finish button. Then a JMS server called Demo-JMSServer is created. This Demo-JMSServer is targeted to AdminServer.</span><br />
<span style="font-family: Arial; font-size: large;"></span><br />
<span style="font-family: Arial; font-size: large;"></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-S_qQsA28RM0/USGoe8j-n5I/AAAAAAAAAUc/Ew5gziIdVQo/s1600/WeblogicJMS2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="202" src="http://3.bp.blogspot.com/-S_qQsA28RM0/USGoe8j-n5I/AAAAAAAAAUc/Ew5gziIdVQo/s640/WeblogicJMS2.png" width="640" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-OS_eOTnq26M/USGolRbZncI/AAAAAAAAAUk/j7Ju1HNe-08/s1600/WeblogicJMS3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="408" src="http://4.bp.blogspot.com/-OS_eOTnq26M/USGolRbZncI/AAAAAAAAAUk/j7Ju1HNe-08/s640/WeblogicJMS3.png" width="640" /></a></div>
<br />
<span style="font-family: Arial; font-size: large;"></span><br />
<span style="font-family: Arial; font-size: large;"></span><br />
<span style="font-family: Arial; font-size: large;"></span><br />
<span style="font-family: Arial; font-size: large;"></span><br />
<span style="font-family: Arial; font-size: large;"></span><br />
<span style="font-family: Arial; font-size: large;"></span><br />
<span style="font-family: Arial; font-size: large;"></span><br />
<span style="font-family: Arial; font-size: large;"></span><br />
<span style="font-family: Arial; font-size: large;"></span><br />
<span style="font-family: Arial; font-size: large;"></span><br />
<span style="font-family: Arial; font-size: large;"><h4>
<span style="font-size: large;">2. Create JMS Module</span></h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">The second step is to create a JMS Module. Select the domain in Console. Then click on YourDomain-->Services-->Messaging-->JMS Modules. In the right panel click on New button. And then type in the name for JMS Module. Then click on Next button.</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-kwvKxJ8Z1hA/USGplNyYK7I/AAAAAAAAAUw/nODVy5HaRVo/s1600/WeblogicJMS4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="376" src="http://1.bp.blogspot.com/-kwvKxJ8Z1hA/USGplNyYK7I/AAAAAAAAAUw/nODVy5HaRVo/s640/WeblogicJMS4.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-N-fUxoyfm4M/USGpt8dCg1I/AAAAAAAAAU4/UAg9TMG4w3o/s1600/WeblogicJMS5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="396" src="http://2.bp.blogspot.com/-N-fUxoyfm4M/USGpt8dCg1I/AAAAAAAAAU4/UAg9TMG4w3o/s640/WeblogicJMS5.png" width="640" /></a></div>
<br />
</span><span style="font-family: Arial; font-size: large;">Then select the target of Weblogic server node.</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-8053RnXPVdo/USGqBCCUkaI/AAAAAAAAAVA/nA9qS5WsEbo/s1600/WeblogicJMS6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="282" src="http://2.bp.blogspot.com/-8053RnXPVdo/USGqBCCUkaI/AAAAAAAAAVA/nA9qS5WsEbo/s640/WeblogicJMS6.png" width="640" /></a></div>
<br />
<span style="font-family: Arial; font-size: large;"></span><br />
<span style="font-family: Arial; font-size: large;">Then click on Next button.</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-KbjyWQIOkAI/USGqJHf9MOI/AAAAAAAAAVI/D6w3npeT058/s1600/WeblogicJMS7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="232" src="http://1.bp.blogspot.com/-KbjyWQIOkAI/USGqJHf9MOI/AAAAAAAAAVI/D6w3npeT058/s640/WeblogicJMS7.png" width="640" /></a></div>
<br />
<span style="font-family: Arial; font-size: large;">Then click on Finish button. DemoJMSModule is created.</span><br />
<span style="font-family: Arial; font-size: large;"></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-wnxYRisQm-U/USGqPT7gL9I/AAAAAAAAAVQ/NkJVa_CmDBw/s1600/WeblogicJMS8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="446" src="http://1.bp.blogspot.com/-wnxYRisQm-U/USGqPT7gL9I/AAAAAAAAAVQ/NkJVa_CmDBw/s640/WeblogicJMS8.png" width="640" /></a></div>
<span style="font-family: Arial; font-size: large;"><span style="font-family: Arial; font-size: large;"></span></span><br />
<span style="font-family: Arial; font-size: large;"><span style="font-family: Arial; font-size: large;"></span></span><br />
<span style="font-family: Arial; font-size: large;"><span style="font-family: Arial; font-size: large;"></span></span><br />
<span style="font-family: Arial; font-size: large;"><span style="font-family: Arial; font-size: large;"></span></span><br />
<span style="font-family: Arial; font-size: large;"><span style="font-family: Arial; font-size: large;"></span></span><br />
<span style="font-family: Arial; font-size: large;"><span style="font-family: Arial; font-size: large;"></span></span><br />
<span style="font-family: Arial; font-size: large;"><span style="font-family: Arial; font-size: large;"></span></span><br />
<span style="font-family: Arial; font-size: large;"><span style="font-family: Arial; font-size: large;"></span></span><br />
<span style="font-family: Arial; font-size: large;"><span style="font-family: Arial; font-size: large;"></span></span><br />
<span style="font-family: Arial; font-size: large;"><span style="font-family: Arial; font-size: large;"></span></span><br />
<span style="font-family: Arial; font-size: large;"><span style="font-family: Arial; font-size: large;"><h4>
<span style="font-size: large;">3. Create JMS Resource</span></h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;">The third step is to create a JMS resource such as connection factory, queue or topic in above created JMS Module.</span><br />
Click the JMS Module where a resource is created.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-pdt7oe-UU2I/USGqb6UkyxI/AAAAAAAAAVc/LE8Gyq50Ms8/s1600/WeblogicJMS9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="492" src="http://4.bp.blogspot.com/-pdt7oe-UU2I/USGqb6UkyxI/AAAAAAAAAVc/LE8Gyq50Ms8/s640/WeblogicJMS9.png" width="640" /></a></div>
<br />
<br />
Then click on New button.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/--jDa-8wRu5E/USGqqG_B5dI/AAAAAAAAAVk/msGSVDHy1Fw/s1600/WeblogicJMS10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="458" src="http://3.bp.blogspot.com/--jDa-8wRu5E/USGqqG_B5dI/AAAAAAAAAVk/msGSVDHy1Fw/s640/WeblogicJMS10.png" width="640" /></a></div>
<br />
<br />
Select the resource type to be created. Here we create a Queue. Then click on Next button.<br />
<br />
<br />
Type in the Queue nama and JNDI name for this Queue and then click on Next button.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-Q-mahHawPW8/USGqxY4emiI/AAAAAAAAAVs/pVb9-VBjsrQ/s1600/WeblogicJMS11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="308" src="http://1.bp.blogspot.com/-Q-mahHawPW8/USGqxY4emiI/AAAAAAAAAVs/pVb9-VBjsrQ/s640/WeblogicJMS11.png" width="640" /></a></div>
<br />
<br />
Select the Subdeployment. If no existing Subdeployment can be used click on Create a New Subdeployment buttn.</span></span><span style="font-family: Arial; font-size: large;"></span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-A6BY8BsGyrA/USGrZmL-RNI/AAAAAAAAAV0/OUzZ53LycPw/s1600/WeblogicJMS12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://3.bp.blogspot.com/-A6BY8BsGyrA/USGrZmL-RNI/AAAAAAAAAV0/OUzZ53LycPw/s640/WeblogicJMS12.png" width="640" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;"><br />Type in the name for a new Subdeployment and then click on OK button.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-qKZrMHREIxg/USGruJfqRrI/AAAAAAAAAV8/t2V8sNRctAY/s1600/WeblogicJMS13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="202" src="http://3.bp.blogspot.com/-qKZrMHREIxg/USGruJfqRrI/AAAAAAAAAV8/t2V8sNRctAY/s640/WeblogicJMS13.png" width="640" /></a></div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;"></span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-A6BY8BsGyrA/USGrZmL-RNI/AAAAAAAAAV0/OUzZ53LycPw/s1600/WeblogicJMS12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://3.bp.blogspot.com/-A6BY8BsGyrA/USGrZmL-RNI/AAAAAAAAAV0/OUzZ53LycPw/s640/WeblogicJMS12.png" width="640" /></a></div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: large;"><br />Then select the JMSServer and then click on Finish button.<br />
<br />
</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-yx3yQV9t-dw/USGsAFc0bbI/AAAAAAAAAWE/l_8ayiDkXIc/s1600/WeblogicJMS14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="458" src="http://1.bp.blogspot.com/-yx3yQV9t-dw/USGsAFc0bbI/AAAAAAAAAWE/l_8ayiDkXIc/s640/WeblogicJMS14.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-k4Oh8x4NQdA/USGsGPg4rwI/AAAAAAAAAWM/MC50owRyfz4/s1600/WeblogicJMS15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="432" src="http://1.bp.blogspot.com/-k4Oh8x4NQdA/USGsGPg4rwI/AAAAAAAAAWM/MC50owRyfz4/s640/WeblogicJMS15.png" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com4tag:blogger.com,1999:blog-8487142701656203604.post-68690881476802261062013-02-10T01:55:00.000-08:002013-02-10T04:44:44.956-08:00Use Spring MVC Test framework and Mockito to test controllers<div class="MsoNormal">
<span style="font-size: large;">Recently I came into one project which is using Spring MVC
for web-tier in the architecture. It
gave me a chance to use Spring MVC Test framework and Mockito mock framework
together in the unit testing of all Spring MVC controllers in the
application. I found that both of them
provide very good functionalities to test the controllers and would like to
show what I did with them.</span></div>
<h2>
<o:p> </o:p></h2>
<h4>
<span style="font-size: large;">
Spring MVC Test framework</span></h4>
<div class="MsoNormal">
<span style="font-size: large;">Before when unit testing MVC controllers we usually use <i>MockHttpServletRequest</i> and <i>MockHttpServletResponse</i><b> </b>and directly send this mock request to
the controllers to do the unit testing, now in Spring 3.2 there is a new test
framework which is specially used for testing Spring MVC. It is Spring MVC Test framework. With this test framework you can test your
controllers just like you test them within a web container but without starting
a web container.</span></div>
<div class="MsoNormal">
<span style="font-size: large;">Spring MVC Test framework provides much nicer testing framework
to cover many aspects of testing in Spring MVC. With this framework apart from testing
business logic within controllers we can also test inbound/outbound
request/response serialization (such as JSON request to Java and Java to JSON
response), request mapping, request validation, content negotiation, exception
handling and etc. </span></div>
<div class="MsoNormal">
<span style="font-size: large;"> In order to use it
you can add the below dependency into your project POM file.</span><br />
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal">
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background: #DBE5F1; border-collapse: collapse; border: none; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184; width: 100%px;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 100.0%;" valign="top" width="100%"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Times New Roman","serif";"><span style="font-size: large;"> <properties><o:p></o:p></span></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Times New Roman","serif";"><span style="font-size: large;">
<spring.version>3.2.0.RELEASE</spring.version><o:p></o:p></span></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Times New Roman","serif";"><span style="font-size: large;"> </properties><o:p></o:p></span></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Times New Roman","serif";"><span style="font-size: large;"> <o:p></o:p></span></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Times New Roman","serif";"><span style="font-size: large;"> <dependency><o:p></o:p></span></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Times New Roman","serif";"><span style="font-size: large;">
<groupId>org.springframework</groupId><o:p></o:p></span></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Times New Roman","serif";"><span style="font-size: large;">
<artifactId>spring-test</artifactId><o:p></o:p></span></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Times New Roman","serif";"><span style="font-size: large;">
<version>${spring.version}</version><o:p></o:p></span></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Times New Roman","serif";"><span style="font-size: large;">
<scope>provided</scope><o:p></o:p></span></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Times New Roman","serif";"><span style="font-size: large;"> </dependency></span></span></i><o:p></o:p></div>
</td>
</tr>
</tbody></table>
</div>
<div class="MsoNormal">
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">The key part of Spring MVC Test framework is <i>MockMVC.</i>
<i>MockMVC</i> will simulate the
internals of Spring MVC and <i>MockMVC</i>
is the entry point for Spring MVS testing. </span></div>
<div class="MsoNormal">
<span style="font-size: large;">The first step of using Spring MVC testing is to instantiate
one instance of <i>MockMVC</i>. </span></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background: #DBE5F1; border-collapse: collapse; border: none; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184; width: 100%px;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 100.0%;" valign="top" width="100%"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">@RunWith(SpringJUnit4ClassRunner.class)<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">@WebAppConfiguration<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">@ContextConfiguration(locations={"file:src/main/webapp/WEB-INF/mvc-dispatcher-servlet.xml",
<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> "classpath:/META-INF/applicationContextForTest.xml"})<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">@TestExecutionListeners({
DependencyInjectionTestExecutionListener.class})<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">public
class ProductControllerTest {<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> @Autowired<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> private WebApplicationContext wac;<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <span style="color: red;">private MockMvc
mockMvc;<o:p></o:p></span></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> @Before<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> public void setup() {<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <span style="color: red;">this.mockMvc
= MockMvcBuilders.webAppContextSetup(this.wac).build();<o:p></o:p></span></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> // Details are omitted for brevity<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> }<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: large;"><i><span style="font-family: "Courier New";">}</span></i><o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: large;">After <i>MockMVC</i> is
created you can use <i>MockMVC</i> to do the
testing. You can create one HTTP
request and specify all the details of the request such as HTTP method, content
type, request parameters and etc. Then you can send this request through <i>MockMVC </i>and then verify the results.</span></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background: #DBE5F1; border-collapse: collapse; border: none; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184; width: 100%px;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 100.0%;" valign="top" width="100%"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">RequestBuilder
requestBuilder = MockMvcRequestBuilders.get("/welocme");<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">this.mockMvc.perform(requestBuilder).<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> andExpect(MockMvcResultMatchers.status().isOk()).<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> andExpect(MockMvcResultMatchers.model().attribute("welcome_message",
"Welcome to use product: DELL Insprson")).<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> andExpect(MockMvcResultMatchers.model().size(1)).<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: large;"><i><span style="font-family: "Courier New";"> andExpect(MockMvcResultMatchers.view().name("welcome"));</span></i><o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: large;"><br /></span></div>
<h4>
<span style="font-size: large;">Mockito</span></h4>
<div class="MsoNormal">
<span style="font-size: large;">Mockito is another testing mock framework. I find that it is quite easy and convenient
to use. First if you want to use it in
your project you can the following dependency to your project POM file. Here I use the version 1.9.5. </span></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background: #DBE5F1; border-collapse: collapse; border: none; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184; width: 100%px;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 100.0%;" valign="top" width="100%"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <dependency><o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <groupId>org.mockito</groupId><o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">
<artifactId>mockito-all</artifactId><o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">
<version>1.9.5</version><o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <scope>test</scope><o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> </dependency></span></i></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: large;">Mockito provides some annotations to simplify writing the
testing codes. @Mock and @InjectMocks
are the two annotations I am going to use.
@Mock is used to annotate the object to be mocked. In the unit testing when testing a method of
one object which has the dependency on another object, this dependent object
needs to be mocked. In my project there
is class called <i><span style="font-family: "Courier New";">ProductController</span></i> and another class <i><span style="font-family: "Courier New";">ProductService.
ProductController </span></i>uses <i><span style="font-family: "Courier New";">ProductService </span></i>to do actual work to serve the
requests <i><span style="font-family: "Courier New";">ProductController</span></i> is supposed to handle.<o:p></o:p></span></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background: #DBE5F1; border-collapse: collapse; border: none; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184; width: 100%px;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 673.1pt;" valign="top" width="897"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">@Controller<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">@RequestMapping("/products")<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">public
class ProductController {<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> @Autowired<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> private ProductService productService;<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> // Details are omitted for brevity<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">}</span></i></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: large;">When I test <i><span style="font-family: "Courier New";">ProductController</span></i> I have <i><span style="font-family: "Courier New";">ProductService</span></i>
as mock service so it can mock different responses from ProductService. Using @Mock annotation from Mockito it can
simply be done in my test class as the below:</span></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background: #DBE5F1; border-collapse: collapse; border: none; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184; width: 100%px;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 673.1pt;" valign="top" width="897"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: large;"><span style="color: #c00000;"> </span><i><span style="color: #c00000; font-family: "Courier New";">@Mock<o:p></o:p></span></i></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="color: #c00000; font-family: "Courier New"; font-size: large;">ProductService mockProductService;</span></i></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: large;">Another step is to put this mock object into the object to
be tested. Mockito provides another very
useful annotation @InjectMocks to do. @InjectMocks is to annotate the object
where the mock object is injected into.
In my example it is <i><span style="font-family: "Courier New";">ProductController</span></i>. and I have the
following:</span></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background: #DBE5F1; border-collapse: collapse; border: none; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184; width: 100%px;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 673.1pt;" valign="top" width="897"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="color: #c00000; font-family: "Courier New"; font-size: large;">@InjectMocks<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="color: #c00000; font-family: "Courier New"; font-size: large;">ProductController productController;</span></i></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: large;">But in order to make mock object injection really happen
there is another thing needed to be done: invoke <i><span style="font-family: "Courier New";">MockitoAnnotations.initMocks</span></i>
method. So my test class will be as the
below:</span></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background: #DBE5F1; border-collapse: collapse; border: none; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184; width: 100%px;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 673.1pt;" valign="top" width="897"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">public
class ProductControllerTest {<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> @InjectMocks<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> private ProductController productController;<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> @Mock<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> private ProductService
mockproductService;<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> @Before<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> public void setup() {<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <span style="color: #c00000;">MockitoAnnotations.initMocks(this);</span><o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> }<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">}</span></i></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: large;">The basic functions of mock framework is to return a given
results when a specific method is invoke.
In Mockito it is done using <i><span style="font-family: "Courier New";">Mockito.when(...).thenReturn(...)</span></i> </span></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background: #DBE5F1; border-collapse: collapse; border: none; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184; width: 100%px;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 673.1pt;" valign="top" width="897"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">public
class ProductControllerTest {<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> @InjectMocks<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> private ProductController productController;<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> @Mock<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> private ProductService
mockproductService;<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> @Before<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> public void setup() {<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> MockitoAnnotations.initMocks(this);<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> List<Product> products = new
ArrayList<Product>();<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> Product product1 = new Product();<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> product1.setId(new Long(1));<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> Product product2 = new Product();<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> product2.setId(new Long(2));<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> products.add(product1);<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> products.add(product2);<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <span style="color: #c00000;">Mockito.when(mockproductService.findAllProducts()).thenReturn(products);<o:p></o:p></span></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> }<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">}</span></i></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: large;">In the above example when <i><span style="font-family: "Courier New";">findAllProducts</span></i>
method in <i><span style="font-family: "Courier New";">ProductService</span></i>
is invoked the mocked <i><span style="font-family: "Courier New";">ProductService</span></i> will return a list
of Products specified before. </span><br />
<span style="font-size: large;"><br /></span>
<br />
<h4>
<span style="font-size: large;">Put all together</span></h4>
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">The below is the code snippet that shows using both Spring MVC Testing and Mockito together for testing a controller.</span></div>
<h4>
</h4>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background: #DBE5F1; border-collapse: collapse; border: none; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184; width: 100%px;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 673.1pt;" valign="top" width="897"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">@RunWith(SpringJUnit4ClassRunner.class)<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">@WebAppConfiguration<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">@ContextConfiguration(locations={"file:src/main/webapp/WEB-INF/mvc-dispatcher-servlet.xml",
<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">
"classpath:/META-INF/applicationContextForTest.xml"})<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">@TestExecutionListeners({
DependencyInjectionTestExecutionListener.class})<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">public
class ProductControllerTest {<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> @Autowired<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> private WebApplicationContext wac;<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> private MockMvc mockMvc;<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> @InjectMocks<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> private ProductController productController;<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> @Mock<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> private ProductService
mockproductService;<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> @Before<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> public void setup() {<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> MockitoAnnotations.initMocks(this);<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> List<Product> products = new
ArrayList<Product>();<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> Product product1 = new Product();<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> product1.setId(new Long(1));<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> Product product2 = new Product();<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> product2.setId(new Long(2));<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> products.add(product1);<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> products.add(product2);<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> Mockito.when(mockproductService.findAllProducts()).thenReturn(products);<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> this.mockMvc =
MockMvcBuilders.webAppContextSetup(this.wac).build();<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> }<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> @Test<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> public void testMethod() throws Exception
{<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> List<Product> products = new
ArrayList<Product>();<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> Product product1 = new Product();<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> product1.setId(new Long(1));<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> Product product2 = new Product();<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> product2.setId(new Long(2));<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> products.add(product1);<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> products.add(product2);<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> RequestBuilder requestBuilder =
MockMvcRequestBuilders.get("/products");<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> this.mockMvc.perform(requestBuilder).<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">
andExpect(MockMvcResultMatchers.status().isOk()).<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">
andExpect(MockMvcResultMatchers.model().attribute("Products",
products)).<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">
andExpect(MockMvcResultMatchers.model().size(2)).<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;">
andExpect(MockMvcResultMatchers.view().name("show_products"));<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> <o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: "Courier New"; font-size: large;"> }<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: large;"><i><span style="font-family: "Courier New";">}</span></i><o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal">
<br /></div>
<br />Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com11tag:blogger.com,1999:blog-8487142701656203604.post-42597154801767602522013-02-09T23:26:00.001-08:002013-02-12T00:50:33.161-08:00How Spring MVC works<span style="font-family: Georgia, serif; font-size: large; line-height: 115%;">MVC is a very good
design pattern which is widely used in applications with UI(Desktop or
web). In this pattern M is Model, V is
the View and C is controller. The
advantage of design pattern is to separate the different responsibilities into
3 parts when dealing UI. In general terms Model represents the business data and logic,
View is visual part where the data in Model is displayed and Controller is the
link of Model and View. Controller is
the brain which decides what data is used and how data is viewed. Each part in MVC has the clear and
dedicated responsibly. By using MVC
pattern the applications with UI become easier to develop, modify and maintain. </span><br />
<span style="font-family: Georgia, serif; line-height: 115%;"><span style="font-size: large;"><br /></span></span>
<br />
<div class="MsoNormal">
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;">SpringMVC is a web
framework provided by Spring based on MVC pattern. This framework is built on top of
JEE/Servlet and is request-driven. So it
means that some servelts will listen on some ports for the incoming request and
each request will trigger the whole process of serving this request in MVC and
the data or resources that the request asks for is presented.<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;">The below shows the
categories of SpringMVC using MVC terms.<o:p></o:p></span></span><br />
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;"><br /></span></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-MvyoevkGywE/URdWcURwa9I/AAAAAAAAAT0/D_Zuu9huUks/s1600/mvc.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="194" src="http://1.bp.blogspot.com/-MvyoevkGywE/URdWcURwa9I/AAAAAAAAAT0/D_Zuu9huUks/s320/mvc.png" width="320" /></a></div>
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;"><br /></span></span></div>
<div class="MsoNormal">
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;">In Spring MVC
DispatcherServlet and Controllers act as the Controller and they receive the
requests and decide how the request will be served and also decide which view
is used. Business objects and domain
objects are the Model and the business objects are invoked by the controllers
and the all data are in domain objects.
The domain objects will be passed to some JSP which are the View
part. The JSP will render the data in
the domain objects. <o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal">
<h4>
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;">DisptacherServlet</span></span></h4>
</div>
<div class="MsoNormal">
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;">DispatcherServlet is the
front controller in Spring MVC. It is a
HttpServlet that will receive the request and return the response. DispatcherServlet is the key player in
SpringMVC. From the below brief work
flow of SpringMVC you can see DispatcherServlet is the driving force that make
the request served with the right response sent back to the client. <o:p></o:p></span></span><br />
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;"><br /></span></span>
<span class="apple-converted-space" style="font-size: large;"></span><br />
<div class="MsoNormal" style="margin-left: 18.0pt;">
</div>
<ol>
<li><span class="apple-converted-space" style="font-size: large;"><span style="font-family: Georgia, serif; line-height: 115%;">Receive the request from client</span></span></li>
<li><span class="apple-converted-space" style="font-size: large;"><span style="font-family: Georgia, serif; line-height: 115%;">Consult HandleMapping to decide which controller
processes the request</span></span></li>
<li><span class="apple-converted-space" style="font-size: large;"><span style="font-family: Georgia, serif; line-height: 115%;">Dispatch the request to the controller</span><span style="font-family: Georgia, serif; line-height: 115%;"> </span><span style="font-family: Georgia, serif; line-height: 115%;"> </span></span></li>
<li><span class="apple-converted-space" style="font-size: large;"><span style="font-family: Georgia, serif; line-height: 115%;">Controller processes the request and returns the
logical view name and model back to DispatcherServlet</span></span></li>
<li><span class="apple-converted-space" style="font-size: large;"><span style="font-family: Georgia, serif; line-height: 115%;">Consult ViewResolver for appropriate View for
the logical view name from Controller</span></span></li>
<li><span class="apple-converted-space" style="font-size: large;"><span style="font-family: Georgia, serif; line-height: 115%;">Pass the model to View implementation for
rendering</span></span></li>
<li><span class="apple-converted-space" style="font-size: large;"><span style="font-family: Georgia, serif; line-height: 115%;">View renders the model and returns the result to
DispatcherServlet</span></span></li>
<li><span class="apple-converted-space" style="font-size: large;"><span style="font-family: Georgia, serif; line-height: 115%;">Return the rendered result from view to the client</span></span></li>
</ol>
</div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--></div>
<div class="MsoNormal">
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;">It is obvious that
DispatcherServlet has a heavy workload.
It needs many other strategy objects and configuration to perform these
work. Each DispatcherServlet has its
own specialized ApplicationContext: WebApplicationContext.<o:p></o:p></span></span><br />
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;"><br /></span></span>
<br />
<h4>
<span class="apple-converted-space" style="font-size: large;"><span class="apple-converted-space"><span style="font-family: Georgia, serif;">MappingHandler</span></span></span></h4>
<span class="apple-converted-space"><span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: 12.0pt; mso-ansi-language: EN-AU; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin;"><br /></span></span></span></div>
<div class="MsoNormal">
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;">One important work to be
done before DispatcherServlet can dispatch the request to the Controller is to
find out which controller is right one for this request. DispatcherServlet uses MappingHandler strategy
object to do so. There are many
MappingHandler implementations which uses different strategies to map the
request to Controller. By default
DispatcherServlet will use BeanNameUrlHandlerMapping and
DefaultAnnotationHandlerMapping.</span></span><br />
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;"><br /></span></span>
<span class="apple-converted-space"><table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background: #DBE5F1; border-collapse: collapse; border: none; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184; width: 100%px;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 100.0%;" valign="top" width="100%"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="mso-bidi-font-family: "Times New Roman";"><span style="font-family: Times, Times New Roman, serif; font-size: large;">public
interface HandlerMapping {<o:p></o:p></span></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="mso-bidi-font-family: "Times New Roman";"><span style="font-family: Times, Times New Roman, serif; font-size: large;"> HandlerExecutionChain
getHandler(HttpServletRequest request) throws Exception;<o:p></o:p></span></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="mso-bidi-font-family: "Times New Roman";"><span style="font-family: Times, Times New Roman, serif; font-size: large;">}</span></span></i><span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: 12.0pt;"><o:p></o:p></span></span></div>
</td>
</tr>
</tbody></table>
</span></div>
<div class="MsoNormal">
<h4>
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;"><br /></span></span></h4>
<h4>
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;">Controller</span></span></h4>
</div>
<div class="MsoNormal">
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;">After the mapping is
resolved DispatcherServlet will dispatch the request to the Controller. Controller does the real work of processing
the request. Also Controller is where programmers
need to work most in developing SpringMVC applications. Controller has the knowledge of processing
the request and what logical view be used for different result of request
processing. Usually Controller doesn't
do the real processing and it delegates the request processing to the service
layer. Another thing the Controller to do is to
package the result of the processing into the Model, which will be rendered in
the View finally. <o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: large;"><br /></span>
<span style="font-size: large;"><br /></span></div>
<div class="MsoNormal">
<h4>
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;">ViewResolver</span></span></h4>
</div>
<div class="MsoNormal">
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;">After the Controller
finish the processing of request it will return the logical view name and the
data to DispatcherServlet, which will decide the actual view to be used since
the view name from Controller is logical name.
With the help of ViewResolver strategy object DispatcherServlet can find
out physical view from the logical view name.
Similar to MappingHandler there are also many different strategies for resolving the view based on the different
view technologies. Most commonly used
implementation of ViewResolver is InternalResourceViewResolver. </span></span><br />
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;"><br /></span></span>
<span class="apple-converted-space"><table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background: #DBE5F1; border-collapse: collapse; border: none; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184; width: 100%px;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 100.0%;" valign="top" width="100%">
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: Times, Times New Roman, serif; font-size: large;">public
interface ViewResolver {<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: Times, Times New Roman, serif; font-size: large;"> View resolveViewName(String viewName,
Locale locale) throws Exception;<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: Times, Times New Roman, serif; font-size: large;">}</span></i><span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: 12.0pt;"><o:p></o:p></span></span></div>
</td>
</tr>
</tbody></table>
</span><br />
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;"><br /></span></span></div>
<div class="MsoNormal">
<h4>
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;">View</span></span></h4>
</div>
<div class="MsoNormal">
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;">View is where the data
in the Model is rendered as the required output for the client. SpringMVC provides many implementations of
View to generate different output such as JSP,Excel, PDF, XML and etc. DispatcherServlet will invoke render method
from selected View implementation to generate the output to be returned to the
client.</span></span><br />
<span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: large; line-height: 115%;"><br /></span></span>
<span class="apple-converted-space"><table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background: #DBE5F1; border-collapse: collapse; border: none; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184; width: 100%px;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 100.0%;" valign="top" width="100%">
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: Times, Times New Roman, serif; font-size: large;">public
interface View {<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: Times, Times New Roman, serif; font-size: large;"> String getContentType();<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: Times, Times New Roman, serif; font-size: large;"> void render(Map<String, ?> model,
HttpServletRequest request, HttpServletResponse
response) throws Exception;<o:p></o:p></span></i></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<i><span style="font-family: Times, Times New Roman, serif; font-size: large;">}</span></i><span class="apple-converted-space"><span style="font-family: "Georgia","serif"; font-size: 12.0pt;"><o:p></o:p></span></span></div>
</td>
</tr>
</tbody></table>
</span></div>
Mark Chenhttp://www.blogger.com/profile/01317562563064465275noreply@blogger.com8