First, for this example, you'll need to import several BPEL API classes:
import com.oracle.bpel.client.BPELDomainStatus;
import com.oracle.bpel.client.Server;
import com.oracle.bpel.client.auth.ServerAuth;
import com.oracle.bpel.client.auth.ServerAuthFactory;
The next task is to configure a java.util.Properties object with the connection information for your BPEL server, as well as a String object containing the security credentials (password):
Properties props = new java.util.Properties();
props.put("orabpel.platform", "ias_10g" );
props.put("java.naming.factory.initial",
"com.evermind.server.rmi.RMIInitialContextFactory" );
props.put("java.naming.provider.url",
"opmn:ormi://bpelserver:6003:home/orabpel" );
props.put("java.naming.security.principal", "oc4jadmin" );
props.put("java.naming.security.credentials", "password123" );
String securityCredentials = "password123";
We are now ready to get a ServerAuth object from the ServerAuthFactory:
ServerAuth auth = ServerAuthFactory.authenticate(securityCredentials, null, props);
Next, we get an actual client connection to the server by creating a Server object and passing the constructor our ServerAuth object:
Server srv = new Server(auth);
Finally, we can get the list of domain status information by calling the getAllDomainStatus() method of the server:
BPELDomainStatus domainList[] = srv.getAllDomainStatus();
Now that you have the status information you can do any number of things, in our example we can print out the domain ID of each domain on the server with this code:
for (int i=0; i<domainList.length; i++ ) {
System.out.println( "Domain ID="+domainList[i].getDomainId() );
}
2 comments:
Hi Charles,
I tried your code, I got an java.lang.Exception: Failed to create "ejb/collaxa/system/ServerBean" bean; exception reported is: "javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
Is there a resource that I need to add?
I am running the program in JDeveloper. My environment is :
BPEL Designer 10.1.3.3.0 (Build 070615.0525)
Java(TM) Platform 1.5.0_06
Oracle IDE 10.1.3.41.57
This exception is usually thrown when the connection string information supplied is not correct. Most likely this is a problem with the RMI port -- which for me was 6003, but may be different depending on your installation.
Post a Comment