Calling stream's publish method via RESTful web service

+2 votes
I got the error below on calling publish via spring RESTful web service.

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML>
<HEAD>
<TITLE>Error</TITLE>
<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>
</HEAD>
<BODY><H1>401 Unauthorized.</H1></BODY>
</HTML>

 

Please find the request string below. I used postman as a client.

 

{"method":"publish","id":1,"params":["StreamName","99999999999","hex_string"],"chain_name":"ChainName"}

 

Please what am i doing wrong.
asked Oct 23, 2017 by typedef

1 Answer

+2 votes
 
Best answer

The issue is probably that your MultiChain node is not accepting incoming API requests from this remote service. See the extensive documentation in the forum about the rpcallowip parameter.

answered Oct 23, 2017 by MultiChain
selected Oct 27, 2017 by typedef
@MultiChain
I am still having the issue. Please can you point me to the rpcallowip parameter documentation. Please find below my configuration.

rpcuser=multichainrpc
rpcpassword=password
rpcallowip=127.0.0.1
rpcport=7326
rpchost=127.0.0.1

//Java Code
       HttpClient httpClient = HttpClientBuilder.create().build();
        CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
        credentialsProvider.setCredentials(
                new AuthScope("127.0.0.1", 7326),
                new UsernamePasswordCredentials("multichainrpc", "password")
        );
Please start by testing this operation with multichain-cli, to see if the problem is in the node's setup, or in the specific Java code you're using to try to call the API.
...