Open topic with navigation

TIBCO GridServer® 7.1.0

# Submitting Requests Synchronously

Work requests can be submitted to a Service synchronously or asynchronously. Let us go through submitting a request synchronously first. Depending on the number of input arguments you have for the Service function, you can use the `execute` or `executeWithArray` function.

Both `execute` functions take in three arguments:

| 1. | `methodName` — the name of the method to invoke.

| 2. | `data` — the input data.

| 3. | `discriminator` — the discriminator used for this request; discriminators are discussed in a later section.

Both return the output data as a string. The input and output arguments are restricted to strings, for reasons of network serialization, and better interoperability between clients and Services of different languages.

The only difference between the two functions is that `executeWithArray` accepts an array of strings as the input data argument, whereas `execute` accepts a single string.

For example:

    Dim numInMemory As String
    numInMemory = service.execute("getMemory", "", Nothing)
    Dim sum As String
    Dim args(1) As String
    args(0) = "25"
    args(1) = "75"
    sum = service.executeWithArray("add", args, Nothing)

If the Engine-side function being executed takes one or no arguments, it is more convenient to use `execute`; otherwise, place your arguments in an array, and pass them into `executeWithArray`. If the function takes no arguments, like the `getMemory` function, use `execute` with an empty string.

The `execute` functions do not return until the Service completes the request and returns the result. To have the function return immediately, use the submit function to submit requests asynchronously, as described below.

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO GridServer®

Copyright © 2001-2022. TIBCO Software Inc. All Rights Reserved.