Overview
Product Features
Underlying Engine
Strengths
Scenarios
Basic Concepts
<dependency><groupId>com.tencentcloudapi</groupId><artifactId>tencentcloud-sdk-java</artifactId><version>3.0.1</version></dependency>
package com.tencent;import com.tencentcloudapi.common.AbstractModel;import com.tencentcloudapi.common.Credential;import com.tencentcloudapi.common.profile.ClientProfile;import com.tencentcloudapi.common.profile.HttpProfile;import com.tencentcloudapi.common.exception.TencentCloudSDKException;import com.tencentcloudapi.tbaas.v20180416.TbaasClient;import com.tencentcloudapi.tbaas.v20180416.models.*;public class Sample{public static void main(String [] args) {try{// Instantiate an authentication object. Input parameters need to be passed in with the SecretId and SecretKey of your Tencent Cloud account. Here, you also need to pay attention to keeping the confidentiality of the key pair.Credential cred = new Credential("", "");// Instantiate an HTTP option, optional, which can be skipped if there is no special requirement.HttpProfile httpProfile = new HttpProfile();httpProfile.setEndpoint("tbaas.intl.tencentcloudapi.com");// Instantiate a client option, optional, which can be skipped if there is no special requirement.ClientProfile clientProfile = new ClientProfile();clientProfile.setHttpProfile(httpProfile);// Instantiate the client object to request the product, and clientProfile is optional.TbaasClient client = new TbaasClient(cred, "ap-hongkong", clientProfile);// Instantiate a request object. Each interface will correspond to a request object.InvokeFabricChaincodeRequest req = new InvokeFabricChaincodeRequest();req.setClusterId("fabric-65z42qi150");req.setChannelId("channel-9xej4d");req.setChaincodeName("fact");req.setFuncName("Set");String[] funcParam1 = {"key", "value"};req.setFuncParam(funcParam1);req.setWithAsyncResult(false);// The returned resp is an instance of InvokeFabricChaincodeResponse, corresponding to the requested object.InvokeFabricChaincodeResponse resp = client.InvokeFabricChaincode(req);// Output string in json format.System.out.println(AbstractModel.toJsonString(resp));} catch (TencentCloudSDKException e) {System.out.println(e.toString());}}}
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan