spring - Rest camel passing objects between endpoints -
overview.
camel setup calls 2 service methods. response of first 1 passed second 1 , output final response json webpage. simple nothing complicated.
further breakdown give more context. method_1. takes in scanid. works ok. produces object called scheduledscan .class method_2. takes in object previous instance of scheduledscan .class , returns list of convertedscans scans. display said list
description of code
@override public void configure() throws exception { restconfiguration().bindingmode(restbindingmode.json); rest("/publish") .get("/scheduled-scan/{scanid}") .to("bean:sentinelimportservice?method=getscheduledscan").outtype(scheduledscan .class) .to("bean:sentinelimportservice?method=convertscheduledscan"); } the methods called following
scheduledscan getscheduledscan(@header("scanid") long scanid); list<convertedscans > convertscheduledscan(@body scheduledscan scheduledscans); it returning the following error
no body available of type: path. .scheduledscan has value:
of type: java.lang.string on: httpmessage@0x63c2fd04. caused by: no type converter available
the following runs without error, i.e. without method 2. think im there.
rest("/publish") .get("/scheduled-scan/{scanid}") .to("bean:sentinelimportservice?method=getscheduledscan"); now reading error looks im passing in httpmessage not java object? i'm bit confused next? advice appreciated.
i have found similar questions message. looking pass java object directly service method.
how-to-share-an-object-between-methods-on-different-camel-routes
you should setup outtype last output, eg rest response is, list/array , not single pojo. use .outtypelist(convertedscans.class) instead.
Comments
Post a Comment