Openbravo Issue Tracking System - Modules
View Issue Details
0054015ModulesOpenbravo Business APIpublic2023-11-23 12:062023-12-12 10:44
javietxe 
Triage Platform Conn 
normalmajoralways
closedfixed 
5
 
 
0054015: API failing but responding 200
When an API is called and it has a mapping error, the response seems to be a success response (it is marked as a 200) but the JSON is not valid.
An example:

- Create a Shipment with a shipment line without setting a bin to it (or deleting it if it's automatically set)
- Through postman, do this call setting the date of the Shipment created
https://livebuilds.openbravo.com/context/retail_modules_pgsql_pi/ws/org.openbravo.api.ExportService/ShipmentInOut/goodsReceiptByMovementDate?movementDate=2012-07-24&_page=1&_pageSize=5 [^]

Check that even the response has a JSON and the response code is a 200, the JSON is not complete.

Check also that in the openbravo.logs it exists a stacktrace with the error. In this example:
ERROR org.openbravo.service.web.BaseWebServiceServlet - Value of property bin is null but it does not accept null values
org.openbravo.base.exception.OBException: Value of property bin is null but it does not accept null values
When this type of error happens, the response code has to be an error.
No tags attached.
related to defect 0054016 closed ramprakash Retail Modules Wrong mapping in shipment lines 
related to defect 0054102 acknowledged Triage Platform Conn Modules Erroneous export WS response can contain an unterminated json content 
Issue History
2023-11-23 12:06javietxeNew Issue
2023-11-23 12:06javietxeAssigned To => Triage Platform Conn
2023-11-23 12:06javietxeTriggers an Emergency Pack => No
2023-11-23 12:24javietxeRelationship addedrelated to 0054016
2023-11-23 12:29javietxeSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=27189#r27189
2023-12-11 12:07hgbotNote Added: 0158039
2023-12-12 10:33hgbotResolutionopen => fixed
2023-12-12 10:33hgbotStatusnew => closed
2023-12-12 10:33hgbotNote Added: 0158074
2023-12-12 10:33hgbotNote Added: 0158075
2023-12-12 10:43caristuIssue cloned0054102
2023-12-12 10:43caristuRelationship addedrelated to 0054102
2023-12-12 10:44caristuProjectRetail Modules => Modules
2023-12-12 10:44caristuCategoryRetail API => Openbravo Business API

Notes
(0158039)
hgbot   
2023-12-11 12:07   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.api/-/merge_requests/221 [^]
(0158074)
hgbot   
2023-12-12 10:33   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.api [^]
Changeset: 8518d1f8bf34bb96e1cf40e478f9b6fa6a3bf4aa
Author: Carlos Aristu <carlos.aristu@openbravo.com>
Date: 11-12-2023 11:07:24
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.api/-/commit/8518d1f8bf34bb96e1cf40e478f9b6fa6a3bf4aa [^]

fixes BUG-54015: api WS response status is sometimes wrongly set as success

  The response of the api export WS was wrongly marked as success when
the writing of the response data failed.

  This could happen for example if the mapping of one of the exported
items failed.

  Now we are properly setting the status code of the response as an
internal server error (500) in that case.

---
M src-test/org/openbravo/api/service/JSONResponseWriterTest.java
M src/org/openbravo/api/service/JSONResponseWriter.java
---
(0158075)
hgbot   
2023-12-12 10:33   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.api/-/merge_requests/221 [^]