camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sayed_india <sayed.abdulis...@gmail.com>
Subject calling a REST Service POST method with parameters from another REST Service
Date Thu, 23 Oct 2014 11:35:51 GMT
Hello,
I need to call a REST service POST method with parameters from Another REST
service GET method using the partial response data as the input for the POST
method as described below, please share the working code sample:
For Example
http://localhost:8080/employee-- this REST service has a get method that
returns JSON object(ID:124,Name:Test,Design:SE)


And  I have another REST service with POST method that takes some
parameter(http://localhost:8090/dept).

@Consumes(MediaType.APPLICATION_JSON)
   @POST
   @Path("dept")

public String createDept(@FormParam("empID") String
empID,@FormParam("deptID") String deptID,@FormParam("deptName") String
deptName);

---------------------------
<route>
<from uri="cxfrs:http://localhost:8080/employee">
<to uri="sql:select * from Employee"> //returns the above JSON
//how to get the data from response and store to some header that can be
used as parameter to next service???

//Need to call another service with POST method(http://localhost:8090/dept)
that takes ID from the earlier response 
<setHeader headerName="CamelCxfRsUsingHttpAPI">
<constant>True</constant>
</setHeader>
//How to set the parameter ???
<to uri="cxfrs:http://locahost:8090/dept"/>
 
</route>

Please help me in completing the service call integration.

Thanks,
Sayed



--
View this message in context: http://camel.465427.n5.nabble.com/calling-a-REST-Service-POST-method-with-parameters-from-another-REST-Service-tp5757939.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message