【问题标题】:Got a timeout error when I send an email using gmail:ClientConnector in ballerinalang当我在 ballerinalang 中使用 gmail:ClientConnector 发送电子邮件时出现超时错误
【发布时间】:2017-09-02 02:41:21
【问题描述】:

我尝试在 ballerina 中实现一个程序,以使用 ballerina gmail:ClientConnector 和 gmail API 发送电子邮件。但它给出了如下所示的超时错误。

error: ballerina.lang.errors:Error, message: failed to invoke 'post' action in ClientConnector. response was not received within sender timeout of 180 seconds
    at ballerina.net.http:ClientConnector.post(<native>:0)
    at org.wso2.ballerina.connectors.oauth2:ClientConnector.post(org/wso2/ballerina/connectors/oauth2/ClientConnector.bal:53)
    at org.wso2.ballerina.connectors.gmail:ClientConnector.sendMail(org/wso2/ballerina/connectors/gmail/gmailConnector.bal:631)
    at .:main(helloworld.bal:26)

这是我实现的代码。

import org.wso2.ballerina.connectors.gmail;



function main (string[] args) {


    string clientId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    string clientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    string userId = "webmisproject@gmail.com";
    string accessToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    string refreshToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    gmail:ClientConnector gmailConnector = create gmail:ClientConnector(userId,accessToken,refreshToken,clientId,clientSecret);

    string to = "b.wathsala.bw@gmail.com";
    string subject = "Test Mail";
    string from = "webmisproject@gmail.com";
    string messageBody = "Hello Buddhi";
    string cc = "";
    string bcc = "";
    string id = "";
    string threadId = "";
    message gmailResponse;


    gmailResponse = gmail:ClientConnector.sendMail(gmailConnector,to,subject,from,messageBody,cc,bcc,id,threadId);


}

我在 main 函数和 ballerina 中的服务中实现了这段代码,但两者都给出了相同的错误。而且给出这个错误需要一点时间。

【问题讨论】:

    标签: gmail-api ballerina


    【解决方案1】:

    我解决了这个问题。我使用了 UBUNTU 14.04。但是当我在 UBUNTU 16.04 中运行该代码时,问题就解决了。所以我认为问题出在 UBUNTU 14.04 中。但我不知道 UBUNTU 14.04 中的确切问题是什么。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-11-24
      • 1970-01-01
      • 2015-03-08
      • 2014-06-07
      • 2015-02-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多