Expand my Community achievements bar.

How to allow multiple output parameters in a user-defined service operation???

Avatar

Level 1

I have creating a self-defined service operation “LDAPAddUser” to connect to LDAP server to create user accounts. I want to get 2 output parameters after executing the operation. One is the result (Boolean data type) and one is the error message (String data type). However, since Java only support one return value in a method, it seems that only one output parameter can be returned. May I have the suggestion so that multiple parameters can be supported in this case? Here is the extracted code

In Java program,

public Boolean addUser(String url, String aName)

{.....}

In file "component.xml",

     <operation name="addUser" method="addUser" orchestrateable="true" anonymous-access="true">
  <hint>Add a new user</hint>
     <input-parameter name="url" type="java.lang.String" required="true" title="LDAP URL">
     ...
     </input-parameter>

          <input-parameter name="aName" type="java.lang.String" required="true" title="Admin Login Name">
    ...
     </input-parameter>

          <output-parameter name="Result" title="Result" type="java.lang.Boolean">

          ...

          </output-parameter>

Besides the boolean return value, I want to get another return value (string data type). Any suggestion ?

6 Replies

Avatar

Level 4

Usually i only have one output parameter, but use *as many as i need* in/out parameters.

Basicly you define the variable (in workbench) as in/out and when LC:ES generates the service you're able to pass an object as an input parameter and after the invocation ends, the object is updated.

Just like if you where passing an object by ref in c.

Avatar

Level 8

I've returned multiple values to LiveCycle by using a complex object as an intermediatory.

For example if I need to return two strings (firstName and lastName), I'll first build a single class (name) with two string attributes (private String firstName; private String LastName) and add getters and setters to my "name" class for each.  My service class method will return an object of type "name".

for example  public name mymethod(String GUID, String username, String password).......

Then in the component.xml you can return the two strings as long as you use the binding type "Bean":

<output-parameter name="firstName" title="First Name" binding-type="Bean" property="firstName">
                    </output-parameter>

<output-parameter name="lastName" title="Last Name" binding-type="Bean" property="lastName">
                     </output-parameter>

Avatar

Level 4

I think the porpuos of that is to add new components to the workbench process building habilities, not so much to be used as the first option to return multiple values.

I say this because that would make your process developers into Java developers (mandatory) and clearly thats what workbench is trying to prevent. Also if that was to be the 1st option then Adobe's Output among other services (that use one complex object as the return object, but uses 3 or 4 in/out parameters) would not be complient with their best practices.

Still, i though that only applied to adding custom components to LC:ES, never occored to me to use it as a return object to a service, but it does make sense and it will be very helpfull in those hard to do services.