我已经实现了一个 Ballerina(ballerina 0.91) 服务来调用在 localhost 上运行的 https REST 服务。我使用 http:ClientConnector 来调用该服务。这是我的示例代码。
http:ClientConnector clientConnector = create http:ClientConnector("https://localhost:9445/");
string token = "admin:admin";
string auth = utils:base64encode(token);
message request = {};
messages:setHeader(request,"Basic ",auth);
message response = clientConnector.get("bpmn/runtime/process-instances/",request);
顺便说一下,我与 WSO2 EI 中的业务流程进行交互。
问题是当我正常调用此服务时,它没有响应或给出如下错误。
error: ballerina.lang.errors:Error, message: failed to invoke 'get' action in ClientConnector. response was not received within sender timeout of 180 seconds
at ballerina.net.http:ClientConnector.get(<native>:0)
at org.wso2.ballerina.connectors.basicauth:ClientConnector.get(org/wso2/ballerina/connectors/basicauth/ClientConnector.bal:28)
at .:main(MainFile.bal:21)