Wednesday, September 21, 2011

Registering a Web Service with Oracle Enterprise Gateway (OEG)

Simple sanity test for OEG install.

I have created and deployed a simple creditCardValidation service to

http://localhost:7001/ValidateCC/ValidateCCPort?WSDL

The impl is as follows -

package validatecc;

public class ValidateCC {
public ValidateCC() {
super();
}
public CreditCardValidation validateCard(String cardType, String cardNr){
CreditCardValidation ccv = new CreditCardValidation();
ccv.setStatus("INVALID");

if (cardType.equalsIgnoreCase("AMEX")){
ccv.setValidFrom("20110101");
ccv.setValidUntil("20150101");
ccv.setCustName("NiallC");
ccv.setLimit(10000);
ccv.setStatus("VALID");

}
if (cardType.equalsIgnoreCase("VISA")){
ccv.setValidFrom("20070101");
ccv.setValidUntil("20110101");
ccv.setCustName("NiallC");
ccv.setLimit(7000);
ccv.setStatus("VALID");

}
return ccv;
}
}

package validatecc;

public class CreditCardValidation {
String validFrom;
String validUntil;
String custName;
String status;
int limit;

public CreditCardValidation() {
super();
}

public void setValidFrom(String validFrom) {
this.validFrom = validFrom;
}

public String getValidFrom() {
return validFrom;
}

public void setValidUntil(String validUntil) {
this.validUntil = validUntil;
}

public String getValidUntil() {
return validUntil;
}

public void setCustName(String custName) {
this.custName = custName;
}

public String getCustName() {
return custName;
}

public void setLimit(int limit) {
this.limit = limit;
}

public int getLimit() {
return limit;
}

public void setStatus(String status) {
this.status = status;
}

public String getStatus() {
return status;
}
}

Simple enough!

Steps

Start up the Gateway & Policy Studio

Gateway startup --> \OEG\Gateway\enterprisegateway\Win32\bin\enterprisegateway.bat
Policy Studio Startup --> \OEG\PolicyStudio\oegpolicystudio\policystudio.exe



Click on the Edit Active Configuration link
This loads the current Gateway configuration into Policy Studio.

Click on Policies
Click on Register Web Service








This is just a simple pass through example so de-select teh "secure" checkbox.



Check the routing settings




As you can see, this is simple pass-thru processing.

Now deploy the changes from Policy Studio to the Gateway.




Review what has been generated -



Right Click on the Service Handler --> Edit



Click on the Validation tab



Test using Service Explorer

I didn't cover the install of Service Explorer in my "OEG Install" blog post.
It is just a case of unzipping the file - Oracle_Enterprise_Gateway_11_1_1_5_0_Win32_Service_Explorer.zip to a directory of your choice.

Start -




You are presented with an empty page - ready for exploring!




Menu --> File --> Load WSDL

Here we load our original WSDL.




Change the Request, adding valid cardType etc.





Click on the drop down list beside the green icon




Change to point to OEG
http://8082/ValidateCC/ValidateCCPort
The default port for OEG is 8080, however I changed this to 8082, as I had a DB service running on 8080.



Validate the response





Monitor the Gateway





admin/changeme
Click on View Reports

Friday, September 16, 2011

Installing/Configuring Oracle Enterprise Gateway on Windows

The software is available on OTN, just click on the download link at -
http://www.oracle.com/technetwork/middleware/id-mgmt/oeg-300773.html

Then simply follow my doc -

https://docs.google.com/leaf?id=1D0Z0KfgFdvqGHIcpG_7B32mWImGGCRkWhO882KyRVJFYAx94QK9yf6vVTjQP&hl=en

Wednesday, September 14, 2011

OEG - Oracle Enterprise Gateway

I'm currently in Santa Clara skilling up on OEG, which can secure access to your services etc. from the outside world. It works in conjunction with WSM. Think of it as taking care of security in the DMZ, working in concert with WSM which takes care of the last mile security.

To quote from OTN -

Oracle Enterprise Gateway provides DMZ-class security and a comprehensive threat defense system at the service perimeter to SOA and Cloud environments, thus providing critical protection needed between un-trusted and trusted zones.


A very compelling addition to our stack -

So I strongly suggest you check out the many resources available on OTN -
http://www.oracle.com/technetwork/middleware/id-mgmt/oeg-300773.html

Wednesday, August 31, 2011

BPM11g looping Subprocess

Scenario:
the ubiquitous example of an order and its order lines -

XSD





Test XML input



In the BPM process I need to loop thru the order lines.

The basic process looks as follows -




I created a fileAdapter(Read) which triggers the process.

I created the following process variables -



To begin with, I copy the incoming order to the v_order variable.



Then I get the count of incoming order lines -



Now to the looping subprocess -

The loop condition is defined as follows -







Note we have this sub-process variable loopCounter generated for us.

Now to the actual processing - I just copy the orderLine[n] to a variable.





Deploy and test





Wednesday, August 10, 2011

Adding ADF BC components to a BPM Human Task Form

Here is what we need to do...
The BPM process only contains the orderID in the payload. We will need to retrieve the order details from the database via ADF BC and display them on the task form page. My table is called am_order and is defined as follows -




Thanks to Mireille D. and Angelo S. for their input!

The high level steps are as follows –

Auto-generate the Human Task form from the BPM task definition.
- This creates a new project in your JDeveloper application.

In the new project, expose the am_order table as an ADF BC
- Tailor it to add a View Criteria
- e.g. Am_order.order_id = orderID

Add a new bounded ADF task flow to the project
- Here we will display the order details
- The task flow will include a parameter (#pageFlowScope.in_orderID)
-- The view used will be a page fragment

Add the new bounded ADF task flow to the auto-generated taskDetails.jspx
- It will be dropped as a Region
-- Specify the bindings to orderID

Auto-generating the task form is a piece of cake - the real "baking" (pardon the pun) is in the creation of the extra ADF Task form to display the order details.

Amend the ADF BC View as follows -

1. Add a bind variable e.g. (bpm_orderID)
2. Add a new View Criteria that will leverage it.



3. Specify use at app module level



So to execute a query on the view we need to pass in a value for
bpm_orderID


Create the new task flow

This bounded task flow will have the following parameter-



So the task flow expects to be passed in a String (orderID). We call this in_orderID and it is stored in the variable pageFlowScope.in_orderID




Drop the ExecuteWithParams operation from the ViewObject on to the task flow diagram.



Here we specify the value for the view bind variable (bpm_orderID). Naturally this is set to pageFlowScope.in_orderID

We then add a view to the task flow to display the order details



That's it for the task flow.

Now open the auto-generated task form and drop in the new task flow as a region.



I position it after after the orderID.

When dropping we will need to bind the input parameter (in_orderID) we defined earlier. So we bind it to the the existing orderID on the page -






Monday, August 8, 2011

Using timers in BPM 11g Part 2

Scenario:

A typical batch style process -
The process starts at 10 am and writes out a report every hour.
It ends 6 hours later at 4 pm.

Now for testing purposes I will start at 2:40 pm, write a report every 1 minute and then end 5 minutes later - but you can extrapolate as required.

The process is as follows -



Start is set to 14:40



The variable v_endTimeString will be set to startTime (i.e. 14:40) + 5 minutes.
I use this later for comparison purposes. I'm not the XPath guru so I essentially
store the end date as a String in the format YYYYMMDDHHMM and then exit the reporting loop when currentDateTime > v_endTimeString.








Wait 1 minute configured as follows -




The COB? (Close Of Business) condition for "Still within business hours" is set as follows -



xp20:format-dateTime(string(xp20:current-dateTime()), '[Y0001][M01][D01][H01][m01]') < bpmn:getDataObject('v_endTimeString')

Deploy and test

The output report should contain 5 entries for the time period 14:40 - 14:45.










Wednesday, August 3, 2011

Using Timers in BPM11g

Here is the only occasion where I must admit the official docs left me somewhat puzzled.

It shows examples such as 'now' + 20 which one could take as an indication on how to set a timer for current date time + 20 (hours, seconds ??)

My scenario is very simple - accept a file, wait a certain amount of time and then write the file.



So now I want to set this wait to 15 seconds -



This may seem pretty cryptic -

xp20:add-dayTimeDuration-to-dateTime(xp20:current-dateTime(), string('PT15S'))

PT15S - PT are just constants -

P1Y1DT1H1S

so 3 days are P3D
3 hours PT3H

Check out Antony's blog posting for the why's etc.

http://blogs.oracle.com/reynolds/entry/whats_the_time_mr_bpel