cancel
Showing results for 
Search instead for 
Did you mean: 

How to Tiger Another local integration flow when OData response is empty

itsravi
Explorer
0 Kudos

Hi All

Need help regarding calling local integration flow .when the response payload is empty

we have scenario where we need to handle the empty response during the get operation of the request reply odata service .

if record not found it should go branch A.and trigger the process call

If record found it should go to the branch B, .

sample flow

For example :

if we query the odata end point using get operation for a filed email id , if the email is exits in the odata system it responds with payload or else a empty payload is returned.

EX:

$select=URI&$filter=URI eq test@gmail.com query.png

sample payload:

if record is found: record.png

If record not found response is empty-record.png

So experts need you help , can some guide me through the steps to achieve the requirement

Thanks

Ravi

Accepted Solutions (1)

Accepted Solutions (1)

Sriprasadsbhat
Active Contributor

Hello Ravi,

Below conditions will work for you

Valid Data:

/CustomerCollection/Customer != ''

Invalid Data[ Blank Response ]:

/CustomerCollection[ not(Customer)]

Regards,

Sriprasad Shivaram Bhat

itsravi
Explorer
0 Kudos

HI sriprasadshivaramabhat

Thanks for the input ,it is working now

Thanks

Ravi

Answers (2)

Answers (2)

apu_das2
Active Contributor
0 Kudos

Use below XPATH in the router to check empty response -

//CustomerCollection/exist(Customer) = 'False'

Thanks,

Apu

apu_das2
Active Contributor
0 Kudos

Use below XPATH in the router to check empty response -

//CustomerCollection/exist(Customer) = 'False'

Thanks,

Apu

itsravi
Explorer
0 Kudos

Hi apu.das2

I have tried the option you have suggested but still i see an error in cpi , need you help regrading the error .

please find the attachments for the condition ,payload and error i am getting

The error message i am getting in cpi

org.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath: /CustomerCollection/exists(Customer) = 'false'. Reason: javax.xml.xpath.XPathExpressionException: net.sf.saxon.trans.XPathException: Cannot compare xs:boolean to xs:string, cause: net.sf.saxon.trans.XPathException: Cannot compare xs:boolean to xs:string

Awaiting for your update.

Thanks