Java remote call Wallet RPC HTTP/1.1 401 Unauthorized


Electroneum-wallet-rpc was executed with the --rpc-login argument as username:password, then follow this example
curl -X POST -d ‘{“jsonrpc”:“2.0”,“id”:“0”,“method”:“get_transfer_by_txid”,“params”:{“txid”:“580daa83a1fc4e6acab4e709da8d9260e0c9b9d11d0b509291460c9feb6a66df”}}’ -H ‘Content-Type: application/json’ -u username:password --digest ,It can be called normally,Because that’s how console commands are called, but we’re going to call them in Java code

so,Calls are made through methods in the jsonrpc4j package,The code example is as follows

// Create RPC connections
client = new JsonRpcHttpClient(new URL(url));
// Generate the credential secret key
String creb = Base64.encodeBase64String((rpcuser + “:” + rpcpassword).getBytes());//Methods 1
String creb = MD5.digest(rpcuser + “:” + rpcpassword,false); // Methods 2
// Generate the credential secret key
Map<String, String> headers = new HashMap<String, String>() {{
put(“Content-Type”, “application/json”);
put(“Content-Encoding”, “gzip”);
put(“Authorization”, "Basic " + creb);
// Sets the request header object

The execution results prompt is: pairs: {null: HTTP/1.1 401 Unauthorized}{Server: Epee-based}{Content-Length: 98}{Content-Type: text/html}{Last-Modified: Tue, 11 Dec 2018 07:01:18 GMT}{Accept-Ranges: bytes}{WWW-authenticate: Digest qop=“auth”,algorithm=MD5,realm=“electroneum-rpc”,nonce=“YYezH3kN9lySt7eh4ZJXPQ==”,stale=false}{WWW-authenticate: Digest qop=“auth”,algorithm=MD5-sess,realm=“electroneum-rpc”,nonce=“YYezH3kN9lySt7eh4ZJXPQ==”,stale=false}

However, I perform other RPC interfaces that also require login authentication, but can normally call and return HTTP/1.1 200


@andrepatta maybe you will be able to respond seems like some type of message that i see often at Github…


Is there any solution to this problem?


Try to create this issue at