在驼峰路线

时间:2016-12-04 22:35:40

标签: java post apache-camel jetty

我正在使用Apache camel来实现SOA集成层。

但是当我尝试向外部Web服务发送POST请求时,我遇到了一些问题。

这是我的骆驼路线:

from("jetty:http://localhost:5000/plus_grand")
    .setHeader(Exchange.HTTP_METHOD , constant("POST"))
    .to("http://localhost/sub?bridgeEndpoint=false&throwExceptionOnFailure=false")

http://localhost/sub是一个简单的php页面。此页面打印请求信息。

代码是:

echo "<pre>";
    print_r($_SERVER);
echo "</pre>";

当我试图运行时,我得到了这个结果:

Array
(
    [HTTP_HOST] => localhost
    [HTTP_USER_AGENT] => Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.5
    [HTTP_ACCEPT_ENCODING] => gzip, deflate
    [HTTP_COOKIE] => csrftoken=rqcFAHftMkWsDEoLudTWIjPseAU7sJ40; oauth_consumer_key=136a3fd63028e1d157c6b939bcbe771c2dfe5710
    [HTTP_CONNECTION] => keep-alive
    [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    [SERVER_SIGNATURE] => 
Apache/2.4.7 (Ubuntu) Server at localhost Port 80


    [SERVER_SOFTWARE] => Apache/2.4.7 (Ubuntu)
    [SERVER_NAME] => localhost
    [SERVER_ADDR] => 127.0.0.1
    [SERVER_PORT] => 80
    [REMOTE_ADDR] => 127.0.0.1
    [DOCUMENT_ROOT] => /var/www/html
    [REQUEST_SCHEME] => http
    [CONTEXT_PREFIX] => 
    [CONTEXT_DOCUMENT_ROOT] => /var/www/html
    [SERVER_ADMIN] => webmaster@localhost
    [SCRIPT_FILENAME] => /var/www/html/sub/index.php
    [REMOTE_PORT] => 38604
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_PROTOCOL] => HTTP/1.1
    [REQUEST_METHOD] => GET
    [QUERY_STRING] => 
    [REQUEST_URI] => /sub/
    [SCRIPT_NAME] => /sub/index.php
    [PHP_SELF] => /sub/index.php
    [REQUEST_TIME_FLOAT] => 1480887502.957
    [REQUEST_TIME] => 1480887502
)

您可以看到,请求方法为GET

请问,问题是什么。

0 个答案:

没有答案