2017-09-02 37 views
0

我嘗試在芭蕾舞女演員中使用ballerina gmail發送電子郵件:使用gmail API的ClientConnector中的程序。但它會產生如下的超時錯誤。當我使用Gmail發送電子郵件時發生超時錯誤:ClientConnector in ballerinalang

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 = "[email protected]"; 
    string accessToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; 
    string refreshToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; 
    gmail:ClientConnector gmailConnector = create gmail:ClientConnector(userId,accessToken,refreshToken,clientId,clientSecret); 

    string to = "[email protected]"; 
    string subject = "Test Mail"; 
    string from = "[email protected]"; 
    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); 


} 

我實現這個代碼作爲主要功能,以及在芭蕾舞演員的服務,但都給予同樣的error.As以及它需要一點時間給這個錯誤。

回答

0

我解決了這個問題。我使用了UBUNTU 14.04。但是當我在UBUNTU 16.04中運行這個代碼時,問題就解決了。所以我認爲問題出在UBUNTU 14.04。但我不知道UBUNTU 14.04中的確切問題是什麼。

相關問題