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

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());
}

}
}