Before proceed with the development work, some constraints need to be followed.
1. Usually BPEL process is linked with WebService binding exposed service. If we need to call the composite from java, we need to add Direct Binding service. But we also have to make sure that Direct Binding service is not feeding the payload data to BPEL process. Here is the section we need to add in composite.xml
1. Click on the Exposed Service and click on Insert
2. Select Direct Binding
3. Give a name (e.g. DService1).
4. Select the WSDL same as the web service binding (e.g. ManualAction.wsdl in my example).
5. Choose the port type as the non-callback service (e.g. ManualAction in my example).
6. Choose the Callback Port Type as callback service (e.g. ManualActionCallback.wsdl in my example).
7. Click ok to create the binding.
11. Now the SOA composite is ready. We have to create a java call for this composite.
12. Create a simple java project and below libs to the classpath
Febric-common.jar
Soa-infra-mgmt.jar
Wsclient-extended.jar
Wlfulclient.jar
Common-logging.jar
13. Use the below code to a new class file.
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import javax.naming.Context;
import oracle.soa.api.JNDIDirectConnectionFactory;
import oracle.soa.api.PayloadFactory;
import oracle.soa.api.XMLMessageFactory;
import oracle.soa.api.invocation.DirectConnection;
import oracle.soa.api.invocation.DirectConnectionFactory;
import oracle.soa.api.message.Message;
import oracle.soa.api.message.Payload;
import oracle.xml.parser.v2.XMLPrintDriver;
import org.xml.sax.InputSource;
public class TestWF1 {
public TestWF1() {
super();
}
public static void main(String[] args) throws Exception {
String operation = "process";
// This is the request message XML
String ns = "http://xmlns.oracle.com/TestWLWS/ManualAction/ManualAction";
String payloadXML = "<process anualaction="" estwlws="" http:="" xmlns.oracle.com="" xmlns="\">" +
"<oldvalue>1</oldvalue>" +
"<newvalue>Testing</newvalue>" +
"<approverusername>REQUAP9</approverusername>" +
"<approverrolename>2</approverrolename>" +
"<workflowrequired>3</workflowrequired>" +
"<processinstancekey>4</processinstancekey>" +
"<targetprocesstaskname>5</targetprocesstaskname>" +
"<currentprocesstaskinstancekey>6</currentprocesstaskinstancekey>" +
"<applicationname>7</applicationname>" +
"<beneficiaryuserlogin>8</beneficiaryuserlogin>" +
"<beneficiaryuserkey>123654789</beneficiaryuserkey>" +
"<processformfieldname>10</processformfieldname>" +
"</process>";
String serviceAddress = "soadirect:/default/ManualAction!1.0/DService1";
// Specify the direct binding connection properties
Map<string object=""> props = new HashMap<string object="">();
props.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
props.put(Context.PROVIDER_URL, "t3://" + "localhost" + ':' + "8001");
props.put(Context.SECURITY_PRINCIPAL,"weblogic");
props.put(Context.SECURITY_CREDENTIALS, "Welcome1");
// Create the direct binding connection, using those context properties
DirectConnectionFactory factory = JNDIDirectConnectionFactory.newInstance();
DirectConnection dc = null;
try {
dc = factory.createConnection(serviceAddress, props);
oracle.xml.parser.v2.DOMParser op = new oracle.xml.parser.v2.DOMParser();
op.parse(new InputSource(new StringReader(payloadXML)));
XMLPrintDriver pd = new XMLPrintDriver(System.out);
pd.setFormatPrettyPrint(true);
pd.printDocument(op.getDocument());
Map partData = new HashMap();
partData.put("payload", op.getDocument().getDocumentElement());
Payload payload = PayloadFactory.createXMLPayload(partData);
Message request = XMLMessageFactory.getInstance().createMessage();
request.setPayload(payload);
String uuid = "uuid:" + UUID.randomUUID();
System.out.println("uuid = "+ uuid);
request.setProperty(request.CONVERSATION_ID, uuid);
dc.post("process", request);
} catch(Exception e){
e.printStackTrace();
}finally {
dc.close();
}
}
}
14. After running the code check from the Weblogic EM console, by checking in instance of the composite


















































