I liked to Monitor all the Calls to Made to My REST ful webservices.
JAMON is Considered to Be a better Monitoring Tool i liked it very much. It is easy to integrate easy to monitor .I downloaded it from
http://sourceforge.net/projects/jamonapi/files/
Jamon.jar (Required)
Jamon.war (optional)
But i suggest to integrate this to the web app. It has a nice admin screen to view the calls made to the services.
a. Added jamon.jar to the Project and added the monitors to My REST Services.
//Code
mon = MonitorFactory.start("EmpDetailsMonitor");
//My Business Logic
mon.stop();
b. I modified my application.xml to include the jamon.war file.
c. Built the .ear file again Redeployed it.
Call the Webservice in which you added the EmpDetails Monitor
Navigate to the admin screen .you should be able to access like below
http://hostname:port/jamon/jamonadmin.jsp
You should see the monitor Which you added with all other Call Specific Metrics
-Prem
Saturday, June 19, 2010
Saturday, March 13, 2010
Oracle PDK Portlet/ FLEX (Request Parameter from a Portlet to swf file)
I had an Requirement to pass my OID userName to a PDK/Flex Portlet. (I have my employee ID as the OID userName) and as always i want that to default in the userName Field of My shockWave File (.swf)
Environemnt: Flex 3.2/ oracle Portal 10.1.4
Steps.
1. Create you Flex app .have a shock wave file ready.
2.Make Sure you have the below Code to Access your request Parameter
empName = Application.application.parameters.empName;
3. upload the files(history.css,AC_OETags.js,history.js) to a portal page group.you can User Oracle Drive , any WebDav Client or just upload manually.
for eg:
/portal/page/portal/ABCIntranet/js/AC_OETags.js
/portal/page/portal/MCSIntranet/css/history.css
/portal/page/portal/MCSIntranet/js/history.js
3.Create a Portlet using the Standard Wizard. on the Show Mode Jsp. Paste the below Code
<%
String empName = null;
empName = request.getHeader("x-oracle-cache-user") ;
%>
4. in the div tag where you embed the flash file make sure you are passing the FlashVars Parameter with the String Value(in this case i used empName).
eg:
embed src="/portal/page/portal/ABCIntranet/swf/Flash1.swf" quality="high" bgcolor="#ffffff" FlashVars ='empName=<%=empName%>'
4.Register,Publish your Portlet.
Thanks
Prem
Environemnt: Flex 3.2/ oracle Portal 10.1.4
Steps.
1. Create you Flex app .have a shock wave file ready.
2.Make Sure you have the below Code to Access your request Parameter
empName = Application.application.parameters.empName;
3. upload the files(history.css,AC_OETags.js,history.js) to a portal page group.you can User Oracle Drive , any WebDav Client or just upload manually.
for eg:
/portal/page/portal/ABCIntranet/js/AC_OETags.js
/portal/page/portal/MCSIntranet/css/history.css
/portal/page/portal/MCSIntranet/js/history.js
3.Create a Portlet using the Standard Wizard. on the Show Mode Jsp. Paste the below Code
<%
String empName = null;
empName = request.getHeader("x-oracle-cache-user") ;
%>
4. in the div tag where you embed the flash file make sure you are passing the FlashVars Parameter with the String Value(in this case i used empName).
eg:
embed src="/portal/page/portal/ABCIntranet/swf/Flash1.swf" quality="high" bgcolor="#ffffff" FlashVars ='empName=<%=empName%>'
4.Register,Publish your Portlet.
Thanks
Prem
Friday, March 12, 2010
Android/Oracle BPEL
I was able to build a Android app which calls a Oracle BPEL Webservice and process the response sent back from the Service.
This is what i did.
created a Simple BPEL Process and Deployed to BPM 10.1.3.4
Created an Android App on the Eclipse(Android SDK) named it as BPELAndroid.
Added the ksoap2 jar file downloaded from
http://code.google.com/p/ksoap2-android
Note:
When i Called the service from a Blackberry i used a ksoap jar file ksoap2-j2me-core-prev-2.1.2.jar. This JAR file has a HTTPTransport class
This HTTPTransport class will not work for Android.
Wrote the Code below.
package com.prem.android;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.app.Activity;
import android.os.Bundle;
public class BPELAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SoapObject userLoginReposne = null;
try{
HttpTransportSE ht = new HttpTransportSE(
"wsdl url");
/*Please make sure you have VER11 to invoke the BPEL Webservice
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
SoapObject request = new SoapObject(
"http://xmlns.mascocs.com/TheLoop/request",
"name of soap object");
request.addProperty("employeeName","1021633");
request.addProperty("pword","Masco123");
request.addProperty("token","");
envelope.setOutputSoapObject(request);
ht.call("opertatioName",envelope);
userLoginReposne = (SoapObject) envelope.bodyIn;
System.out.println("the request 1 is"
+ userLoginReposne.toString());
setContentView(R.layout.main);
}catch(Exception e){
System.out.println("the Exception is"+e.toString());
}
}
}
This is what i did.
created a Simple BPEL Process and Deployed to BPM 10.1.3.4
Created an Android App on the Eclipse(Android SDK) named it as BPELAndroid.
Added the ksoap2 jar file downloaded from
http://code.google.com/p/ksoap2-android
Note:
When i Called the service from a Blackberry i used a ksoap jar file ksoap2-j2me-core-prev-2.1.2.jar. This JAR file has a HTTPTransport class
This HTTPTransport class will not work for Android.
Wrote the Code below.
package com.prem.android;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.app.Activity;
import android.os.Bundle;
public class BPELAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SoapObject userLoginReposne = null;
try{
HttpTransportSE ht = new HttpTransportSE(
"wsdl url");
/*Please make sure you have VER11 to invoke the BPEL Webservice
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
SoapObject request = new SoapObject(
"http://xmlns.mascocs.com/TheLoop/request",
"name of soap object");
request.addProperty("employeeName","1021633");
request.addProperty("pword","Masco123");
request.addProperty("token","");
envelope.setOutputSoapObject(request);
ht.call("opertatioName",envelope);
userLoginReposne = (SoapObject) envelope.bodyIn;
System.out.println("the request 1 is"
+ userLoginReposne.toString());
setContentView(R.layout.main);
}catch(Exception e){
System.out.println("the Exception is"+e.toString());
}
}
}
Tuesday, February 23, 2010
Flex3 and Rest Webservices.
In our organization since we want leverage Oracle Bpel , i used Flex with Oracle Bpel Webserivces for creating Dashboards and other Rich Internet applications.
Recently i was developing REST webserivces for another project. it was very interesting...As we all know in flex3 we can only use the HTTP service for invoking a REST webservice.
The main reasons why i selected REST instead of BPEL to bind/post data on a flex page is
did not require an ws-security extensions..
did not require soap-header information..
am not willing to select an open source implementation for that project...
Tools required: Ganymede 3.4 and myclispse 7.5 installation (make sure it supports jsr311 implementation).
Framework: Jersey.
use case:
submit a form with firstname and last name and persist in a database
Step 1.
Create a POJO class ,annotate with @XmlRootElement
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Employee{
private String firstName;
private String lastName;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
Step 2.
Create a Resource class
package com.prem.restservices;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import com.sun.jersey.spi.resource.Singleton;
@Produces("application/xml")
@Path("empdetails")
@Singleton
public class CustomersResource {
String jdbcURL = "jdbc:oracle:thin:@hostname:port:SID";
String user = "username";
String passwd = "password";
public Connection getConnection() throws SQLException{
Connection conn;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection(jdbcURL, user, passwd);
return conn;
}
public CustomersResource() {
}
@POST
@Path("add")
@Produces("text/plain")
@Consumes("application/xml")
public String addEmployee(Employee employee) {
Connection conn = null;
PreparedStatement pstmt = null;
try {
conn = getConnection();
//Insert Data in your Database
} catch (java.sql.SQLException e) {
// TODO Auto-generated catch block
System.out.println("Exception in ad Employee" +customer.toString());
}finally{
try{
//Release Resources
}catch(Exception e){
//log in exception
}
}
return "employee " + employee.getFirstName() + " added";
}
Flex Code
mx:Script
![CDATA[
private function send_data():void {
userRequest.send();
}
]]
mx:Form x="22" y="10" width="493"
mx:HBox
mx:Label text="FirstName"
mx:TextInput id="firstname"
mx:HBox
mx:HBox
mx:Label text="LastName"
mx:TextInput id="lastname"
mx:HBox
mx:Button label="Submit" click="send_data()"
mx:Form
mx:HTTPService id="userRequest" url="Webservice URL" contentType="application/xml" showBusyCursor="true" useProxy="false"
mx:request xmlns=""
employee
firstName{firstname.text}firstName
lastName{lastname.text}lastName
employee
mx:request
mx:HTTPService
In our organization since we want leverage Oracle Bpel , i used Flex with Oracle Bpel Webserivces for creating Dashboards and other Rich Internet applications.
Recently i was developing REST webserivces for another project. it was very interesting...As we all know in flex3 we can only use the HTTP service for invoking a REST webservice.
The main reasons why i selected REST instead of BPEL to bind/post data on a flex page is
did not require an ws-security extensions..
did not require soap-header information..
am not willing to select an open source implementation for that project...
Tools required: Ganymede 3.4 and myclispse 7.5 installation (make sure it supports jsr311 implementation).
Framework: Jersey.
use case:
submit a form with firstname and last name and persist in a database
Step 1.
Create a POJO class ,annotate with @XmlRootElement
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Employee{
private String firstName;
private String lastName;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
Step 2.
Create a Resource class
package com.prem.restservices;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import com.sun.jersey.spi.resource.Singleton;
@Produces("application/xml")
@Path("empdetails")
@Singleton
public class CustomersResource {
String jdbcURL = "jdbc:oracle:thin:@hostname:port:SID";
String user = "username";
String passwd = "password";
public Connection getConnection() throws SQLException{
Connection conn;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection(jdbcURL, user, passwd);
return conn;
}
public CustomersResource() {
}
@POST
@Path("add")
@Produces("text/plain")
@Consumes("application/xml")
public String addEmployee(Employee employee) {
Connection conn = null;
PreparedStatement pstmt = null;
try {
conn = getConnection();
//Insert Data in your Database
} catch (java.sql.SQLException e) {
// TODO Auto-generated catch block
System.out.println("Exception in ad Employee" +customer.toString());
}finally{
try{
//Release Resources
}catch(Exception e){
//log in exception
}
}
return "employee " + employee.getFirstName() + " added";
}
Flex Code
mx:Script
![CDATA[
private function send_data():void {
userRequest.send();
}
]]
mx:Form x="22" y="10" width="493"
mx:HBox
mx:Label text="FirstName"
mx:TextInput id="firstname"
mx:HBox
mx:HBox
mx:Label text="LastName"
mx:TextInput id="lastname"
mx:HBox
mx:Button label="Submit" click="send_data()"
mx:Form
mx:HTTPService id="userRequest" url="Webservice URL" contentType="application/xml" showBusyCursor="true" useProxy="false"
mx:request xmlns=""
employee
firstName{firstname.text}firstName
lastName{lastname.text}lastName
employee
mx:request
mx:HTTPService
Saturday, February 13, 2010
Android/ JDBC
Hi,
This week i was able to develop an Android App to get data from an Oracle Database.
Here is my Code .
package com.prem.JDBCAndroid;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import android.app.Activity;
import android.database.SQLException;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
import android.util.Log;
public class JDBCAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
String userName = getDataFromOraDB();
TextView tv = new TextView(this);
tv.setText(userName);
setContentView(tv);
} catch (SQLException e) {
Toast.makeText(this, e.getMessage(), 1).show();
} catch (ClassNotFoundException e) {
Toast.makeText(this, e.getMessage(), 1).show();
}
}
public String getDataFromOraDB() throws SQLException,
ClassNotFoundException {
String name = null;
String jdbcURL = "jdbc:oracle:thin:@hostname:portname:sid";
String user = "uname";
String passwd = "pwd";
// Load the Oracle JDBC driver
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn;
ResultSet rs;
Statement stmt;
conn = DriverManager.getConnection(jdbcURL, user, passwd);
stmt = conn.createStatement();
rs = stmt.executeQuery("select USERNAME from SomeTableName");
if (rs.next()) {
name = rs.getString("USERNAME");
}
} catch (java.sql.SQLException e) {
// TODO Auto-generated catch block
System.out.println("the exception is" + e.toString());
}
Toast.makeText(getApplicationContext(), name, 1).show();
return name;
}
}
If you still have issues please check your AndroidManifest.xml file if it has the
below line
uses-permission android:name="android.permission.INTERNET"
This week i was able to develop an Android App to get data from an Oracle Database.
Here is my Code .
package com.prem.JDBCAndroid;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import android.app.Activity;
import android.database.SQLException;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
import android.util.Log;
public class JDBCAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
String userName = getDataFromOraDB();
TextView tv = new TextView(this);
tv.setText(userName);
setContentView(tv);
} catch (SQLException e) {
Toast.makeText(this, e.getMessage(), 1).show();
} catch (ClassNotFoundException e) {
Toast.makeText(this, e.getMessage(), 1).show();
}
}
public String getDataFromOraDB() throws SQLException,
ClassNotFoundException {
String name = null;
String jdbcURL = "jdbc:oracle:thin:@hostname:portname:sid";
String user = "uname";
String passwd = "pwd";
// Load the Oracle JDBC driver
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn;
ResultSet rs;
Statement stmt;
conn = DriverManager.getConnection(jdbcURL, user, passwd);
stmt = conn.createStatement();
rs = stmt.executeQuery("select USERNAME from SomeTableName");
if (rs.next()) {
name = rs.getString("USERNAME");
}
} catch (java.sql.SQLException e) {
// TODO Auto-generated catch block
System.out.println("the exception is" + e.toString());
}
Toast.makeText(getApplicationContext(), name, 1).show();
return name;
}
}
If you still have issues please check your AndroidManifest.xml file if it has the
below line
uses-permission android:name="android.permission.INTERNET"
TimeZone in Workbrain5.0.21
ETM_CLOCK_FACTOR_TIME_ZONE
Description: This parameter determines how an employee’s time zone is determined. When set to client_browser, the time zone is set by the user’s PC, although the actual date and time from the PC is not used.
When set to employee_udf, employee time zones are determined from stored values in the TIMEZONE table. If the employee does not have EMPLOYEE.TZ_ID set, then server time is used.
When set to False, all time zones are the same as the server.
Valid Values: client_browser, employee_udf, False
Default Value: False
Location: system/WORKBRAIN_PARAMETERS/
-Prem
Description: This parameter determines how an employee’s time zone is determined. When set to client_browser, the time zone is set by the user’s PC, although the actual date and time from the PC is not used.
When set to employee_udf, employee time zones are determined from stored values in the TIMEZONE table. If the employee does not have EMPLOYEE.TZ_ID set, then server time is used.
When set to False, all time zones are the same as the server.
Valid Values: client_browser, employee_udf, False
Default Value: False
Location: system/WORKBRAIN_PARAMETERS/
-Prem
Time out in Workbrain5.0.2.1
a.Application SessionTimeOut
This happens through registry setting
Select * from workbrain_registry where wbreg_name='timeout'
b. PageSession TimeOut
Application gives an option to the user to set their timeout on
specific pages (only sys admins can configure this.)
select * from workbrain_page gives the list of pages which are configured for a page level time out.
I changed this as we do not want this to be same as App time out for some business reasons.
A page session Time out takes Priority if it is less than Application TimeOut
-Prem
This happens through registry setting
Select * from workbrain_registry where wbreg_name='timeout'
b. PageSession TimeOut
Application gives an option to the user to set their timeout on
specific pages (only sys admins can configure this.)
select * from workbrain_page gives the list of pages which are configured for a page level time out.
I changed this as we do not want this to be same as App time out for some business reasons.
A page session Time out takes Priority if it is less than Application TimeOut
-Prem
Subscribe to:
Posts (Atom)