Friday, November 6, 2009

Calling Java Classes from SOA Suite 11g

Essentially the same procedure, from a development perspective, as in 10g -
but under the hood we're using the 11g Infrastructure layer.

The Oracle documentation can be found at

Here's a simple example based on WSDL Java binding, later posts will cover bpel:exec etc. -

1. Create a generic Application/Project in Jdev 11g

1.1. Add 2 classes - Cust & Greeting

Cust -

package cccwsif;

public class Cust {

private String custName1;
private String custName2;
private String custXMASgreeting;

public Cust() {

public void setCustName1(String custName1) {
this.custName1 = custName1;

public String getCustName1() {
return custName1;

public void setCustName2(String custName2) {
this.custName2 = custName2;

public String getCustName2() {
return custName2;

public void setCustXMASgreeting(String custXMASgreeting) {
this.custXMASgreeting = custXMASgreeting;

public String getCustXMASgreeting() {
return custXMASgreeting;

Greeting -

package cccwsif;

public class Greeting {
public Greeting() {

public Cust XMASgreet(Cust c){
String g = "Happy Christmas " + c.getCustName1() + " " +
return c;

1.2. expose Greeting as a Web Service
1.2.1. Right-mouse click on Greeting
1.2.2. Then select "Create Web Service..."

1.2.3. Accept defaults for all steps up until step 9.
1.2.4. Additional Classes --> Include "Cust" class

1.2.5. open the wsdl file and set nillable=false

1.2.6. open the GreetingService-java-wsdl-mapping.xml file
1.2.7. check the mapping order

1.3. Add the Java Binding to the WSDL
1.3.1. Open the wsdl in "Design" mode
1.3.2. Click the + by Bindings

1.3.3. Click the Map button
1.3.4. select the Cust class

1.3.5. Amend the Service entry in the WSDL as follows -

1.4. Jar up the project
1.4.1. File --> New --> Deployment Profile --> Jar
1.4.2. Deploy to Jar

2. Create a SOA App in JDev 11g

2.1. Copy the WSDL into the project

2.2. Drop a BPEL service component onto the designer
2.2.1. Set input / output as follows -

2.3. Add a partner Link to the process, pointing to the imported WSDL
2.3.1. Add Assign - Invoke - Assign Activities

2.3.2 Assign input / output vars in the 2 Assigns
2.4. Copy the Jar file from the previous project to the SOA Project sca-inf\lib directory

2.5. Deploy the SOA App

3 Test


viju said...

Very nicely explained. Can you post an example for bpel:exec ... too.

Niall Commiskey said...

Will do, within the next week

Anonymous said...

After following all the steps i'm getting an exception while testing the webservice saying
"Either the WSDL URL is invalid or the WSDL file is not valid or incorrect. - Failed to model port: {http://cccwsif/}JavaPort Reason: Not a SOAP or HTTP Port Detail: No SOAP or HTTP Address"....

Kindly suggest on the same...!!!

Niall Commiskey said...

I'm currently traveling but will try this out again tomorrow. Are you using Patchset 2?

Anonymous said...

Dear Niall Commiskey,
Thanks for the responce....
Yes the version i'm using is
Can u post the code inside the GreetingService.wsdl
Also do we need to create another porttype by name "JavaPort".

if possible can u mail me this entire project on


Anonymous said...

Dear Niall,
Can u plz help me on my previous query......


Niall Commiskey said...

Hi Rupesh,

I tried my original lab out on PS 2 and I'm hitting the same issue as you. I will look into it asap. In the meantime my most recent post discusses using Spring to integrate Java - might also be interesting for you!

Anonymous said...

Hi Niall,

I am Suman,
Me too getting same issue,i am using
Weblogic 10.3.3

Either the WSDL URL is invalid or the WSDL file is not valid or incorrect. - Failed to model port: {http://wsifproj/}JavaPort Reason: Not a SOAP or HTTP Port Detail: No SOAP or HTTP Address.

Will u plz help us to resolve this issue.

Anonymous said...

Dear Niall,
Did u got any resolve if the issue......

Can u share a sample project with Java Binding to access a webservice through Partnerlink.