Open topic with navigation

TIBCO GridServer® 7.1.0

# Setting up the Service

The Service in this example simulates a simple calculator, with functions for the four operators, plus a memory function. The Java source code is available in the GridServer SDK, in `/GridServerSDK-win32/examples/service/calculator/service/java/`.

The `JavaCalculator` class has a floating-point field called `memory`, and the following methods:

| • | `add`, `subtract`, `multiply`, `divide` — each takes two strings representing floating-point numbers, and returns a string representing the result of the arithmetic operation.

| • | `addToMemory` — takes in one string argument representing a floating-point number, and stores the sum of the input and `memory` values back in `memory`.

| • | `setMemory` — takes in one string argument representing a floating-point number and sets the `memory` field equal to it.

| • | `getMemory` — takes in a string argument, and returns the value of `memory`. (The argument is unused, but is required by the Services API.)

Before the client can access the Service, we have to register a Service Type and deploy the Service resources. Make sure the Service Type is registered under the name `JavaCalculatorExample` in the GridServer Service Type Registry; this is how we reference the Service from the client. The Service is automatically registered when GridServer is installed.

If the Grid Library has not been deployed, build and deploy it from `GridServerSDK-win32/examples/service/calculator/` by running `build-and-deploy.bat`.

To find out more about writing, registering, and deploying a Service, see the TIBCO GridServer® Service-Oriented Integration Tutorial.

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.