Tuesday, July 11, 2006

Invoking from JSP & using guid

Invoking BPEL process from JSP???...with a requirement to know a unique identifier earlier on ... So ended up using the java API.It was a savior a day before the deadline:).....

The following entry invokes bpel process from jsp as well as shows how we can have another unique identifier (apart from the bpel instance id that we get to know about at a later stage):


First,
I need to have an XML rep of the payload that i will be sending to the BPEL process from the JSP. This is done as follows:
String xml = "" +
"" +year+ "" +
"" +fname+ "" +
"" + lname +"
"
";

Second,
Locator: This helps you look for a process inst that is deployed in the domain.
Delivery Service:used to invoke instances.

Locator locator = new Locator("default","bpel");//default domain
com.oracle.bpel.client.dispatch.IDeliveryService deliveryService = (com.oracle.bpel.client.dispatch.IDeliveryService) locator.lookupService(com.oracle.bpel.client.dispatch.IDeliveryService.SERVICE_NAME);

Third,
Normalized Message: this is what is used as means of communication between the bpel client and orabpel delivery service.
com.oracle.bpel.client.NormalizedMessage nm = new com.oracle.bpel.client.NormalizedMessage();

You can get a unique identifier for your BPEL process using:
String uniqueBpelId = com.collaxa.cube.util.GUIDGenerator.generateGUID();

To the normalized message you attach the payload - that is what you are passing to the bpel process.

java.util.Map msgProps = new HashMap();//one fo the formats for Normalized message is java.util.map(name/value pair)

msgProps.put("conversationId",uniqueBpelId);
nm.setProperty("conversationId",uniqueBpelId);//to set the property for this message
nm.addPart("payload",xml);//to add to the payload of this message
deliveryService.post("bpelprocess","initiate",nm);//post method returns void.

Conclusion:
Above we(client) are specifying a conversation id that is unique to identify any BPEL process instance. Not that badd!!!!!:)

Friday, June 09, 2006

Java Embedding

Java embedding - that is is java code within the BPEL process. The main purpose for which I used this was database updates as well as logging . Updating the database was a challenge and one of the best ways is to do through the database adapters. But since I am using Eclipse & not JDev, didnt have the database adapters functionality there. As a workaround created a separate BPEL process in JDev and was successful in updating the database. However, wasnt successful in calling this BPEL process created in JDEV from the main BPEL process created in Eclipse.

Hence, ended up using java embedding as a final successful workaround.
Application database updates:
I used java embedding mostly for updating the application database through stored proc calls.

Getting values from dehydration store through api's


Logging:

Logging may be done in opmn logs or you may define your own custom log file.
Example:Using log4j (include the jar file in the lib dir)
Logger logger = Logger.getLogger( "default.com.logs.appllogfile" );
logger.info( "Info using log4j" );

Other levels of logging:
a. Info
b. Debug
c. Audit
...
...
...

Sunday, June 04, 2006

Good news - Eclipse Callisto RC4 available!!!

Check it out here! Once I read more about it, I'll post another entry.

Eclipse error: The type java.lang.Object cannot be resolved. It is indirectly referenced from the required .class files

This error popped up the other day when I was copying projects from an old workspace into a new, clean Eclipse workspace. It turned out that the reason the base class java.lang.Object could not be found is because the new workspace did not have Eclipse variables set, and they were referenced by the project in the old workspace. So in the project properties Build Path JRE path. Once I created the Eclipse classpath variables and rebuilt the project, the errors went away.

Tuesday, May 16, 2006

BPEL 10.1.2.0.0 Issues & Workarounds

1. Following error while invoking a web service:


when invoking locally the endpoint 'http://:/webservice/services/WebService', ; nested exception is: ORABPEL-02052 Cannot lookup BPEL domain. The BPEL domain "services" cannot be found; the domain may not have initialized properly. Please verify that the BPEL domain loader has a valid set of initialization properties in the application properties file.


ORABPEL-02052 Cannot lookup BPEL domain. The BPEL domain "services" cannot be found; the domain may not have initialized properly. Please verify that the BPEL domain loader has a valid set of initialization properties in the application properties file.



Click here.


2. Following error while displaying tasks (notifications) :
500 Internal Server Error
java.lang.Error: Unresolved compilation problem: The method setRootElement(Element) is undefined for the type FacadeElem at org.example.www.facProxySchema.FacadeElemFactory.createFacade(FacadeElemFactory.java:65) at _listTasks._jspService(_listTasks.java:138)


Workaround - schemac again:(

3. Following error in sending emails (invoke for sendMail):


Unknown SMTP host: dlsun4254.us.oracle.com; nested exception is: java.net.UnknownHostException: dlsun4254.us.oracle.com



4. Following error while deploying webservices:
AXIS error
Sorry, something seems to have gone wrong... here are the details:
Fault - ; nested exception is:
oracle.xml.parser.v2.XMLDOMException: invalid namespace null for prefix null
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: oracle.xml.parser.v2.XMLDOMException: invalid namespace null for prefix null
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:


Solution/Workarounds:
-Place xmlparserv2.xml under bpel10.1.2.0.2/lib and put in bpel10.1.2.0.0/lib.

Monday, May 15, 2006

bpel.xml file

bpel.xml is the deployment descriptor. It has wsdl locations of all the web services the bpel process is invoking.

Also, other configurations may be set in this file (within tab).
Example:
1. Passing parameters from a jsp that invokes the bpel process.








]]>


2. Certain properties (like db prop) may be set in this file so that they dont need to be hardcoded in the bpel process itself. Click here for more information about setting properties in bpel.xml.

Friday, May 12, 2006

Reading properties from bpel.xml

You can define properties in bpel.xml file and then read these in the BPEL process using ora:getPreference("propname"). One of the adv being avoiding having any hard coded stuff in the bpel process.

Example - Define in bpel.xml
preferences
property name="sid"bpeldb/property
preferences

These may be read inside the bpel process:
String sidName= getPreference("sid");

Tuesday, May 09, 2006

BPEL Logging

Changes to the level of logging may be changed in the BPEL console >Manage BPEl Domains tab > Logging.

Logging level may be any one of the following:
--Debug
--Info
--Warn
--Error
--Fatal
--Off

Also, auditLevel (Under Configuration in Manage BPEL Domain) may also be set in the manage bpel domain to any of the following:
a. Off (no logging)
b. minimal (without any audit details)
c. production (all events logged, except assign activity)
d. development (all events logged, including assign activity)