【发布时间】:2018-03-30 19:14:31
【问题描述】:
我是一名超级账本作曲家的开发者。我尝试将 Calling an HTTP or REST API from Transaction Processor Functions 与方法 POST 和请求正文一起使用,但我的错误状态代码为 500。我想将方法 POST 与请求正文一起使用到我的服务器。
我的代码:
async function testStocks(transaction) {
const participant = getCurrentParticipant();
const json = '{"name:tester"}';//my request body
await request.post({ uri: 'http://www...', json });
// Update the current participant in the participant registry.
const participantRegistry = await getParticipantRegistry('org.example.Trader');
await participantRegistry.update(participant);
}
我的错误:
{
"error": {
"statusCode": 500,
"name": "Error",
"message": "Error trying invoke business network. Error: No valid responses from any peers.\nResponse from attempted peer comms was an error: Error: 2 UNKNOWN: error executing chaincode: transaction returned with failure: StatusCodeError: 400 - undefined",
"stack": "Error: Error trying invoke business network. Error: No valid responses from any peers.\nResponse from attempted peer comms was an error: Error: 2 UNKNOWN: error executing chaincode: transaction returned with failure: StatusCodeError: 400 - undefined\n at _initializeChannel.then.then.then.then.catch (/home/pc/.nvm/versions/node/v8.10.0/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:965:34)\n at <anonymous>"
}
}
【问题讨论】:
标签: hyperledger hyperledger-composer