骆驼https web服务消费者
问题描述:
我想建立一个驼峰https web服务消费者,我没有成功调用这个web服务。此Web服务当前正在使用API密钥身份验证,并且我拥有API密钥。以下是我试过的代码。有人可以给我一些指导,说明我需要做什么才能够使用此远程Web服务执行api密钥身份验证?骆驼https web服务消费者
<?xml version="1.0" encoding="UTF-8"?>
<!-- Configures the Camel Context-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-http.xsd">
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start"/>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<to uri="https://api.url.com/api/v3.1/site/query/site/<apikeyhere>"/>
<log message="Message Recieved"/>
<to uri="file:target/messages/message"/>
</route>
</camelContext>
</beans>
答
所有我需要在这里是下面的代码:
<to uri="https://api.url.com/api/v3.1/site/query/site/?apiKeyabcd1234"/>
然后我能得到的数据流。
这是一个SOAP Web服务还是一个REST服务?看起来像REST,但你能提供更多的细节?你也可以提供一些日志信息,即你看到的错误吗? – Namphibian 2014-10-07 23:07:57
是的,这是一个REST Web服务。我得到一个http 500错误。这是说像“http操作失败调用https://api.url.com/api/v3.1/site/query/site/与statusCode:500” –
nerdyoutdoorsman
2014-10-09 13:53:05