All Products
Search
Document Center

CloudFlow:Install Serverless Workflow SDK for Java

Last Updated:Oct 30, 2023

This topic describes how to install Serverless workflow SDK for Java. This topic also provides an example on how to use the SDK to call API operations.

Prerequisites

  • An Alibaba Cloud account and an AccessKey pair are created. An AccessKey pair contains an AccessKey ID and an AccessKey secret. You can go to the Security Management page of the Alibaba Cloud Management Console to create and view AccessKey pairs. You can also contact your system administrator to obtain an AccessKey pair.
  • Serverless Workflow is activated in the Alibaba Cloud Management Console. This allows you to use Alibaba Cloud SDK for Java to call the API operations of Serverless Workflow.
  • Java Development Kit (JDK) 1.6 or later is installed.

Dependency installation

You must install aliyun-java-sdk-core to use the SDK of an Alibaba Cloud service. For example, to use Serverless workflow SDK, you must install aliyun-java-sdk-core and aliyun-java-sdk-fnf.

We recommend that you use Apache Maven to manage project dependencies. If you use Apache Maven to manage a Java project, add the following dependencies to the pom.xml file of the project directory: Example:

<dependency>
    <groupId>com.aliyun</groupId>
    <artifactId>aliyun-java-sdk-core</artifactId>
    <version>[4.3.2,5.0.0)</version>
</dependency>
<dependency>
    <groupId>com.aliyun</groupId>
    <artifactId>aliyun-java-sdk-fnf</artifactId>
    <version>[1.0.0,5.0.0)</version>
</dependency>

If you do not use Apache Maven to download the JAR package from the central repository, add the following dependency to the pom.xml file. Otherwise, a NoClassDefFoundError error is reported.

<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.8.5</version>
</dependency>        

SDK sample code

You can use the API-level SDK demos of different languages for debugging. For sample code, visit OpenAPI Explorer.