0

Environment :- Web Service - Rest APIs. Media Type - JSON. JAX RS implementation - Jersey. HTTP Methods - POST, GET, PUT & DELETE. WSO2 API Gateway Manager - To sit on top of it to publish these APIs.

Problem :- The delete operation has a request body(a json message) which has input values in it. When I hit the services directly - the whole operation performs successfully. But once I go through the API Manager (using the URL that it publishes) - the request body seems to be getting dropped/ignored & hence the operation fails. Rest all the operations are working fine & so is the OAuth too.

Can someone please help me - as to why is the the request body (a json message) is getting discarded when I go through the WSO2 API gateway manager - and what can I do to get it working, please !!

Thanks in advance.

Abimaran Kugathasan
  • 31,165
  • 11
  • 75
  • 105
HMB
  • 41
  • 6

1 Answers1

2

HTTP DELETE opration isn't supposed have body. You can check here and here

Many frameworks discourage using it or warn you that the body may be dropped. The reason is that you want to DELETE some resource identified by your URI thus no body should be required.

Update

WSO2 API Manager depends on Apache HttpComponents/HttpCore library for this functionality and this issue is fixed in their 5.0 which isn't released yet.

You can find the JIRA here reported against httpCode library.

Community
  • 1
  • 1
Abimaran Kugathasan
  • 31,165
  • 11
  • 75
  • 105
  • 1
    Thanks Abimaran for your response. I completely agree with you that the resource should be identified by the URI. But - I think I was able to achieve this a few weeks ago by adding - schema: type: object description: Request Body name: Payload required: true in: body in the source file of the API (in publisher). Very strangely it's not working anymore & hence I was looking for may be a workaround/tweak that you could suggest. Happy to discuss more. Thanks much !! – HMB Apr 20 '16 at 11:03
  • @HMB, Are you sure, it's working earlier? I don't think so. Because, this reported and verified. – Abimaran Kugathasan Apr 20 '16 at 11:12
  • Yes, fairly confident that did work for me a few weeks back. Just that don't seem to have sufficient evidences around this. Wondering if there could be a workaround to make this happen.. Ta – HMB Apr 20 '16 at 11:25
  • What's ur API Manager version? – Abimaran Kugathasan Apr 20 '16 at 11:48
  • Do you think it is possible to go and make any config changes to the api-manager.xml file (CORSConfiguration) Or, make changes to the API specific xml file in \repository\deployment\server\synapse-configs\default\api. Or, the content-Length option in the header. OR, something related to this https://docs.wso2.com/display/ESB490/Unusual+Scenarios+for+HTTP+Methods+in+REST. Please suggest, any help will be really appreciated. Ta – HMB Apr 21 '16 at 09:50