1

我在通过 Everyman\Neo4j 执行 Cypher 查询时遇到了一些问题。当 cURL 请求被编码并发送到 时http://localhost:7474/db/data/cypher,将返回一个带有HTTP 200状态的 Empty 响应。

我已经登录到终端,我可以看到它neo4j-service在正确的端口上运行,我可以连接neo4j-shell并运行我正在尝试执行的 Cypher。我还可以通过终端 cURL 到多个端点并获得有效响应。似乎 Cypher 是唯一的问题。

这是 curl 配置的转储:

array(8) {
  [10002]=>
  string(36) "http://localhost:7474/db/data/cypher"
  [19913]=>
  int(1)
  [42]=>
  int(1)
  [10023]=>
  array(5) {
    [0]=>
    string(36) "Accept: application/json;stream=true"
    [1]=>
    string(30) "Content-type: application/json"
    [2]=>
    string(26) "User-Agent: neo4jphp/0.1.0"
    [3]=>
    string(14) "X-Stream: true"
    [4]=>
    string(19) "Content-Length: 309"
  }
  [10036]=>
  string(4) "POST"
  [47]=>
  int(1)
  [10015]=>
  string(309) "{"query":"MATCH ..."}"

[113]=> 整数(1) }

我尝试重新启动服务并重新启动服务器,但没有成功。错误日志或 HTTP 日志没有任何意义。

我正在运行 Neo4j 社区版本 2.1.5。

4

1 回答 1

0

我在我的机器上试了一下,我至少收到了我发送的请求的回复:

<?php
    require('vendor/autoload.php');
    use Everyman\Neo4j\Cypher\Query;

    $client = new Everyman\Neo4j\Client('localhost', 7534);

    $queryString = "MATCH (p:Person) RETURN p LIMIT 1";
    $query = new Everyman\Neo4j\Cypher\Query($client, $queryString);
    $result = $query->getResultSet();

    foreach ($result as $row) {
        echo $row['p']->getProperty('name') . "\n";
    }

然后当我运行时,这是我在 ngrep 中看到的输出: T 127.0.0.1:55145 -> 127.0.0.1:7534 [AP] POST /db/data/cypher HTTP/1.1..Host: localhost:7534..Accept: application/json;stream=true..Content-type: application/json..User-Agent: neo4jphp/0.1.0..X-Stream: true..Content -Length: 45....{"query":"MATCH (p:Person) RETURN p LIMIT 1"} ## T 127.0.0.1:7534 -> 127.0.0.1:55145 [AP] HTTP/1.1 200 OK..Content-Type: application/json; charset=UTF-8; stream=true..Access-Control-Allow- Origin: *..Transfer-Encoding: chunked..Server: Jetty(9.0.5.v20130815)....486 ..{"columns":["p"],"data":[[{"extensions":{},"outgoing_relationships":"http://localhost:7534/db/data/node/1/relationships/out","labels":"http://localhost:7534/db/data/node/1/ labels","traverse":"http://localhost:7534/db/data/node/1/traverse/{returnType}","all_typed_relationsh ips":"http://localhost:7534/db/data/node/1/relationships/all/{-list|&|typ es}","self":"http://localhost:7534/db/data/node/1","property":"http://localhost:7534/db/data/node/1/properties/{key}","properties":"http://localhost:7534/db/data/node/1/prope rties","outgoing_typed_relationships":"http://localhost:7534/db/data/node/1/relationships/out/{-list|&|types}","incoming_relationships":"http://localhost:7534/db/data/node/1/ relationships/in","create_relationship":"http://localhost:7534/db/data/node/1/relationships","paged_t raverse":"http://localhost:7534/db/data/node/1/paged/traverse/{returnType }{? pageSize,leaseTime}","all_relationships":"http://localhost:7534/db/data/node/1/relationships/all","in coming_typed_relationships":"http://localhost:7534/db/data/node/1/rela tionships/in/{-list|&|types}","metadata":{"id":1,"labels":["Person"]},"data": {"born":1964,"name":"Keanu Reeves"}}]]} #####################

我和你有什么不同?

于 2014-11-28T13:57:28.313 回答