【发布时间】:2023-03-16 21:28:01
【问题描述】:
我正在尝试编写一条路线来调用宁静的服务。它们都没有正文,而是查询参数。当我调用(https)其余服务时,我得到 401(未经授权)。 但如果我使用简单的 non-ssl (http) 并调用它,它可以在其他 api 上正常工作。 这是我的路线和生产者模板。
路线
public static final String MONITOR_URI = "https://lsapi.thomson-pharma.com//ls-api-ws/ws/rs/opportunity-v1/match?drug=bevacizumab&company=Genentech Inc&fmt=json";
public static final String DIRECT_MONITOR = "direct:getDrugInfo";
from(DIRECT_MONITOR).to(MONITOR_URI).convertBodyTo(String.class);
==========================主类==================== ===========
public static void main(String[] args) throws Exception {
CamelContext context = createCamelContext();
context.start();
final String text = "paracetamol";
final String fmt = "json";
final String authMethod = "Digest";
final String authUsername = "TR_Internal_024";
final String authPassword="ZTYA5S1KLF7WCDMN";
final String query = String.format("text=%s&fmt=%s&authMethod=%s&authUsername=%s&authPassword=%s",text,fmt,authMethod,authUsername,authPassword);
Map<String,Object> headers = new HashMap<String, Object>(){
{
put(Exchange.HTTP_METHOD,"POST");
put(Exchange.AUTHENTICATION,"Digest");
put("authUsername","TR_Internal_024");
put("authPassword","ZTYA5S1KLF7WCDMN");
put(Exchange.HTTP_QUERY,query);
}
};
ProducerTemplate template = context.createProducerTemplate();
String request = template.requestBodyAndHeaders(Constants.DIRECT_MONITOR,null,headers,String.class);
System.out.println("Body is : "+request);
}
- 谁能帮助如何使用camel cxf或restlet配置SSL?
- 如何将 Credentials Provider 添加到 CamelContext 或 Spring Context 中?
【问题讨论】:
-
有人可以帮助如何使用camel cxf或restlet配置SSL。
-
我不熟悉 Apache Camel + Restlet 集成,但是关于 HTTPS,您是否看过 Restlet 自己的有关该主题的文档? restlet.com/technical-resources/restlet-framework/guide/2.3/…
标签: rest ssl apache-camel restlet