Skip to Content

How to get exception message in content modifier from service call

Dear All.

Please find my scenario.

i've selected "GET" operation to get some records from OData,

when the selected value which is exist in Odata i'm getting the response payload as mentioned below

the requirement is:

1. when we trying to GET the value which is not available in Odata then we need to send the value to Odata Adapter

2. when we trying to GET the value which is available in Odata then we need to send a mail saying that 'value already exist in Odata'

the issue is:

when we trying to GET the value which is available in OData, we should get the value as mentioned above (2nd picture) and when we trying to GET the value which is not available in OData we should get the exception in content modifier.

pleas note: i used Exception subprocess, ${exception.message} but not able to store the exception message

i can see the exception in my processing log, as mentioned below but i failed to get the exception message into my content container.

Exception is:

LastError = com.sap.gateway.core.ip.component.odata.exception.OsciException: Not Found : 404 : HTTP/1.1 http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> xml:lang="en">Requested entity could not be found. , cause: com.sap.gateway.core.ip.component.odata.exception.OsciException: Not Found : 404 : HTTP/1.1 http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> xml:lang="en">Requested entity could not be found.

please help how to get the exception in content modifier in this cases.

please do needful.

Regards

Ramesh

s1.png (26.6 kB)
s2.png (43.3 kB)
s2.png (43.3 kB)
s3.png (22.0 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Feb 03, 2017 at 08:25 AM

    Hello Ramesh,

    My bad ,there is root element also so below condition should work

    /Invoices/Invoice

    or

    //Invoice

    Regards,

    Sriprasad Shivaram Bhat

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 02, 2017 at 02:27 PM

    Hi Ramesh,

    Try using a Router and with a non-XML condition expression ${header.CamelHttpResponseCode} = '404'

    Add comment
    10|10000 characters needed characters exceeded

    • Dear Mark.

      Thanks for your response , in real time scenario this service all to be called using LocalIntegrationProcess, and the actual condition to be placed in main integration flow.

      if i place the condition ${header.CamelHttpResponseCode} = '404' in router into my main integration the condition is not happening.

      please suggest further.

      Regards

      Ramesh

  • Feb 02, 2017 at 03:39 PM

    Hello Ramesh,

    ${exception.message} works only inside the Exception SubProcess.

    As mark suggested you can try above condition in case the message status is Completed ,but as per your screenshot its straight away throwing an error and making the whole message to failed status.

    In ideal scenario if there is no data in your second get call it should give some response back with some information with status error and message status in Monitoring should be Completed.

    Just for your understanding once the message enters to Exception Subprocess message processing will be forcefully terminated ( Error End Event takes care of it).

    Regards,

    Sriprasad Shivaram Bhat

    Add comment
    10|10000 characters needed characters exceeded

    • Dear Sri.

      thank for your advise.

      In ideal scenario if there is no data in your second get call it should give some response back with some information with status error and message status in Monitoring should be Completed.

      yes, you are right . thanks for your suggestion.

      i've a small study on OData adapter.

      Actually there are two kind of GET operation available in Odata.

      1.Read(GET)

      2. Query(GET)

      if we use Read(GET) when the record is not available in Odata the message failing as i mentioned earlier.

      if we use Query(GET) when the record is not available in Odata the message getting completed by giving response with empty message type tag.

      yes, now the scenario is not failing. hopefully this is what you trying to say.

      but now the issue is how to route the response?

      now i'm getting 2 kind of response message.

      1. if record exit then i'm getting the response payload from Odata 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>
      

      2. if record does not exist then i'm getting the response payload from Odata like below

        <Invoices/>

      can you please suggest now, how can we route in these cases.

      please suggest

      Regards

      Ramesh

  • Feb 03, 2017 at 06:53 AM

    Hello Ramesh,

    After request reply add a Router and use the below condition.

    Regards,

    Sriprasad Shivaram Bhat

    Add comment
    10|10000 characters needed characters exceeded

    • Dear Sri.

      Thank for your reply.

      A small correction here,

      when Invoice Exit then we need to drop a mail saying that 'the invoice already exit'. else we need to POST the records to Odata.

      i tried by changing the condition but the condition is not happening. it always going to default route.

      in my real time scenario Get Odate in happening in LocalIntegrationProcess, based on the response we should route to the target. so when i place the condition into my main integration flow always going to default one.

      for your reference please find my complete scenario:

      please suggest further.

      Regards

      Ramesh

      q5.png (19.3 kB)
      q4.png (6.9 kB)
      q1.png (57.3 kB)
      q2.png (16.1 kB)
      q3.png (26.9 kB)