如何为https请求定义骆驼码头路由,并将参数传递给某个api进行身份验证?

如何为https请求定义骆驼码头路由,并将参数传递给某个api进行身份验证?,https,apache-camel,maven-jetty-plugin,Https,Apache Camel,Maven Jetty Plugin,我想使用camel-jetty组件发送https消费者请求,该地址以JSON格式返回一些响应,下面我提到我的DSL代码 from("jetty:https://someSiteAddress.com/api/control/authorizeUser?username=__&password=__").to("stream:out"); I am getting this warning: [WARNING] java.net.SocketException: Permis

我想使用camel-jetty组件发送https消费者请求,该地址以JSON格式返回一些响应,下面我提到我的DSL代码

from("jetty:https://someSiteAddress.com/api/control/authorizeUser?username=__&password=__").to("stream:out"); 

I am getting this warning:  
[WARNING]   
java.net.SocketException: Permission denied  
at sun.nio.ch.Net.bind0 (Native Method)  
at sun.nio.ch.Net.bind (Net.java:433)
at sun.nio.ch.Net.bind (Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind 
但每当我在浏览器中点击此HTTP URL时,它都会通过身份验证完美执行。
如果有人知道如何在apache camel中执行此操作,请帮助我,这将使我和其他人感到非常高兴

我怎么知道camel使用哪种方法发送POST或GET之类的请求。

谢谢你

你能试试这个吗?我将评论每一行,以帮助理解您的问题

// endpoint to start your route. could be a http endpoint you expose via jetty, jms, vm, seda or any other option. Here I'm using the simplest one.
from("direct:start")
    // logs on
    .to("log:DEBUG?showBody=true&showHeaders=true")
    // consume the endpoint
    .to("https://someSiteAddress.com/api/control/authorizeUser?username=__&password=__"")
    // log the body to the console so you could process the response later knowing what to do (the token you are mentioning should be in here.
    .to("log:DEBUG?showBody=true&showHeaders=true")
    .to("stream:out") //or whatever you want to
不要忘记此示例的
camel http
依赖项:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-http</artifactId>
</dependency>

org.apache.camel
骆驼http

干杯

这也很有效

  from("direct:in")
 .to("https://www.someAddress.com/api/control /authorizeUser?username=__ &password=__")
 .to("stream:out");

谢谢@Ricardozanii

嗨!如果我理解正确,您希望使用此端点:
https://someSiteAddress.com/api/control/authorizeUser?username=__&password=__
,正确吗?如果我是对的,您应该使用
to
中的
驼峰http
组件。按照描述代码的方式,您是在公开URL,而不是使用它。如果您遇到问题,请让我知道我已将其放在了答案中。@Ricardozanii感谢您的帮助,让我在这里明确指定我要点击端点:从(“上面提到”),即返回一些令牌Id和我正在控制台上打印的这些令牌Id(“流:输出”)。但我得到以上的错误,我认为这是因为码头错误。嗨!请看我的答案。您使用jetty的方式是在以下地址公开端点:
https://someSiteAddress.com
不使用它。要使用url,您必须使用
To()
指定它。Hello@Ricardozanii我感谢您澄清我的概念,代码是Build Success,但我仍然没有得到响应(以令牌和id的形式)。以防万一,如果您对我的URL响应有疑问,它在浏览器中运行良好。@RajatTemaniya请在浏览器中发布您正在查看的响应。回复正文应该在您的回复中。Hello@Ricardozanii这是我正在寻找的{“organizationPartyId”:“我的公司”,“sessionId”:“somerandomid.jvm1”,“我的登录名通过了”:“TRUE”,“authorizeUserResult”:{“userLoginId”:“myuser”,“responseMessage”:“success”,“partyId”:“myparty”,“token=”}我试图交换,但没有回应。这很尴尬。可能您在TLS/SSL方面有问题。可以尝试使用非HTTPS的端点吗?在camel中还有其他方法可以在exchange正文中获得响应。