泽西没有张贴json

时间:2013-03-13 23:08:52

标签: java json web-services jersey

我正在尝试使用jersey将json发布到远程php应用程序。 php应用程序似乎没有收到帖子。当我查看标题时,它似乎在那里。是否有人碰巧知道我可能做错了什么?

Java Jersey Code

    String url = "http://support.mydomain.co/remoteapi/mydomain/index.php";

    WebResource webResource = client.resource(url);
    webResource.queryParam("action", Constant.CREATE_TICKET.name());

    Company company = companyDAO.findCompanyById(1);

    client.addFilter(new LoggingFilter(System.out));

    ClientResponse response = webResource.accept("application/json")
            .entity(company, MediaType.APPLICATION_JSON)
            .post(ClientResponse.class);

    if (response.getStatus() != 200) {
        throw new RuntimeException("Failed : HTTP error code : "
                + response.getStatus());
    }

    String output = response.getEntity(String.class);

标题

1 * Client out-bound request
1 > POST http://support.mydomain.co/remoteapi/mydomain/index.php?action=CREATE_TICKET
1 > Accept: application/json
1 > Content-Type: application/json
{"name":"Test Company","phones":[],"street1":null,"street2":null,"city":null,"stateName":{"name":"Florida"},"companyCategory":{"name":"hotel"},"zip":"12095","accountNumber":"00000002"}
1 * Client in-bound response
1 < 200
1 < Date: Wed, 13 Mar 2013 22:51:06 GMT
1 < Transfer-Encoding: chunked
1 < Keep-Alive: timeout=5, max=100
1 < Connection: Keep-Alive
1 < Content-Type: application/json
1 < Server: Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/0.9.8e-fips-rhel5 mod_mono/2.6.3 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
1 < X-Powered-By: PHP/5.3.17
1 < 

PHP

print_r($_REQUEST);

0 个答案:

没有答案