我正在使用Camel serviceCall来拨打我的eureka VIP。主机和端口按预期解析。但响应是400并且抛出错误。我的serviceCall看起来如下:
from("direct:servicecall")
.setBody().constant(null)
.setHeader(Exchange.HTTP_METHOD, constant(HttpMethods.GET))
.serviceCall().name("eureka_vip_name")
.expression()
.simple("http4:${header.CamelServiceCallServiceHost}:${header.CamelServiceCallServicePort}"
+ "service call path and parameters")
.end()
添加错误日志:
org.apache.camel.http.common.HttpOperationFailedException:HTTP操作失败,调用http://172.31.20.241:8080/< ------ url path and parameteres ------> statusCode:400 在org.apache.camel.component.http4.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:312)〜[camel-http4-2.20.1.jar!/:2.20.1] 在org.apache.camel.component.http4.HttpProducer.process(HttpProducer.java:207)〜[camel-http4-2.20.1.jar!/:2.20.1] at org.apache.camel.util.AsyncProcessorConverterHelper $ ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)〜[camel-core-2.20.1.jar!/:2.20.1] 在org.apache.camel.processor.SendDynamicProcessor $ 1.doInAsyncProducer(SendDynamicProcessor.java:132)〜[camel-core-2.20.1.jar!/:2.20.1] 在org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:445)〜[camel-core-2.20.1.jar!/:2.20.1] 在org.apache.camel.processor.SendDynamicProcessor.process(SendDynamicProcessor.java:127)〜[camel-core-2.20.1.jar!/:2.20.1] 在org.apache.camel.impl.cloud.DefaultServiceCallProcessor.execute(DefaultServiceCallProcessor.java:184)〜[camel-core-2.20.1.jar!/:2.20.1] 在org.apache.camel.impl.cloud.DefaultServiceCallProcessor.lambda $ process $ 0(DefaultServiceCallProcessor.java:164)〜[camel-core-2.20.1.jar!/:2.20.1] 在org.apache.camel.spring.cloud.CamelSpringCloudServiceLoadBalancer.lambda $ process $ 0(CamelSpringCloudServiceLoadBalancer.java:66)〜[camel-spring-cloud-2.20.1.jar!/:2.20.1] 在org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:98)〜[spring-cloud-netflix-core-1.3.4.RELEASE.jar!/:1.3.4.RELEASE] 在org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:80)〜[spring-cloud-netflix-core-1.3.4.RELEASE.jar!/:1.3.4.RELEASE] 在org.apache.camel.spring.cloud.CamelSpringCloudServiceLoadBalancer.process(CamelSpringCloudServiceLoadBalancer.java:66)〜[camel-spring-cloud-2.20.1.jar!/:2.20.1] 在org.apache.camel.impl.cloud.DefaultServiceCallProcessor.process(DefaultServiceCallProcessor.java:164)〜[camel-core-2.20.1.jar!/:2.20.1] 在org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:76)〜[camel-core-2.20.1.jar!/:2.20.1] 在org.apache.camel.processor.RedeliveryErrorHandler $ AsyncRedeliveryTask.call(RedeliveryErrorHandler.java:203)〜[camel-core-2.20.1.jar!/:2.20.1] at org.apache.camel.processor.RedeliveryErrorHandler $ AsyncRedeliveryTask.call(RedeliveryErrorHandler.java:171)〜[camel-core-2.20.1.jar!/:2.20.1] 在java.util.concurrent.FutureTask.run(FutureTask.java:266)〜[?:1.8.0_161] at java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.access $ 201(ScheduledThreadPoolExecutor.java:180)~ [?:1.8.0_161] at java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)〜[?:1.8.0_161] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)[?:1.8.0_161] at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624)[?:1.8.0_161] 在java.lang.Thread.run(Thread.java:748)[?:1.8.0_161]
我尝试使用postMan(chrome扩展名)使用相同的url:当从postMan命中时,我使用ec2实例DNS名称作为主机,它给了我预期的响应,即200 OK,预期的身体作为结果。< / p>