我就是不能让这个HTTP4正常工作。我正试图对一个名为https的站点做一个POST请求。然而,似乎什么都起不到作用。有人能告诉我用HTTP4执行HTTPS帖子的正确方法吗?非常感谢,真的很挣扎。只需要知道我做错了什么..。一些简单的东西总是向南转。
我试过了。
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但似乎什么都不起作用?
发布于 2019-10-15 17:33:56
请使用bridgeEndpoint=true,这样您就可以走出服务器
发布于 2018-04-25 00:35:48
camel-http4组件适合于我正在尝试实现的目标。我只需要生成一个端点。我并不是想公开一个web服务。但是谢谢你的回应。
camel-http4 4 vs camel-jetty
您只能生成由camel-http4 4组件生成的端点。因此,它不应该被用作你的骆驼路线的输入。要通过HTTP服务器绑定/公开HTTP端点作为Camel路由的输入,请使用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不同,您可以配置端点选项,如安全性等。这个标头不支持这一点,它只是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被定义为:Exchange.HTTP_URI
这就是不起作用的地方。谢谢。
发布于 2018-04-25 17:52:26
好吧,我希望这能帮到别人,解决方案是两倍。首先,代理没有被确认,因为领先的协议def,http://我只使用了IP地址和没有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" />因此,端点http4通过设置
m.setHeader(Exchange.HTTP_URI, tokenUrl);起作用了。
然后,我尝试使用他在路由中覆盖的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" />这也奏效了。)但是,我仍然得到返回504网关超时错误。
我尝试在重写URI中使用https:// URI
https://uaa-svc-prod.app-api.aws-usw02-pr.io/oauth/token并且http4 4://终结点被https:// URI覆盖,现在我得到了一个CamelHttpResponseCode=401,CamelHttpResponseText=Unauthorized
所以,现在起作用了,快乐的joy joy.总之,在代理设置中不包括http:// protocol def。使用IP或规范名称。
<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 4://终结点时,使用以下语法
http4:hostname[:port][/resourceUri][?options]Exchange.HTTP_URI设置的URI位于端点def之上,其中包含要调用的https://myhost/path。
这就是对我有用的东西,我希望这能帮助像我这样的新手。谢谢大家。
https://stackoverflow.com/questions/50011601
复制相似问题