나머지 요청을 처리REST 요청을 호출하고 REST 응답을
POST host:port/chaincode
{
"jsonrpc": "2.0",
"method": "deploy",
"params": {
"type": 1,
"chaincodeID":{
"path":"github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"
},
"ctorMsg": {
"function":"init",
"args":["a", "1000", "b", "2000"]
}
},
"id": 1
}
나머지 응답
{
"jsonrpc": "2.0",
"result": {
"status": "OK",
"message": "52b0d803fc395b5e34d8d4a7cd69fb6aa00099b8fabed83504ac1c5d61a425aca5b3ad3bf96643ea4fdaac132c417c37b00f88fa800de7ece387d008a76d3586"
},
"id": 1
}
내가 요청 및 응답의 세트를 가지고 있고, 그들은 인터페이스 포트가 언급 5000 어떻게 할 이 나머지 요청을 호출하고 응답 결과를 알리십시오. 나는 jquery를 시도했지만 그것을 할 수 없었다. 그들은 계속 나에게 창 오류를 촉구했다.
이 내가
$.post('localhost:5000/chaincode', {
"jsonrpc": "2.0",
"method": "deploy",
"params": {
"type": 1,
"chaincodeID": {
"path": "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"
},
"ctorMsg": {
"function": "init",
"args": ["a", "1000", "b", "2000"]
}
},
"id": 1
}, function (serverResponse) {
alert(serverResponse);
//do what you want with server response
})
시도한 것을 게시하십시오. –
@PaulAbbott가 추가되었습니다. – Alvin