View comments | RSS feed
Take a survey

Invoking LiveCycle ES > Invoking LiveCycle ES Using the Java API > Setting connection properties

Setting connection properties
You must set connection properties to invoke services when using the Java API. When setting connection properties, you specify whether to invoke services remotely or locally, the connection mode, and authentication values.
The connection mode can either be SOAP or EJB mode. The EJB mode uses the RMI/IIOP protocol and the performance of the EJB mode is better than the performance of the SOAP mode. Typically the SOAP mode is used in situations where you do not want a J2EE application server dependency or if a firewall is located between LiveCycle ES and the client application. The SOAP mode uses the HTTPS protocol as the underlying transport and is able to communicate across firewall boundaries. If neither a J2EE application server dependency nor a firewall is an issue, then it is recommended that you use the EJB mode.
In order to successfully invoke a service, set the following connection properties:
DSC_DEFAULT_EJB_ENDPOINT: If you are using the EJB connection mode, this value represents the JNDI context provider URL of the J2EE application server on which LiveCycle ES is deployed. To remotely invoke LiveCycle ES, specify the J2EE application server name on which LiveCycle ES is deployed. If your client application is located on the same J2EE application server, then you can specify localhost. Depending upon which J2EE application server LiveCycle ES is deployed on, specify one of the following values:
JBoss: jnp://<ServerName>:1099 (default port)
WebSphere: iiop://<ServerName>:2809 (default port)
WebLogic: t3://<ServerName>:7001 (default port)
DSC_DEFAULT_SOAP_ENDPOINT: If you are using the SOAP connection mode, this value represents the endpoint to where an invocation request is sent. To remotely invoke LiveCycle ES, specify the J2EE application server name on which LiveCycle ES is deployed. If your client application is located on the same J2EE application server, then you can specify localhost. For example: http://localhost:8080.
Note: The port value 8080 is applicable if the J2EE application is JBoss. If the J2EE application server is WebSphere, then use port 9080. Likewise, if the J2EE application server is WebLogic, then use port 7001. (These are default port values. If you change the port value, then use the applicable port number.)
DSC_TRANSPORT_PROTOCOL: If you are using the EJB connection mode, specify EJB for this value. If you are using the SOAP connection mode, specify SOAP.
DSC_SERVER_TYPE: Specifies the J2EE application server on which the LiveCycle ES is deployed. Valid values are: JBoss, WebSphere, WebLogic.
Note: The java.naming.factory.initial value is set to com.ibm.ws.naming.util.WsnInitCtxFactory if you set this connection property to WebSphere. If you set this connection property to WebLogic, then the java.naming.factory.initial value is set to weblogic.jndi.WLInitialContextFactory. Likewise, if you set this connection property to JBoss, then the java.naming.factory.initial value is set to org.jnp.interfaces.NamingContextFactory. You can set the java.naming.factory.initial property to a value that meets your requirements if you do not want to use the default values.
Note: Instead of using a string to set the DSC_SERVER_TYPE connection property, you can use a static member of the ServiceClientFactoryProperties class. The following values can be used: ServiceClientFactoryProperties.DSC_WEBSPHERE_SERVER_TYPE, ServiceClientFactoryProperties.DSC_WEBLOGIC_SERVER_TYPE, or ServiceClientFactoryProperties.DSC_JBOSS_SERVER_TYPE.
DSC_CREDENTIAL_USERNAME: Specifies the LiveCycle ES user name.
DSC_CREDENTIAL_PASSWORD: Specifies the corresponding password value.
To set connection properties, perform the following tasks:
1.
Create a java.util.Properties object by using its constructor.
2.
Invoke the java.util.Properties object’s setProperty method for each connection property to set.
Setting the EJB connection mode
The following Java code example sets connection properties to invoke LiveCycle ES that is deployed on JBoss and using the EJB connection mode.
Properties ConnectionProps = new Properties();
ConnectionProps.setProperty("DSC_DEFAULT_EJB_ENDPOINT", "jnp://localhost:1099");
ConnectionProps.setProperty("DSC_TRANSPORT_PROTOCOL","EJB");          
ConnectionProps.setProperty("DSC_SERVER_TYPE", "JBoss");
ConnectionProps.setProperty("DSC_CREDENTIAL_USERNAME", "administrator");
ConnectionProps.setProperty("DSC_CREDENTIAL_PASSWORD", "password");
Setting the EJB connection mode for WebLogic
The following Java code example sets connection properties to invoke LiveCycle ES that is deployed on WebLogic and using the EJB connection mode.
Properties ConnectionProps = new Properties();
ConnectionProps.setProperty("DSC_DEFAULT_EJB_ENDPOINT", "t3://localhost:7001");
ConnectionProps.setProperty("DSC_TRANSPORT_PROTOCOL","EJB");          
ConnectionProps.setProperty("DSC_SERVER_TYPE", "WebLogic");
ConnectionProps.setProperty("DSC_CREDENTIAL_USERNAME", "administrator");
ConnectionProps.setProperty("DSC_CREDENTIAL_PASSWORD", "password");
Setting the EJB connection mode for WebSphere
The following Java code example sets connection properties to invoke LiveCycle ES that is deployed on WebSphere and using the EJB connection mode.
Properties ConnectionProps = new Properties();
ConnectionProps.setProperty("DSC_DEFAULT_EJB_ENDPOINT", "iiop://localhost:2809");
ConnectionProps.setProperty("DSC_TRANSPORT_PROTOCOL","EJB");          
ConnectionProps.setProperty("DSC_SERVER_TYPE", "WebSphere");
ConnectionProps.setProperty("DSC_CREDENTIAL_USERNAME", "administrator");
ConnectionProps.setProperty("DSC_CREDENTIAL_PASSWORD", "password");
Setting the SOAP connection mode
The following Java code example sets connection properties in SOAP mode to invoke LiveCycle ES deployed on JBoss.
Properties ConnectionProps = new Properties();
ConnectionProps.setProperty("DSC_DEFAULT_SOAP_ENDPOINT", "http://localhost:8080");
ConnectionProps.setProperty("DSC_TRANSPORT_PROTOCOL","SOAP"); 
ConnectionProps.setProperty("DSC_SERVER_TYPE", "JBoss");
ConnectionProps.setProperty("DSC_CREDENTIAL_USERNAME", "administrator");
ConnectionProps.setProperty("DSC_CREDENTIAL_PASSWORD", "password");
Note: If you select the SOAP connection mode, then you must include additional JAR files in your client application’s class path. For information, see Including LiveCycle ES library files.

Comments


No screen name said on Oct 15, 2007 at 8:47 AM :
Reading through the document, I reads like a requirement to use
connection properties. Which implies remote connections only.

The document says use "localhost" if you are on the same JVM, if you
use iiop://localhost or something similar the default port is used which
may not be the case. You cannot simply pass in "localhost".

The document should mention using the following:
ServiceClientFactory.createInstance() where you are running the code
on the same JVM and there are is no security attached to the service.
No screen name said on Nov 28, 2007 at 2:13 AM :
Wouldn't it be cleaner to use the constants defined in ServiceClientFactoryProperties for this?

Like:

Properties ConnectionProps = new Properties();
ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "jnp://localhost:1099");
ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL, ServiceClientFactoryProperties.DSC_EJB_PROTOCOL);
ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, ServiceClientFactoryProperties.DSC_JBOSS_SERVER_TYPE);
ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");
smacdonald2008 said on Dec 3, 2007 at 10:38 AM :
All Java code examples are going to be updated to include constants in connection properties as opposed to strings.

Thanks for your comment.
No screen name said on Jan 9, 2008 at 1:09 PM :
How will it be when you are not using the remote connection?

I mean when you are working in a desktop application without server connection.
smacdonald2008 said on Feb 11, 2008 at 7:14 PM :
You can use LiveCycle without a network connection for dev purposes when LiveCycle is installed on the local computer. In this situation, specify localhost when setting either DSC_DEFAULT_EJB_ENDPOINT or DSC_DEFAULT_SOAP_ENDPOINT properties.
No screen name said on Feb 3, 2009 at 9:46 PM :
i'm using same program to retrieve information from PDF but i'm getting
error -

Failed to connect to LiveCycle server via RMI. Make sure that the server is
running and accessible to this client.


though i'm using Life cycle JBOSS and jdk1.5.0_17 as specified,

please let me know the steps to use this code, also for following line -

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CRED
ENTIAL_USERNAME, "administrator");

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CRED
ENTIAL_PASSWORD, "password");


where can i get DSC configurations like username and password.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/invokingJava.22.3.html