You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by vincentmsr <vi...@msr-it.com> on 2017/06/10 03:25:33 UTC

Weird behaviour rest dsl // REST flow using REST DSL

Hi guys

I have currently working on a camel flow which receives hotel booking
request from UI and makes multiple calls on backend to complete the booking
and return the json object back to UI.

Blocking room and booking room works fine. I have a service call which
retrieves the booking details and returns back to UI. My route is as follows

*from("direct:retrievebookingdetails")
                .log("Pulling out booking details to relay back for booking
Id ${property.bookingId}")
                .process(getBookDetailsRequestMapper)
                .process(removeServicerCodeAndAddTokenId)
                .marshal(getBookingDetailsRequestTboFormat)
                .removeHeaders("*", "tokenId")
                .setHeader(Exchange.HTTP_METHOD, constant("POST"))
                .setHeader("Content-Type", constant("application/json"))
                //.setHeader("Accept-Encoding",constant("gzip"))
                .log(LoggingLevel.INFO,"HotelServices","TBO Get Booking
Details request - ${body}")
               
.to("{{tboGetBookingDetailsServiceUrl}}?throwExceptionOnFailure=false")
                .setProperty("responseData",simple("${body}"))
                .setBody(simple("${property.responseData}"))
                .setProperty("ServicerCode",constant("001"))
                .convertBodyTo(String.class)
                .log(LoggingLevel.INFO,"HotelServices","TBO Get Booking
Details API Response - ${body}")
                .to("direct:ResponseSanityCheck")
                .unmarshal(getBookingDetailsResponseTboFormat)
                .process(addServicerCode)
                .removeHeader("*")
                .process(new HotelBookingRestoreAllHeaders())
                .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(200))
                .marshal(getBookingDetailsResponseTboFormat)
                .convertBodyTo(String.class)
                .log("Returning ${body}")
                .end();
*

My logs are as follows


*2017-06-10 08:44:09 INFO  route16 - Pulling out booking details to relay
back
2017-06-10 08:44:09 INFO  route17 - Pulling out booking details to relay
back for booking Id 3373
Booking ID = 3373 , tokenID = ******
Booking ID is not null. Mapping data
Request instance not recognized. Not removing servicer code
2017-06-10 08:44:09 INFO  HotelServices - TBO Get Booking Details request -
{"BookingId":"3373","EndUserIp":"123.1.1.1","TokenId":"*********"}
2017-06-10 08:44:09 INFO  HotelServices - TBO Get Booking Details API
Response -
{"GetBookingDetailResult":{"VoucherStatus":true,"ResponseStatus":1,"Error":{"ErrorCode":0,"ErrorMessage":""},"TraceId":"xxxxxxx-f1be-44e1-b3d1-xxxxxx","Status":1,"HotelBookingStatus":"Confirmed","ConfirmationNo":"LL8F562573
-
010\/730395","BookingRefNo":"730395","BookingId":3373,"IsPriceChanged":false,"IsCancellationPolicyChanged":false,"HotelRoomsDetails":[{"AdultCount":1,"ChildCount":0,"HotelPassenger":[{"Age":30,"Email":"vinceqnt981@msr-it.com","FirstName":"FfgkqaDr","LastName":"FdrelgFe","LeadPassenger":true,"MiddleName":"","PassportExpDate":null,"PassportIssueDate":null,"PassportNo":null,"PaxId":1088,"PaxType":1,"Phoneno":"9939223438","Title":"Mr"}],"RequireAllPaxDetails":false,"RoomId":699,"RoomStatus":0,"RoomIndex":1,"RoomTypeCode":"001:GRA1:4","RoomTypeName":"Standard
Single","RatePlanCode":"001:GRA1:4225:S4150:4686:18593|1","RatePlan":0,"DayRates":[{"Amount":51.5,"Date":"2017-07-23T00:00:00"}],"SupplierPrice":null,"Price":{"CurrencyCode":"INR","RoomPrice":51.5,"Tax":0,"ExtraGuestCharge":0,"ChildCharge":0,"OtherCharges":0,"Discount":0,"PublishedPrice":51.5,"PublishedPriceRoundedOff":52,"OfferedPrice":51.5,"OfferedPriceRoundedOff":52,"AgentCommission":0,"AgentMarkUp":0,"ServiceTax":3.6,"TDS":0},"RoomPromotion":"","Amenities":["Full
Breakfast"],"Amenity":[],"SmokingPreference":"NoPreference","BedTypes":[],"HotelSupplements":null,"LastCancellationDate":"2017-06-09T23:59:59","CancellationPolicies":[],"CancellationPolicy":"Standard
Single#^#INR 52.00 will be charged, If cancelled between 10-Jun-2017
00:00:00 and 23-Jul-2017 00:00:00.|100.00% of total amount will be charged,
If cancelled between 23-Jul-2017 00:00:01 and 24-Jul-2017
23:59:59.|","Inclusion":["Full
Breakfast"]}],"HotelPolicyDetail":"<ul><li>Amendments cannot be made against
this booking once your booking has been requested.<\/li><\/ul>|Amendments
cannot be made against this booking once your booking has been
requested.|City tax and Resort fee are to be paid directly at hotel if
applicable.","IntHotelPassportDetails":null,"InvoiceCreatedOn":"2017-06-10T03:14:09","InvoiceNo":"MW\/1718\/512","HotelConfirmationNo":null,"HotelName":"GRAND
AMSTELVEEN","StarRating":4,"AddressLine1":"Bovenkerkerweg 81 Amsterdam 1187
XC Netherlands, Amsterdam, Netherlands ZipCode:","AddressLine2":"Phone No:
31-20-6455558\u000a Fax :
31-20-6412121","Latitude":"52.278000000000000","Longitude":"4.839000000000000","City":"Amsterdam","CheckInDate":"2017-07-23T00:00:00","InitialCheckInDate":"2017-07-23T00:00:00","CheckOutDate":"2017-07-24T00:00:00","InitialCheckOutDate":"2017-07-24T00:00:00","LastCancellationDate":"2017-06-09T23:59:59","NoOfRooms":1,"BookingDate":"2017-06-10T03:14:08","SpecialRequest":"","IsDomestic":false}}
2017-06-10 08:44:09 INFO  HotelServices - API response verified OK.
2017-06-10 08:44:09 INFO  route17 - Returning
{"GetBookingDetailResult":{"VoucherStatus":true,"ResponseStatus":1,"Error":{"ErrorCode":0,"ErrorMessage":""},"TraceId":"xxxxxx-f1be-44e1-b3d1-xxxxxxxxx","Status":1,"HotelBookingStatus":"Confirmed","ConfirmationNo":"LL8F562573
-
010/730395","BookingRefNo":"730395","BookingId":3373,"IsPriceChanged":false,"IsCancellationPolicyChanged":false,"HotelRoomsDetails":[{"AdultCount":1,"ChildCount":0,"HotelPassenger":[{"Age":30,"Email":"vinceqnt981@msr-it.com","FirstName":"FfgkqaDr","LastName":"FdrelgFe","LeadPassenger":true,"MiddleName":"","PaxType":1,"Phoneno":"9939223438","Title":"Mr"}],"RequireAllPaxDetails":false,"RoomIndex":1,"RoomTypeCode":"001:GRA1:4","RoomTypeName":"Standard
Single","RatePlanCode":"001:GRA1:4225:S4150:4686:18593|1","DayRates":[{"Amount":51,"Date":"2017-07-23T00:00:00"}],"Price":{"CurrencyCode":"INR","RoomPrice":51,"Tax":0,"ExtraGuestCharge":0,"ChildCharge":0,"OtherCharges":0,"Discount":0,"PublishedPrice":51,"PublishedPriceRoundedOff":52,"OfferedPrice":51,"OfferedPriceRoundedOff":52,"AgentCommission":0,"AgentMarkUp":0,"ServiceTax":3.6,"TDS":0},"RoomPromotion":"","Amenities":["Full
Breakfast"],"SmokingPreference":"NoPreference","BedTypes":[],"LastCancellationDate":"2017-06-09T23:59:59","CancellationPolicies":[],"CancellationPolicy":"Standard
Single#^#INR 52.00 will be charged, If cancelled between 10-Jun-2017
00:00:00 and 23-Jul-2017 00:00:00.|100.00% of total amount will be charged,
If cancelled between 23-Jul-2017 00:00:01 and 24-Jul-2017
23:59:59.|"}],"HotelPolicyDetail":"<ul><li>Amendments cannot be made against
this booking once your booking has been requested.</li></ul>|Amendments
cannot be made against this booking once your booking has been
requested.|City tax and Resort fee are to be paid directly at hotel if
applicable.","InvoiceCreatedOn":"2017-06-10T03:14:09","InvoiceNo":"MW/1718/512","HotelName":"GRAND
AMSTELVEEN","StarRating":4,"AddressLine1":"Bovenkerkerweg 81 Amsterdam 1187
XC Netherlands, Amsterdam, Netherlands ZipCode:","AddressLine2":"Phone No:
31-20-6455558\n Fax :
31-20-6412121","Latitude":"52.278000000000000","Longitude":"4.839000000000000","City":"Amsterdam","CheckInDate":"2017-07-23T00:00:00","CheckOutDate":"2017-07-24T00:00:00","LastCancellationDate":"2017-06-09T23:59:59","NoOfRooms":1,"BookingDate":"2017-06-10T03:14:08","SpecialRequest":"","IsDomestic":false},"ServicerCode":"001"}*



But it looks very wierd that only the following gets relayed back to the
front end :(

*
{
  "ServicerCode": "001"
}
*


Though the body contains all details, only servicer code gets relayed back.
Logs look clean.

Any clue from experts will be helpful!!!

Vincent



--
View this message in context: http://camel.465427.n5.nabble.com/Weird-behaviour-rest-dsl-REST-flow-using-REST-DSL-tp5802871.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Weird behaviour rest dsl // REST flow using REST DSL

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Could it be because of streaming, and that you are logging the message
body, so it becomes null/empty
http://camel.apache.org/why-is-my-message-body-empty.html



On Sat, Jun 10, 2017 at 5:25 AM, vincentmsr <vi...@msr-it.com> wrote:
> Hi guys
>
> I have currently working on a camel flow which receives hotel booking
> request from UI and makes multiple calls on backend to complete the booking
> and return the json object back to UI.
>
> Blocking room and booking room works fine. I have a service call which
> retrieves the booking details and returns back to UI. My route is as follows
>
> *from("direct:retrievebookingdetails")
>                 .log("Pulling out booking details to relay back for booking
> Id ${property.bookingId}")
>                 .process(getBookDetailsRequestMapper)
>                 .process(removeServicerCodeAndAddTokenId)
>                 .marshal(getBookingDetailsRequestTboFormat)
>                 .removeHeaders("*", "tokenId")
>                 .setHeader(Exchange.HTTP_METHOD, constant("POST"))
>                 .setHeader("Content-Type", constant("application/json"))
>                 //.setHeader("Accept-Encoding",constant("gzip"))
>                 .log(LoggingLevel.INFO,"HotelServices","TBO Get Booking
> Details request - ${body}")
>
> .to("{{tboGetBookingDetailsServiceUrl}}?throwExceptionOnFailure=false")
>                 .setProperty("responseData",simple("${body}"))
>                 .setBody(simple("${property.responseData}"))
>                 .setProperty("ServicerCode",constant("001"))
>                 .convertBodyTo(String.class)
>                 .log(LoggingLevel.INFO,"HotelServices","TBO Get Booking
> Details API Response - ${body}")
>                 .to("direct:ResponseSanityCheck")
>                 .unmarshal(getBookingDetailsResponseTboFormat)
>                 .process(addServicerCode)
>                 .removeHeader("*")
>                 .process(new HotelBookingRestoreAllHeaders())
>                 .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(200))
>                 .marshal(getBookingDetailsResponseTboFormat)
>                 .convertBodyTo(String.class)
>                 .log("Returning ${body}")
>                 .end();
> *
>
> My logs are as follows
>
>
> *2017-06-10 08:44:09 INFO  route16 - Pulling out booking details to relay
> back
> 2017-06-10 08:44:09 INFO  route17 - Pulling out booking details to relay
> back for booking Id 3373
> Booking ID = 3373 , tokenID = ******
> Booking ID is not null. Mapping data
> Request instance not recognized. Not removing servicer code
> 2017-06-10 08:44:09 INFO  HotelServices - TBO Get Booking Details request -
> {"BookingId":"3373","EndUserIp":"123.1.1.1","TokenId":"*********"}
> 2017-06-10 08:44:09 INFO  HotelServices - TBO Get Booking Details API
> Response -
> {"GetBookingDetailResult":{"VoucherStatus":true,"ResponseStatus":1,"Error":{"ErrorCode":0,"ErrorMessage":""},"TraceId":"xxxxxxx-f1be-44e1-b3d1-xxxxxx","Status":1,"HotelBookingStatus":"Confirmed","ConfirmationNo":"LL8F562573
> -
> 010\/730395","BookingRefNo":"730395","BookingId":3373,"IsPriceChanged":false,"IsCancellationPolicyChanged":false,"HotelRoomsDetails":[{"AdultCount":1,"ChildCount":0,"HotelPassenger":[{"Age":30,"Email":"vinceqnt981@msr-it.com","FirstName":"FfgkqaDr","LastName":"FdrelgFe","LeadPassenger":true,"MiddleName":"","PassportExpDate":null,"PassportIssueDate":null,"PassportNo":null,"PaxId":1088,"PaxType":1,"Phoneno":"9939223438","Title":"Mr"}],"RequireAllPaxDetails":false,"RoomId":699,"RoomStatus":0,"RoomIndex":1,"RoomTypeCode":"001:GRA1:4","RoomTypeName":"Standard
> Single","RatePlanCode":"001:GRA1:4225:S4150:4686:18593|1","RatePlan":0,"DayRates":[{"Amount":51.5,"Date":"2017-07-23T00:00:00"}],"SupplierPrice":null,"Price":{"CurrencyCode":"INR","RoomPrice":51.5,"Tax":0,"ExtraGuestCharge":0,"ChildCharge":0,"OtherCharges":0,"Discount":0,"PublishedPrice":51.5,"PublishedPriceRoundedOff":52,"OfferedPrice":51.5,"OfferedPriceRoundedOff":52,"AgentCommission":0,"AgentMarkUp":0,"ServiceTax":3.6,"TDS":0},"RoomPromotion":"","Amenities":["Full
> Breakfast"],"Amenity":[],"SmokingPreference":"NoPreference","BedTypes":[],"HotelSupplements":null,"LastCancellationDate":"2017-06-09T23:59:59","CancellationPolicies":[],"CancellationPolicy":"Standard
> Single#^#INR 52.00 will be charged, If cancelled between 10-Jun-2017
> 00:00:00 and 23-Jul-2017 00:00:00.|100.00% of total amount will be charged,
> If cancelled between 23-Jul-2017 00:00:01 and 24-Jul-2017
> 23:59:59.|","Inclusion":["Full
> Breakfast"]}],"HotelPolicyDetail":"<ul><li>Amendments cannot be made against
> this booking once your booking has been requested.<\/li><\/ul>|Amendments
> cannot be made against this booking once your booking has been
> requested.|City tax and Resort fee are to be paid directly at hotel if
> applicable.","IntHotelPassportDetails":null,"InvoiceCreatedOn":"2017-06-10T03:14:09","InvoiceNo":"MW\/1718\/512","HotelConfirmationNo":null,"HotelName":"GRAND
> AMSTELVEEN","StarRating":4,"AddressLine1":"Bovenkerkerweg 81 Amsterdam 1187
> XC Netherlands, Amsterdam, Netherlands ZipCode:","AddressLine2":"Phone No:
> 31-20-6455558\u000a Fax :
> 31-20-6412121","Latitude":"52.278000000000000","Longitude":"4.839000000000000","City":"Amsterdam","CheckInDate":"2017-07-23T00:00:00","InitialCheckInDate":"2017-07-23T00:00:00","CheckOutDate":"2017-07-24T00:00:00","InitialCheckOutDate":"2017-07-24T00:00:00","LastCancellationDate":"2017-06-09T23:59:59","NoOfRooms":1,"BookingDate":"2017-06-10T03:14:08","SpecialRequest":"","IsDomestic":false}}
> 2017-06-10 08:44:09 INFO  HotelServices - API response verified OK.
> 2017-06-10 08:44:09 INFO  route17 - Returning
> {"GetBookingDetailResult":{"VoucherStatus":true,"ResponseStatus":1,"Error":{"ErrorCode":0,"ErrorMessage":""},"TraceId":"xxxxxx-f1be-44e1-b3d1-xxxxxxxxx","Status":1,"HotelBookingStatus":"Confirmed","ConfirmationNo":"LL8F562573
> -
> 010/730395","BookingRefNo":"730395","BookingId":3373,"IsPriceChanged":false,"IsCancellationPolicyChanged":false,"HotelRoomsDetails":[{"AdultCount":1,"ChildCount":0,"HotelPassenger":[{"Age":30,"Email":"vinceqnt981@msr-it.com","FirstName":"FfgkqaDr","LastName":"FdrelgFe","LeadPassenger":true,"MiddleName":"","PaxType":1,"Phoneno":"9939223438","Title":"Mr"}],"RequireAllPaxDetails":false,"RoomIndex":1,"RoomTypeCode":"001:GRA1:4","RoomTypeName":"Standard
> Single","RatePlanCode":"001:GRA1:4225:S4150:4686:18593|1","DayRates":[{"Amount":51,"Date":"2017-07-23T00:00:00"}],"Price":{"CurrencyCode":"INR","RoomPrice":51,"Tax":0,"ExtraGuestCharge":0,"ChildCharge":0,"OtherCharges":0,"Discount":0,"PublishedPrice":51,"PublishedPriceRoundedOff":52,"OfferedPrice":51,"OfferedPriceRoundedOff":52,"AgentCommission":0,"AgentMarkUp":0,"ServiceTax":3.6,"TDS":0},"RoomPromotion":"","Amenities":["Full
> Breakfast"],"SmokingPreference":"NoPreference","BedTypes":[],"LastCancellationDate":"2017-06-09T23:59:59","CancellationPolicies":[],"CancellationPolicy":"Standard
> Single#^#INR 52.00 will be charged, If cancelled between 10-Jun-2017
> 00:00:00 and 23-Jul-2017 00:00:00.|100.00% of total amount will be charged,
> If cancelled between 23-Jul-2017 00:00:01 and 24-Jul-2017
> 23:59:59.|"}],"HotelPolicyDetail":"<ul><li>Amendments cannot be made against
> this booking once your booking has been requested.</li></ul>|Amendments
> cannot be made against this booking once your booking has been
> requested.|City tax and Resort fee are to be paid directly at hotel if
> applicable.","InvoiceCreatedOn":"2017-06-10T03:14:09","InvoiceNo":"MW/1718/512","HotelName":"GRAND
> AMSTELVEEN","StarRating":4,"AddressLine1":"Bovenkerkerweg 81 Amsterdam 1187
> XC Netherlands, Amsterdam, Netherlands ZipCode:","AddressLine2":"Phone No:
> 31-20-6455558\n Fax :
> 31-20-6412121","Latitude":"52.278000000000000","Longitude":"4.839000000000000","City":"Amsterdam","CheckInDate":"2017-07-23T00:00:00","CheckOutDate":"2017-07-24T00:00:00","LastCancellationDate":"2017-06-09T23:59:59","NoOfRooms":1,"BookingDate":"2017-06-10T03:14:08","SpecialRequest":"","IsDomestic":false},"ServicerCode":"001"}*
>
>
>
> But it looks very wierd that only the following gets relayed back to the
> front end :(
>
> *
> {
>   "ServicerCode": "001"
> }
> *
>
>
> Though the body contains all details, only servicer code gets relayed back.
> Logs look clean.
>
> Any clue from experts will be helpful!!!
>
> Vincent
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Weird-behaviour-rest-dsl-REST-flow-using-REST-DSL-tp5802871.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2