Pages

Friday, November 6, 2009

Installing Soa Suite 10.1.3.5.1 on Weblogic

Yesterday Oracle released Soa Suite 10.1.3.5.1, the version which you can install on Weblogic 10.3.1 ( FMW11g version ). This is a full version so you don't early versions or extra patches to makes this work.

We need to download Weblogic 10.3.1 and Soa Suite 10.1.3.5.1

first step is to install Weblogic 10.3.1, I use C:\oracle\Soa10gWls as my wls middleware home folder

Now we can go to the Soa suite part, first we need to create a bpel, esb and wsm repository.

Extract the soa suite install zip and go to the rca folder located in ias_windows_x86_101351\Disk1\install\soa_schemas\irca

We need to set a database home for the jdbc driver.
set ORACLE_HOME=C:\oracle\product\11.1.0\db_1
We can use the jdk of the new weblogic install
set JAVA_HOME=C:\oracle\Soa10gWls\jdk160_11

Now we can start irca.bat

After a succesfull install of the repository we can start the soa suite installer in this folder ias_windows_x86_101351\Disk1

Very important the destination path must be in a folder of the just created wls middleware home so I use C:\oracle\Soa10gWls\soa10g


As weblogic home location use C:\oracle\Soa10gWls\wlserver_10.3

We are ready with the install

Now we to start script for wsm go to the C:\oracle\Soa10gWls\soa10g\config\ folder and start
configureSOA.bat

Last step is to create a Soa domain just like Soa Suite 11g and select the Soa Suite 10.1.3.5.1 option


Provide the orabpel and oraesb schema passwords.


Start the admin server and go to http://localhost:7001/console where we can take a look at the server. The soa suite server is called soa10g_server1


When we want to start the soa server we need to go the soa domain bin folder
C:\oracle\Soa10gWls\user_projects\domains\soa1013_domain\bin
and use "startManagedWebLogic.cmd soa10g_server1" to start the server.

This are the default installation url's of the Soa Suite applications
http://localhost:9700/esb
http://localhost:9700/BPELConsole
http://localhost:9700/ccore

And we need to use soaadmin as username to log in and use weblogic1 as password.


The issues that I had and luckily also solved.

Asynchronous routing fails with this error oracle.tip.esb.server.common.exceptions.BusinessEventRetriableException: Failed to enqueue deferred event "oracle.tip.esb.server.dispatch.QueueHandlerException: Publisher not exist for system "{0}"

Thanks to Juan Pablo

change the ESB_PARAMETER table on ORAESB schema the following parameters:

PROP_NAME_CONTROL_TCF_JNDI OracleASjms/ControlTCF
PROP_NAME_MONITOR_TCF_JNDI OracleASjms/MonitorTCF
PROP_NAME_ERROR_TCF_JNDI OracleASjms/ErrorTCF
PROP_NAME_ERROR_RETRY_TCF_JNDI OracleASjms/ErrorRetryTCF
PROP_NAME_DEFERRED_TCF_JNDI OracleASjms/DeferredTCF
PROP_NAME_ERROR_XATCF_JNDI OracleASjms/ErrorTCF
PROP_NAME_DEFERRED_XATCF_JNDI OracleASjms/DeferredTCF

to

PROP_NAME_CONTROL_TCF_JNDI ESB_CONTROL
PROP_NAME_MONITOR_TCF_JNDI ESB_MONITOR
PROP_NAME_ERROR_TCF_JNDI ESB_ERROR
PROP_NAME_ERROR_RETRY_TCF_JNDI ESB_ERROR_RETRY
PROP_NAME_DEFERRED_TCF_JNDI ESB_JAVA_DEFERRED
PROP_NAME_ERROR_XATCF_JNDI ESB_ERROR
PROP_NAME_DEFERRED_XATCF_JNDI ESB_JAVA_DEFERRED

and in the ESB console change the Property of Topic Location of every system to ESB_JAVA_DEFERRED

and see the comments for more fixes

Wednesday, November 4, 2009

Invoking Soa Suite 11g Service from java

In Soa Suite 11g we can not call the composite service directly from java. We need to copy the service in the composite, change its binding to adf and wire this service to the component. All the credits goes to Jay's Blog and Clemens, Great work.

The first step is to open the composite xml and find your service.

Copy this service and give it a unique name and now we need to add the binding.adf binding to this service instead of the binding.ws

Go back to the design mode and open the new adf binding service and select the same wsdl as your other service ( this will correct the serviceName ) and at last we need to wire the new service to the component

Now we only need to call this service from java
The source of project is on github check https://github.com/biemond/soa11g_examples/tree/master/SOA_Directbinding where I use adf binding , directbinding and starting these from java and also start / stop composite , check activated instances , start unit tests.

Tuesday, November 3, 2009

Working with Apache Tuscany, The Java SCA based platform part 1

In this blogpost and future blogposts I will try to give you a jumpstart with Apache Tuscany Java SCA. If you follow my blog you may already know that I also work and make blogsposts over an other Service Component Architecture (SCA)-based SOA platform ( Oracle Soa Suite 11g). Soa Suite 11g has a different SCA approach and has much better designer support. But it is nice to take a look at Tuscany and see how this java SCA implementation works.

I will explain how you can make some composite applications. In this blogpost we start easy with building a composite application with
  • Simple java Component
  • Jax-ws component
  • Component with references to other components ( wires )
  • Service on a component
  • Using a second composite


Here a overview of my test project.


First we need to download Apache Tuscany Java SCA

We start with a simple java component with its interface.

package nl.whitehorses.tuscany.step1;

public interface JavaService {
public String getData();
}

package nl.whitehorses.tuscany.step1;

public class JavaServiceImpl implements JavaService {

public String getData() {
return "Hello from java component";
}
}

We can add this component in the step1 composite file and provide the java implementation class.

<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://whitehorses"
name="step1">

<component name="JavaCp">
<implementation.java class="nl.whitehorses.tuscany.step1.JavaServiceImpl" />
</component>

</composite>

Last part of step 1 is to run this composite application, now we have to load and test the composite application.

package nl.whitehorses.tuscany.step1;

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

public class ClientStep1 {

public final static void main(String[] args) throws Exception {

SCADomain scaDomain = SCADomain.newInstance("step1.composite");
JavaService javaService = scaDomain.getService(JavaService.class, "JavaCp");

System.out.println("java: " + javaService.getData());

scaDomain.close();
}
}


In step 2 we will call a jax-ws webservice. In this step we also need to add a reference to the component.

To make this work I created first a jax-ws service and deploy this to an application server.

package nl.whitehorses.soa.ws;

import javax.jws.WebService;

@WebService
public class Helloworld {

public String getResponse( String message){
return message;

}
}

In the tuscany client project we need to generate a webservice proxy client for this webservice.
Create an implemention class for this ws proxy client. In this class we need to add a reference with the name jaxws and a setter. We will use this in the composite xml

package nl.whitehorses.tuscany.step2;

import nl.whitehorses.soa.ws.proxy.Helloworld;
import org.osoa.sca.annotations.Reference;

public class HelloworldServiceImpl implements Helloworld{

private Helloworld jaxws;

@Reference
public void setJaxws(Helloworld jaxws) {
this.jaxws = jaxws;
}

public String getResponse( String message){
return jaxws.getResponse(message);

}
}

create a new composite file where we will add this component and its reference. In the reference we need to provide the web service binding

<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://whitehorses"
name="step2">

<component name="HelloworldCp">
<implementation.java class="nl.whitehorses.tuscany.step2.HelloworldServiceImpl" />
<reference name="jaxws">
<binding.ws wsdlElement="http://ws.soa.whitehorses.nl/#wsdl.port(HelloworldService/HelloworldPort)"
uri="http://localhost:7101/jaxws/HelloworldPort?wsdl#wsdl.interface(HelloworldService)"/>
</reference>
</component>

</composite>

And at last the test client

package nl.whitehorses.tuscany.step2;


import org.apache.tuscany.sca.host.embedded.SCADomain;
import nl.whitehorses.soa.ws.proxy.Helloworld;

public class ClientStep2 {

public final static void main(String[] args) throws Exception {

SCADomain scaDomain = SCADomain.newInstance("step2.composite");
Helloworld helloworld = scaDomain.getService(Helloworld.class, "HelloworldCp");

System.out.println("ws: " + helloworld.getResponse("hello"));

scaDomain.close();
}
}

In step 3 we will expose an component as a service. First step is to make an interface with the methods which we want to expose in this web service. We have to add Remotable annotation.

package nl.whitehorses.tuscany.step3;

import org.osoa.sca.annotations.Remotable;

@Remotable
public interface TuscanyService {

public String getJaxwsResponse( String message);

public String getJavaData();

public String getJavaData2();

}

The implementatation of this component with the Service annotation and off course the references to the other components.

package nl.whitehorses.tuscany.step3;

import nl.whitehorses.soa.ws.proxy.Helloworld;

import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
import nl.whitehorses.tuscany.step1.JavaService;

@Service(TuscanyService.class)
public class TuscanyServiceImpl implements TuscanyService {

private Helloworld helloworldComponent;
private JavaService javaComponent;
private JavaService javaComponent2;

@Reference
public void setHelloworldComponent(Helloworld helloworldComponent) {
this.helloworldComponent = helloworldComponent;
}

@Reference
public void setJavaComponent(JavaService javaComponent) {
this.javaComponent = javaComponent;
}

@Reference
public void setJavaComponent2(JavaService javaComponent2) {
this.javaComponent2 = javaComponent2;
}


public String getJaxwsResponse(String message) {
return helloworldComponent.getResponse(message) ;
}

public String getJavaData() {
return javaComponent.getData();
}

public String getJavaData2() {
return javaComponent2.getData();
}
}


The step3 composite file has a TuscanyServiceComponent with 3 references to the step 1 and 2 components and this component has also a service. In this service we have to provide the ws url.

<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://whitehorses"
name="step3">

<component name="TuscanyServiceComponent">
<implementation.java class="nl.whitehorses.tuscany.step3.TuscanyServiceImpl" />
<reference name="helloworldComponent" target="HelloworldCp" />
<reference name="javaComponent" target="JavaCp" />
<reference name="javaComponent2" target="JavaCp2" />
<service name="TuscanyService">
<binding.ws uri="http://localhost:8085/TuscanyService"/>
</service>
</component>

<component name="JavaCp">
<implementation.java class="nl.whitehorses.tuscany.step1.JavaServiceImpl" />
</component>

<component name="JavaCp2">
<implementation.java class="nl.whitehorses.tuscany.step1.JavaServiceImpl" />
</component>

<component name="HelloworldCp">
<implementation.java class="nl.whitehorses.tuscany.step2.HelloworldServiceImpl" />
<reference name="jaxws">
<binding.ws wsdlElement="http://ws.soa.whitehorses.nl/#wsdl.port(HelloworldService/HelloworldPort)"
uri="http://localhost:7101/jaxws/HelloworldPort?wsdl#wsdl.interface(HelloworldService)"/>
</reference>
</component>

</composite>

The client code which tests the main component and start the service on this component

package nl.whitehorses.tuscany.step3;

import java.io.IOException;
import org.apache.tuscany.sca.host.embedded.SCADomain;

public class ClientStep3 {

public final static void main(String[] args) throws Exception {

SCADomain scaDomain = SCADomain.newInstance("step3.composite");
TuscanyService tuscanyService = scaDomain.getService(TuscanyService.class, "TuscanyServiceComponent");

System.out.println("ws: "+tuscanyService.getJaxwsResponse("hello"));
System.out.println("java: "+tuscanyService.getJavaData());
System.out.println("java2: "+tuscanyService.getJavaData2());

try {
System.out.println("ws service started (press enter to shutdown)");
System.in.read();
} catch (IOException e) {
e.printStackTrace();
}

scaDomain.close();
}
}

Now we can use soapui to test this web service.


In the last step in this blog I will use a second composite which will be called by the first composite.
First we create a new composite xml. We will copy a java component from the step3 composite to this composite. Give this composite a new name and target namespace. We will use these values to import this composite. This component needs a service else we can not call it from the main composite.

<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://whitehorses2"
name="step4_2">

<service name="JavaCpService" promote="JavaCp">
<interface.java interface="nl.whitehorses.tuscany.step1.JavaService"/>
</service>

<component name="JavaCp">
<implementation.java class="nl.whitehorses.tuscany.step1.JavaServiceImpl" />
</component>

</composite>

The main composite called step4_1 need the namespace of the second composite. The JavaCp2 component import the second composite by using the target namespace of the second composite and with its name. In the javaComponent2 reference of the TuscanyServiceComponent will call JavaCp2 component followed by the service name of the second composite.

<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://whitehorses"
xmlns:whitehorses2="http://whitehorses2"
name="step4_1">

<component name="TuscanyServiceComponent">
<implementation.java class="nl.whitehorses.tuscany.step3.TuscanyServiceImpl" />
<reference name="helloworldComponent" target="HelloworldCp" />
<reference name="javaComponent" target="JavaCp" />
<reference name="javaComponent2" target="JavaCp2/JavaCpService" />
<service name="TuscanyService">
<binding.ws uri="http://localhost:8085/TuscanyService"/>
</service>
</component>

<component name="JavaCp">
<implementation.java class="nl.whitehorses.tuscany.step1.JavaServiceImpl" />
</component>

<component name="HelloworldCp">
<implementation.java class="nl.whitehorses.tuscany.step2.HelloworldServiceImpl" />
<reference name="jaxws">
<binding.ws wsdlElement="http://ws.soa.whitehorses.nl/#wsdl.port(HelloworldService/HelloworldPort)"
uri="http://localhost:7101/jaxws/HelloworldPort?wsdl#wsdl.interface(HelloworldService)"/>
</reference>
</component>

<component name="JavaCp2">
<implementation.composite name="whitehorses2:step4_2"/>
</component>
</composite>



and at last the step 4 test client.

package nl.whitehorses.tuscany.step4;

import nl.whitehorses.tuscany.step3.TuscanyService;
import java.io.IOException;
import org.apache.tuscany.sca.host.embedded.SCADomain;

public class ClientStep4 {

public final static void main(String[] args) throws Exception {

SCADomain scaDomain = SCADomain.newInstance("step4_1.composite");
TuscanyService tuscanyService = scaDomain.getService(TuscanyService.class, "TuscanyServiceComponent");

System.out.println("ws: "+tuscanyService.getJaxwsResponse("hello"));
System.out.println("java: "+tuscanyService.getJavaData());
System.out.println("java2: "+tuscanyService.getJavaData2());

try {
System.out.println("ws service started (press enter to shutdown)");
System.in.read();
} catch (IOException e) {
e.printStackTrace();
}

scaDomain.close();
}
}

Here you can download my jdeveloper 11G test project.