Closed dfsantamaria closed 4 years ago
The problem seems to have a deep cause. Trying
` Web3j web3j = Web3j.build(new HttpService(the_ws_service));
ReadonlyTransactionManager roTransactionManager = new ReadonlyTransactionManager(web3j, the_address);
ContractGasProvider gasProvider = new DefaultGasProvider();
TheContract contract = TheContract.load(the_address, web3j,roTransactionManager, gasProvider);
try
{
contract.amethod().send();
}
catch (Exception ex) {
Logger.getLogger(InfuraWSTest.class.getName()).log(Level.SEVERE, null, ex);
}`
leads to:
org.web3j.protocol.exceptions.ClientConnectionException: Invalid response received: 404; 404 page not found
at org.web3j.protocol.http.HttpService.performIO(HttpService.java:173)
at org.web3j.protocol.Service.send(Service.java:48)
at org.web3j.protocol.core.Request.send(Request.java:87)
at org.web3j.tx.ReadonlyTransactionManager.sendCall(ReadonlyTransactionManager.java:70)
at org.web3j.tx.ManagedTransaction.call(ManagedTransaction.java:134)
at org.web3j.tx.Contract.executeCall(Contract.java:292)
at org.web3j.tx.Contract.executeCallSingleValueReturn(Contract.java:300)
at org.web3j.tx.Contract.executeCallSingleValueReturn(Contract.java:311)
at org.web3j.tx.Contract.lambda$executeRemoteCallSingleValueReturn$1(Contract.java:397)
at org.web3j.protocol.core.RemoteCall.send(RemoteCall.java:42)
at main.InfuraWSTest.main(InfuraWSTest.java:33)
in line
contract.amethod().send();
Wrong usage of web socket in the code.
Whit an Infura WS node, a call to web3j method ethGasPrice() leads to the error
org.web3j.protocol.exceptions.ClientConnectionException: Invalid response received: 404; 404 page not found
Method ethGasPrice() works with an Infura HTTPS node. I'm using web3j 5.0.0.