saravanakumar1987 opened a new pull request, #31080: URL: https://github.com/apache/camel/pull/31080
# Description Fixes [CAMEL-27756](https://issues.apache.org/jira/browse/CAMEL-27756). ## Summary Short Message Service gives some error codes the HTTP status 200, and tea-openapi does not check the Code. So a send with a Code other than OK completed the exchange. sendSms now fails the exchange with a TeaException for any Code other than OK. - `SMSProducer` throws a `com.aliyun.tea.TeaException` in the form that tea-openapi builds for an HTTP status from 400 to 599. - `getCode()` gives the Code, and `getData()` holds the fields of the body, such as BizId and RequestId, and the statusCode. - A response without a Code or without a body fails the exchange too, as only OK means success. - The producerOut text and the doc page say when the exchange fails. - The upgrade guide has a section on it, in a new guide of 4.25, as `camel-4.24.0` is tagged. ### Why the exchange fails Every other failed send already fails the exchange, and a route must not take a failed send for a success. tea-openapi 0.3.20 parses the body of SendSms with tea-util 0.2.28, which throws a TeaUtilException unless it is a JSON object. So only a mock or a custom client returns a response without a body. ## Tests - Three new tests of `SendSmsTest` cover a Code other than OK, and a response without a Code or a body. - Each failed before the change, as the exchange completed without an exception. - `SMSProducerTest` now mocks a response with the Code OK, as a response without a body fails. - The module tests of camel-alibaba-sms ran 10 tests, and CamelCatalogTest ran 156 tests, with no failure. # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [x] I ran `mvn clean install -Dquickly -DskipTests` in the root folder on the parent commit. Then I ran the builds of camel-alibaba-sms, camel-catalog with CamelCatalogTest, camel-componentdsl and camel-endpointdsl, and committed all generated changes. # AI-assisted contributions - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used. _Claude Code on behalf of saravanakumar1987_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
