Search code examples
jbossapache-camelactivemq-classicapi-key

Camel https web service consumer


I am trying to build a camel https web service consumer and I am not successful in calling this web service. This web service is currently using API-Key authentication and I have the API key. Below is my code that I have tried. Can someone give me some direction as to what I need to do to be able to do api key authentication with this remote web service?

<?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>

Solution

  • All I needed here was the following code:

    <to uri="https://api.url.com/api/v3.1/site/query/site/?apiKeyabcd1234"/>
    

    And then I was able to get the data flowing.