Apache camel 对https调用使用camel-http4的正确语法

Apache camel 对https调用使用camel-http4的正确语法,apache-camel,camel-http,Apache Camel,Camel Http,我就是不能让这个HTTP4工作。我正在尝试向https站点发送POST请求。然而,似乎什么都不起作用。有人能告诉我使用HTTP4执行HTTPS POST的正确方法是什么吗?非常感谢你,真的很努力。只是想知道我做错了什么。。。简单的事情总是南辕北辙 我试过了 http4://d1e5-95edc7a5cef2-uaa.run.aws-usw02-pr.ice.io:443/oauth/token https://d1e5-95edc7a5cef2-uaa.run.aws-usw02-pr.ice.

我就是不能让这个HTTP4工作。我正在尝试向https站点发送POST请求。然而,似乎什么都不起作用。有人能告诉我使用HTTP4执行HTTPS POST的正确方法是什么吗?非常感谢你,真的很努力。只是想知道我做错了什么。。。简单的事情总是南辕北辙

我试过了

http4://d1e5-95edc7a5cef2-uaa.run.aws-usw02-pr.ice.io:443/oauth/token
https://d1e5-95edc7a5cef2-uaa.run.aws-usw02-pr.ice.io/oauth/token
http4://d1e5-95edc7a5cef2-uaa.run.aws-usw02-pr.ice.io/oauth/token
https://d1e5-95edc7a5cef2-uaa.run.aws-usw02-pr.ice.io:443/oauth/token
http4:https://d1e5-95edc7a5cef2-uaa.run.aws-usw02-pr.ice.io:443/oauth/token

但似乎什么都不管用

camel-http4组件适合我想要实现的目标。我只需要生成一个端点。我不想公开web服务。但是,谢谢你的回复

骆驼-http4与骆驼码头

您只能生成由camel-http4组件生成的端点。因此,决不能将其用作骆驼路线的输入。要通过HTTP服务器将HTTP端点绑定/公开为驼峰路由的输入,请改用Jetty组件

我发现定义HTTP4端点的正确方法是

http4:hostname[:port][/resourceUri][?options]
我遇到的问题是动态toD路由和Exchange.HTTP_URI设置的替换,这并没有正常工作

因此,使用uri,例如

http4://d1e53858-2903-4c21-86c0-95edc7a5cef2.uaa.run.aws-us.ice.io:443/oauth/token
工作。机械装置坏了

Exchange.HTTP_URI

要调用的URI。此选项的值将覆盖直接在端点上设置的现有URI。它与Camel端点URI不同,在Camel端点URI中,您可以配置端点选项,如安全性等。此标头不支持该选项,它只是HTTP服务器的URI

    <route 
        id="core.getToken.route"
        autoStartup="true" >
        <from id="getToken" ref="getToken" />
        <process ref="uAARequestTokenProcessor" />
<!--        <log message="Message after uAARequestTokenProcessor:  ${body}" loggingLevel="INFO"/>   -->
         <setHeader headerName="CamelHttpMethod">
            <constant>POST</constant>
         </setHeader>
<!--         <setHeader headerName="CamelHttpUri">
            <simple>${header.TOKENURL}</simple>
         </setHeader>  -->
        <log message="HTTP4 POST headers: ${headers}" loggingLevel="DEBUG"/>
        <log message="HTTP4 POST body: ${body}" loggingLevel="DEBUG"/> 
        <to uri="http4://d1e-uaa.run.aws-usw02-pr.ice.io:443/oauth/token?throwExceptionOnFailure=false" />
        <toD uri="${header.TOKENURL}?throwExceptionOnFailure=false" />
        <log message="After HTTP4 POST: ${body}" loggingLevel="INFO"/>
        <to uri="{{accessToken}}" />    
    </route>    

邮递
因此,对我来说,设置Exchange.HTTP_URI并没有覆盖端点中定义的URI 其中Exchange.HTTP_URI定义为: TOKENURL=http4://d1e53858-2903-4c21-86c0-95edc7a5cef2.uaa.run.aws-usw02-pr.ice.io:443/oauth/token


这是不起作用的。谢谢

好的,我希望这对某人有所帮助,解决方法是两方面的。首先,由于领先的协议定义,代理没有得到确认,http://我只使用了IP地址和cononical名称,没有使用http://并且我能够接收到504网关超时错误。因此,HTTP4端点按照其设置的样子工作

http4://myhost:443/path
http4://uaa-svc-prod.app-api.aws-usw02-pr.io:443/oauth/token
通过首先创建一个硬端点,我能够使请求正常工作

    <to uri="http4://uaa-svc-prod.app-api.aws-usw02-pr.io:443/oauth/token?throwExceptionOnFailure=false" />
成功了

然后我尝试使用他在路由中覆盖的XML设置

<log message="HTTP4 POST headers: ${headers}" loggingLevel="DEBUG"/>
<setHeader headerName="CamelHttpUri">
    <simple>${header.TOKENURL}?throwExceptionOnFailure=false</simple>
</setHeader>
<to uri="http4://uaa-svc-prod.app-api.aws-usw02-pr.io:443/oauth/token?throwExceptionOnFailure=false" />
http4://端点被https://URI覆盖,现在我得到一个CamelHttpResponseCode=401,CamelHttpResponseText=Unauthorized

所以,它现在正在工作,快乐。。。 总之,不要在代理设置中包含http://protocoldef。使用IP或cononical名称

   <camelContext     
      id="com.ge.digital.passthru.coreCamelContext"
      trace="true"
      xmlns="http://camel.apache.org/schema/blueprint"
      allowUseOriginalMessage="false"
      streamCache="true"
      errorHandlerRef="deadLetterErrorHandler" >
      <properties>
           <property key="http.proxyHost" value="PITC-Zscaler.proxy.corporate.america.com"/>
           <property key="http.proxyPort" value="80"/>
      </properties>
由Exchange.HTTP_URI在端点def上设置的URI包含您调用的位置

这对我来说很有用,我希望这能帮助像我这样的新手。
谢谢大家

请使用bridgeEndpoint=true,这样您就可以先离开服务器,我不认为
http4://
是您想要的。我不认为这是一个URL协议指示符。要使https正常工作,必须建立安全连接。尝试用谷歌搜索
建立https会话
开始。如果您尝试失败,请在StackOverflow上发布一个更具体的问题。请参阅,并发布a。您的意思是
https4://
(请注意
https4://
中的
s
)?另请参阅“谢谢burki,不,我指的是http4”中的“为HTTP客户端设置SSL”一章。我将进一步讨论一下,我认为这与我在Exchange.HTTP_URI中定义URI的方式有关。也许它不应该包括http4部件IDK???
https://uaa-svc-prod.app-api.aws-usw02-pr.io/oauth/token
   <camelContext     
      id="com.ge.digital.passthru.coreCamelContext"
      trace="true"
      xmlns="http://camel.apache.org/schema/blueprint"
      allowUseOriginalMessage="false"
      streamCache="true"
      errorHandlerRef="deadLetterErrorHandler" >
      <properties>
           <property key="http.proxyHost" value="PITC-Zscaler.proxy.corporate.america.com"/>
           <property key="http.proxyPort" value="80"/>
      </properties>
http4:hostname[:port][/resourceUri][?options]