外部接口管理
外部接口管理服务主要用于管理第三方提供的REST接口、WebService Axis2接口及其凭证,后台服务可通过SDK的方式调用第三方接口,从而实现与第三方服务进行通信,简化了第三方接口集成的复杂度。
SDK使用
在画面中创建接口凭证和接口定义
略
在pom.xml中添加依赖:
<dependency>
<groupId>com.sofast.cloud</groupId>
<artifactId>so-fast-external-api-sdk</artifactId>
</dependency>
注入外部接口Feign
@Resource
private IExternalApiFeign iExternalApiFeign;
执行Rest请求
R<Object> result = iExternalApiFeign.restReqExecute(restReqParamDto);
参数说明
// 接口定义的唯一编码:必填
restReqParamDto.setCode();
// 请求Header:非必填
restReqParamDto.setReqHeader();
// 请求Param:非必填
restReqParamDto.setReqParam();
// 请求Body:非必填
restReqParamDto.setReqBody();
// 外部接口调用策略:非必填,未设置时使用外部接口服务的配置信息
restReqParamDto.setExternalApiStrategy());
// 外部接口调用策略说明
// 异步Flg:true(异步);false(同步);默认为false
externalApiStrategy.setAsyncFlg();
// 超时时长:单位为秒;默认为30
externalApiStrategy.setTimeOut();
// 以凭证为主Flg:按接口定义中选择的凭证发起请求;默认为true
externalApiStrategy.setBaseOnCertFlg();