cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the incoming payload based on the condition

former_member213558
Active Participant
0 Kudos

Dear All.

Please find my scenario snapshot

Requirement is:

when we receive the incoming payload we need post the records to Odata.

the validation is:

before posting we need to check the Odata service whether it's exist or not. if records are exist we need send a mail saying that 'the records already exist' else we need to post the records to Odata.

the validation result is:

if the records are exist in Odata i'm getting a records from Odat like below

<Invoices>
    <Invoice>
      <BuyerID/>
      <VendorName>Roield</VendorName>
      <VendorNo>4716001571</VendorNo>
      <StatusID>01</StatusID>
      <InvoiceNo>R20</InvoiceNo>
      <StatusDesc>Received</StatusDesc>
      <InvoiceAmt>-144309</InvoiceAmt>
      <InvoiceDate>2016-10-31T13:51:39.000</InvoiceDate>
      <Currency>INR</Currency>
      <BuyerName>Technologies Private Limited</BuyerName>
    </Invoice>
  </Invoices>


if the records are not exist, i'm getting an response value from OData like below

 <Invoices/>

And the condition which i placed is working fine is working fine.

the issue is:

when , if the records are not available in OData we need to post the actual incoming payload, but the condition passing the value only <Invoices/> .

how can i get the actual payload here.

please suggest further.

Regards

Ramesh

Accepted Solutions (1)

Accepted Solutions (1)

Sriprasadsbhat
Active Contributor
0 Kudos

Hello Ramesh,

Its very easy to do using Properties and content Modifier .

1 ) You need to include 2 content Modifier like below one to store and another to restore.

First Content Modifier:

Set the property to hole incoming message ( ${in.body} ).

Second Content Modifier:

Call the property set before Request Reply to Body part which will restore the original message.

Regards,

Sriprasad Shivaram Bhat

0 Kudos

Hi Sriprasad,

I followed the same steps and created an iflow with exception subprocess. In exception subprocess I am calling the property to restore the payload. So this should log the incoming payload only in case if the message fails. But I am getting below error if I click on the 'payload' tab in message processing log. Also its not logging any payload. Could you please help me with your inputs and suggestoons.

Error

Request for log attachments failed with error: Invalid server response: Couldn't parse message. Status Code: 500 Message: <?xml version='1.0' encoding='UTF-8'?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><code>Internal Server Error</code><message xml:lang="en">while trying to invoke the method java.io.InputStream.read(byte[]) of a null object loaded from local variable 'is'</message></error>

Thanks,

Ashwini

Answers (2)

Answers (2)

Sriprasadsbhat
Active Contributor

Hello Ramesh,

There is no difference between ${body} and ${in.body} as per the Apache Documentation both of them refers to input message body.Similarly there is some thing called ${out.body} which refers to output body.

From SAP HCI perspective we use input message expressions more.

Regards,

Sriprasad Shivaram Bhat

former_member213558
Active Participant
0 Kudos

Dear Sri.

Thank you for your explanation.

former_member213558
Active Participant
0 Kudos

Thank you Sri. it's working.

i can see ${body} and {in.body} is working fine in property value. is there any differences.

Regards

Ramesh