我試圖調用內部Bluemix另一API或者使用IBM Bluemix(API連接)的內部網關腳本中使用下面的代碼的任何其它HTTPS POST方法的HTTPS POST方法:如何調用IBM Bluemix使用gatewayscript APIConnect
var urlopen = require('urlopen');
var options = {
target: 'https://pokemons.mybluemix.net/api/pokemons/1',
method: 'POST',
headers: {},
contentType: 'application/json',
timeout: 60,
data: {"Message": "DataPower GatewayScript"}
};
urlopen.open(options, function(error, response) {
if (error) {
// an error occurred during the request sending or response header parsing
session.output.write("urlopen error: "+JSON.stringify(error));
} else {
// get the response status code
var responseStatusCode = response.statusCode;
var responseReasonPhrase = response.reasonPhrase;
console.log("Response status code: " + responseStatusCode);
console.log("Response reason phrase: " + responseReasonPhrase);
// reading response data
response.readAsBuffer(function(error, responseData){
if (error){
throw error ;
} else {
session.output.write(responseData) ;
apim.output('application/json');
}
});
}
});
但我收到以下錯誤:
{
"httpCode": "500",
"httpMessage": "Internal Server Error",
"moreInformation": "URL open: Cannot create connection to 'https://pokemons.mybluemix.net/api/pokemons/1', status code: 7"
}
看起來有一些問題與SSL連接。如果是這樣,我如何在IBM Bluemix API Connect中獲取默認沙盒目錄的SSL詳細信息?或者,我如何使HTTPS POST調用上面的示例URL?