Set form parameters while calling restful webservice
sipapptesting Jan 13, 2017 9:25 AMI am calling third party webservice using camel-restlet. How we can send form request parameters/inputs to service.
Below is my snippet for restful service call:
<?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" xsi:schemaLocation=" http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<bean class="org.apache.activemq.camel.component.ActiveMQComponent" id="activemq">
<property name="brokerURL" value="tcp://localhost:61616"/>
<property name="userName" value="admin"/>
<property name="password" value="admin"/>
<property name="usePooledConnection" value="false"/>
</bean>
<camelContext id="amq-example-context"
xmlns="http://camel.apache.org/schema/spring" xmlns:order="http://com.mycompany/examples/order">
<dataFormats>
<json id="docsDocs" library="Jackson" unmarshalTypeName="com.mycompany.pojos.MyPojo"/>
</dataFormats>
<restConfiguration bindingMode="auto" component="restlet" port="443"/>
<route id="file-to-jms-route">
<!-- from id="incomingFolder" uri="file:work/in"/ -->
<!-- to id="sendIncomingOrder" uri="activemq:incomingOrders"/ -->
<from id="_to3" uri="timer:order?fixedRate=true&period=5000&delay=2000"/>
<to id="_to2" uri="restlet:https://my-service.com:443/api/v1.0/user/427?exchangePattern=InOut&restletMethod=GET&auth=1234abcd5678pqrs"/>
<to id="_to1" uri="file:C:\workspace\jbdevstudio\restfuloutput"/>
<to id="sendIncomingDocs" uri="activemq:queue:incomingData"/>
</route>
<route id="jms-cbr-route" streamCache="true">
<from id="listenToIncomingData" uri="activemq:queue:incomingData"/>
<unmarshal id="_unmarshal1">
<json allowJmsType="true" library="Jackson"/>
</unmarshal>
<log id="logEndProcessing" message="Done processing parsing ${body}"/>
<to id="myQData" uri="activemq:queue:myQData"/>
</route>
</camelContext>
</beans>