[
https://issues.apache.org/jira/browse/CAMEL-27756?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Saravanakumar Selvaraj reassigned CAMEL-27756:
----------------------------------------------
Assignee: Saravanakumar Selvaraj
> camel-alibaba-sms: sendSms does not fail the exchange when a response with
> the status 200 has a Code other than OK
> ------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27756
> URL: https://issues.apache.org/jira/browse/CAMEL-27756
> Project: Camel
> Issue Type: Bug
> Affects Versions: 4.23.0
> Reporter: Saravanakumar Selvaraj
> Assignee: Saravanakumar Selvaraj
> Priority: Minor
>
> Short Message Service gives the result of SendSms in the Code field of the
> response. OK means success, and any other value is an error code. The
> Dysmsapi 2017-05-25 API metadata says so in the schema of the response with
> the status 200. The metadata is at
> https://api.alibabacloud.com/meta/v1/products/Dysmsapi/versions/2017-05-25/api-docs.json.
> The Javadoc of SendSmsResponseBody in dysmsapi20170525 4.6.0 says the same.
> I checked the code of main at e785ba78ad52, dysmsapi20170525 4.6.0,
> tea-openapi 0.3.20 and tea-util 0.2.28:
> - For a response, tea-openapi throws a TeaException only when the status is
> from 400 to 599. For any other status, it does not check the Code of the body.
> - SMSProducer.sendSms never checks the Code. It puts statusCode, code,
> message, bizId and requestId into a Map body, and it sets
> CamelAlibabaSmsRequestId.
> - So a response with the status 200 and a Code other than OK completes the
> exchange. onException and the error handler do not run.
> - A route has to check the code key of the body itself. No text of the
> component says that only OK means success.
> - An error with a status from 400 to 599 fails the exchange with a
> TeaException, whose getCode() gives the Code. So the Code of a failed send
> reaches the route in two ways.
> - The error code list of the API metadata covers the whole product. It gives
> most codes the status 400, and some, such as InternalError, the status 200.
> Proposed change:
> - Fail the exchange for a Code other than OK, or set a header that a route
> can test.
> - Say in the producerOut text and on the doc page that only OK means success.
> _Claude Code on behalf of saravanakumar1987_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)