Java Invoke
Java Invoke is a synchronous activity that can be used to invoke a Java class method. You can construct an instance of the specified Java class, if you invoke the constructor for the class.
General
The General tab has the following fields.
Field | Literal Value/Module Property | Description |
---|---|---|
Name | None | The name to be displayed as the label for the activity in the process. |
Java Global Instance | Yes | Specify the resource in this field to execute methods on shared Java objects created by Java Global Instance resources.
For more information about the shared Java objects created by Java Global Instance resources, see Java Global Instance. This disables the options on the Advanced tab. In the drop-down list in the Method field, you can select the method to execute. Note: If the configuration of the Java Global Instance resource changes, select and view any
Java Invoke activities in your process that reference the Java Global Instance to automatically propagate the changes. An exception is raised if you attempt to test your process before refreshing the reference to the Java Global Instance. You may need to manually update the mappings of any input or output, if you select a new method with a different signature in the Java Global Instance resource.
|
MultiOutput | None | Select this check box to specify multiple parameters in the Java invoke method. |
Class Name | None | The declared Java class whose method you want to execute. Use the
Browse A Class button to select the class, or use the
Java Global Instance field to specify a shared Java object.
Note: To log steps in appnode log, from the custom java code, add the jar file
rg.slf4j(1.8.0) to Import Packages under Module dependencies and in the java code add the below code
import org.slf4j.*; . . . Logger logger = LoggerFactory.getLogger("mylogger"); logger.info("my logger");Under appnode, add the logger part in the logback.xml file <logger name="mylogger"> <level value="INFO"/> </logger> |
Method | None | The method in the selected Java class you want to execute.
You can use the drop-down list to select a different method in the selected Java class, if required. |
Parameters | None | The parameters for the
Java Invoke activity. This element is available when the
MultiOutput check box is selected.
This element contains a list of input and output parameters that are required for the Java invoke. This element is not available when the selected method has no parameters. Each Input and Output parameter has the following fields.
|
Advanced
The Advanced tab has the following fields.
Output
The following is the output of the activity.
Output Item | Datatype | Description |
---|---|---|
MethodReturnValue | varies | The
Output
tab has the return value specified for the Java invoke
Method selected on the
General tab.
This element is not available for methods that return void. |
Parameters | varies | The
Output
tab lists all output parameters specified on the
General tab.
Selecting MultiOutput on the General tab makes this output item available. |
Fault
The Fault tab lists the exceptions generated by this activity. Selecting a method to invoke lists the exceptions generated by the method.
In theJava Invoke activity:
- If MultiOutput is selected, the Fault tab generates the InvocationException exception with error schema element as msg,msgCode,methodName,exceptionClassName,exceptionMessage.
- If MultiOutput is not selected, the Fault tab displays the exceptions generated by the method selected in it with error schema elements as: 1:Java exception Object 2:exceptionClassName 3:exceptionMessage
- If MultiOutput is not selected and method does not generate any exception, again the Fault tab shows InvocationException with error schema element as msg, msgCode, methodName, exceptionClassName, and exceptionMessage.
Error Schema Element | Datatype | Description |
---|---|---|
msg | string | The error message. For more information, see Error Codes. |
msgCode | string | The error code. For more information, see Error Codes. |
methodName | string | The name of the Java method that raised the exception. |
exceptionClassName | string | The exception class name.
The value of this element is obtained by calling the <exception>.getClass().getName() method. |
exceptionMessage | string | The exception message.
The value of this element is obtained by calling the <exception>.getMessage() method. |