Weblog

11G previews of JDeveloper, SOA Suite, Webcenter available for download

Just before the end of the year Oracle has made a lot of new technology previews available on OTN: Oracle Fusion Middleware 11g Technology Previews. Technology preview 3 for JDeveloper (new features list), SOA Suite, and Webcenter. The Webcenter link doesn’t seem to work, maybe it’s not up yet? And de SOA Suite download page links to jdeveloper, which includes the SOA Suite. JDeveloper has is now just 768Mb large…

Creating a simple SCA component

SCA is a relative new technology that’s bound to take off next year. The apache Tuscany project released the 1.0 version of the java implementation in September, and Oracle will include it in the upcoming SOA Suite 11. Time for some research into this technology.

In the following example I’m using version 1.0.1 of Apache Tuscany. You can download it from the Tuscany website.

First step will be to implement a service component which consist of one service. The component endpoint will be exposed as a web service. First the service. The service consists of an interface and an implementation. The interface:

package nl.iteye.patient;

import org.osoa.sca.annotations.Remotable;
import org.osoa.sca.annotations.Service;

@Remotable
public interface PatientService {

    public String ping(String message);
}

The Remotable annotation indicates that is a service which can be called remotely. The implementation is as follows:

package nl.iteye.patient;

import org.osoa.sca.annotations.Service;

@Service(PatientService.class)
public class PatientServiceImpl implements PatientService {
    public PatientServiceImpl() {
    }

    public String ping(String message) {
        System.out.println("received ping request: " + message);
        return "hello: " + message;
    }
}

Just a simple ping as you can see. The Service annotation indicates that this is the implementation of the previously defined remotable interface.

Next I have to define a Service Component in a composite configuration file. A composite can actually consist of a large number of components, including java services, bpel processes, etc. You use the composite configuration file to wire all these components together. This enables you to created coarse grained SOA modules, which also makes management and deployment easier than having all these components as separate deployables. Back to the configuration file, here it is:

< ?xml version="1.0" encoding="windows-1252" ?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
           targetNamespace="http://patient.iteye.nl" xmlns:pws="http://patient.iteye.nl"
           name="patient">
    <component name="PatientServiceComponent">
        <implementation .java class="nl.iteye.patient.PatientServiceImpl"/>
        <service name="PatientService">
            <interface .java interface="nl.iteye.patient.PatientService"/>
            <binding .ws/>
        </service>
    </component>
</composite>

That’s it. You now have a composite application consisting of one service which is exposed as a web service.

To test the application I created the following unit test:

package tests.nl.iteye.patient;

import java.io.IOException;
import junit.framework.TestCase;
import nl.iteye.patient.PatientService;
import org.apache.tuscany.sca.host.embedded.SCADomain;
import org.junit.Test;

public class ScaContainerStarterTestCase extends TestCase {
    public ScaContainerStarterTestCase() { }

    @Test
    public void testPing() throws IOException {

        SCADomain scaDomain;
        scaDomain = SCADomain.newInstance("patient.composite");
        PatientService patSvc =
            scaDomain.getService(PatientService.class, "PatientServiceComponent");
        String result = patSvc.ping("hello world!");
        System.out.println("result: " + result);
        scaDomain.close();
    }

}

To build the project I used the following maven pom.xml:

< ?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelversion>4.0.0</modelversion>
    <parent>
        <groupid>nl.iteye</groupid>
        <artifactid>patient-example</artifactid>
        <version>1.0-SNAPSHOT</version>
        <relativepath>../pom.xml</relativepath>
    </parent>
    <repositories>
        <repository>
            <id>apache.incubator</id>
            <url>http://people.apache.org/repo/m2-incubating-repository</url>
        </repository>
    </repositories>
    <artifactid>patient-service</artifactid>
    <name>Patient Service</name>
    <dependencies>
        <dependency>
            <groupid>org.apache.tuscany.sca</groupid>
            <artifactid>tuscany-host-embedded</artifactid>
            <version>1.0.1-incubating</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupid>org.apache.tuscany.sca</groupid>
            <artifactid>tuscany-implementation-java-runtime</artifactid>
            <version>1.0.1-incubating</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupid>org.apache.tuscany.sca</groupid>
            <artifactid>tuscany-binding-ws-axis2</artifactid>
            <version>1.0.1-incubating</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupid>org.apache.tuscany.sca</groupid>
            <artifactid>tuscany-host-jetty</artifactid>
            <version>1.0.1-incubating</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupid>org.apache.derby</groupid>
            <artifactid>derby</artifactid>
            <version>10.3.1.4</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupid>junit</groupid>
            <artifactid>junit</artifactid>
            <version>4.4</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>
        <finalname>${artifactId}</finalname>
    </build>
</project>

As you can see in the pom, i have a parent project. The current project implements a service, in another project i will implement a client application. So to sum up, the service project contains the following files:

Service project files

Please ignore PatientDbInstaller.java, ScaContainerStarter.java (we’ll come to this later), build.cmd (i use this to run maven), and patient-service.jpr (this is the jdeveloper project file).

Now when you run maven (mvn clean package), it will compile and package the composite application and it will also run your test class. The output (just the test part) should be something like:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running tests.nl.iteye.patient.ScaContainerStarterTestCase
Dec 19, 2007 2:06:31 PM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping
INFO: Added Servlet mapping: http://localhost:8085/PatientServiceComponent
received ping request: hello world!
result: hello: hello world!

When you create a sca domain, the jetty web container is started to host the web service. Now you can invoke the webservices in your composite application.

Another way to test the application is to start your composite application and test it by calling the webservice, for example using soapUI. Start your application as follows:

package nl.iteye.patient;

import org.apache.tuscany.sca.host.embedded.SCADomain;

public class ScaContainerStarter {
    public ScaContainerStarter() {
        try {
            SCADomain scaDomain;

            scaDomain = SCADomain.newInstance("patient.composite");
            System.in.read();
            scaDomain.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        ScaContainerStarter scaContainerStarter = new ScaContainerStarter();
    }
}

When you run this you should be able to open the wsdl of your application at http://localhost:8085/PatientServiceComponent?wsdl. Open the wsdl in soapUI and it will create a request for you which you can execute to invoke the web service. The result should look like this:

Composite service soapUI test

One warning, i noticed that you may get some weird exceptions when using the wrong classpath. When you download the binary version of tuscany SCA, you’ll notice a large number of jars in the directories lib and modules. Don’t put every jar on your classpath. It’s enough to include tuscany-sca-manifest.jar in the lib folder. When i included the jars in the modules folder i got some null pointer and classcast exceptions.

OWSM, problem installing the server agent

For my current customer, we needed the functionality of the server agent in Oracle Webservice Manager. External customers can make use of a service which needs to authenticate against OID. An ideal situation to make use of the OWSM, because this is default functionality in it (policy steps).

For installing the server agent i just followed the soa suite developers guide, part “10.3 Authenticating Users with an Oracle Web Services Manager Server Agent”

First problem we noticed is, how to install the agent in a different container instead of the default ‘home’ container. My bpel buddy Bastiaan Schaap already had a question going on on this one in the Oracle Forum and Andre Jochems had the answer, thanks!.

The target container can be set up in the next file : [oracle_home]/owsm/bin/coresv.properties. The property we need to change is : external.oc4j.instance=oc4j_ws

The rest of the installation document is quite straight forward until i reached step “10.3.6 How to Install the Server Agent”, part4. Running the exact same command gave me some nice screensaver-look-a-like effect on linux, and after this the process stopped. Google couldn’t give me any good answers for a solution, so for a change i used metalink to search for any fixes (thanks to my collegue).

It seemed after installing the 10.1.3.3 patch for the soa suite the wsmadmin script is failing. Metalink had the next easy fix for this (and since not all got access to metalink, i thought i may post it inhere)

Instead of executing this :
ORACLE_HOME/owsm/bin/wsmadmin.sh installAgent Oracle-AS-password

try this :
ORACLE_HOME/owsm/bin/wsmadmin.sh installAgent -Doc4jAdminPassword=Oracle-AS-password

It worked like a charm for us. I didn’t tested the other operations in the wsmadmin script, but just add for those the “-Doc4jAdminPassword” parameter too.

Good luck!

Oracle SOA Suite 10.1.3x Best Practices Guide

I know..a bit late..i’m sorry :)

Oracle released the new Best Practices Guide for the SOA Suite.
A nice document with lots of good tips for an optimal soa environment.

BI Publisher, HowTo show a LOV drop-down list

Searching through the documentation of BI-Publisher there is mentioned how to create an LOV. But there is no paragraph for showing this LOV as an drop-down list.

This the HowTo for creating an LOV drop-down list:
1. – Create a LOV –> enter a sql-statement or use fixed-data.
2. – Create a paramter –> Select Paramater TYPE as Menu -> a new sub-block appears, select the LOV you created in step 1.

lov1.jpg

BPEL Process Manager patch 10.1.3.3.1

Oracle have released a new patch for the bpel process manager. It will take the bpel up to 10.1.3.3.1 (metalink patchnumber 6492514)

If i check the readme, quite a list of bugs got fixed (around 90)

Good luck patching.

BI Publisher (10.1.3.3) parameters in a DataTemplate

After a day of searching and trying to create an BIP report based on a data template with parameter(s) the bug is countered.

What is going on in a BIP report based on a data template with one or more parameters. I just created a simple report with a data template but the parameters are not passed too the defined query. The used structure is working perfectly in version 10.1.3.2 but in version 10.1.3.3 the parameter is not passed at all!

Data template example

<datatemplate name="test" dataSourceRef="test">
<!-- Parameters -->
<parameters>
  <parameter name="P_BUNIT" dataType="character" defaultValue="RS"/>
</parameters>
<!-- Query -->
<dataquery>
<sqlstatement name="Q1">
< ![CDATA[select nvl(:P_BUNIT, 'empty' ) param, bu, projectnr, projectomschrijving
from project_status
where status = '1'
and bu = :P _BUNIT
and rownum < 6]]>
</sqlstatement>
</dataquery>
<!-- Datastructure -->
<datastructure>
  <group name="PROJECT_ACQUISITIE" source="Q1">
    <element name="parameter" value="param"/>
    <element name="business_unit" value="bu"/>
    <element name="projectnr" value="projectnr"/>
    <element name="projectomschrijving" value="projectomschrijving"/>
  </group>
</datastructure>
</datatemplate>

The above example is working perfect in version 10.1.3.2 and shows us the 5 (rownum < 6) records. In version 10.1.3.3 we do not get any records at all!

Solution

The solution is simple; just define the parameter with the same name at report level.

How it works in 10.1.3.2
How it works in 10.1.3.3

Defining the parameter P_BUNIT at report-level does the tric. If you defined a default-value for the parameter this should also be filled out for the parameter at report level.

Parameter with default-value (10.1.3.3)

Technology
Ben jij slim genoeg voor IT-eye