私のプロジェクトをNeo4j DBに接続するためにtriyingを使用しています。私はGETリクエストをして、同じコード(POSTMethodのGETMethodを変更します)それはしない。私のPOSTリクエストの接続を行うことができません
これは私のコードです。
文字列名= "xxx"; 文字列パスワード= "xxx";
String authString = name + ":" + password;
byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
String authStringEnc = new String(authEncBytes);
HttpMethod method = null;
HttpClient client = new HttpClient();
//String url = "http://localhost:7474/db/data/relationship";
String url = "http://localhost:7474/db/data/cypher";
method = new PostMethod(String.format(url));
method.addRequestHeader(new Header("Content-Type", "application/json; charset=UTF-8"));
method.addRequestHeader("Authorization", "Basic "+ authStringEnc);
method.setQueryString("{\"query\" : \"MATCH (x{id:'123'})-[r]->(n) RETURN n.name, r.status\",\"params\" : { }}");
try {
client.executeMethod(method);
しかし、HttpExceptionがあります。
私はRestとNeo4jで初めてです。
誰かが私を助けることができますか?
ありがとうございました。
_ "HttpExceptionがあります" _ - さて、例外とスタックトレースを私たちと共有しようとしていますか?あなたは、私たちが問題の原因を推測することを期待していますか?また、コード内のどのステートメントが例外をスローするかを教えてください。 –
私はそれを解決できる、ありがとう。 – Silvia