I have a REST service which uses hypermedias with siren content. To be useable, the client have to send a Accept header with this value:
application/vnd.siren+json
But when I virtualize this service via Centrasite to the Mediator package, requests are rejected.
When I use an accept with only application/json
requests are accepted but the content is without hypermedias links, so it is not useable.
I have changed the content-types.xml
file in resources of package Mediator like that:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<content-types xmlns="http://contentTypes.mediator.softwareag">
<!-- Please enter the custom content-types
<content-type type="xml">
<name></name>
</content-type>
-->
<content-type type="json">
<name>application/vnd.siren+json</name>
</content-type>
</content-types>
With that, requests with siren are now accepted, but without hypermedias content (as with application/json)
How can I force Mediator to accept this accept header and transfer it to the endpoint without changing it?
I use a webMethods Integration Server 9.7 with IS_9.7_Core_Fix19 and a Mediator 9.7.0.0017-0490
Update:
After viewing endpoint logs, it seems that the header and the response are correct, but the response is truncated by mediator. All the siren content is removed from the JSON response, but the response is still well formed, but incomplete, without any log in Mediator even in Debug mode.
Is it a Mediator problem, an axis one, or anything else?
Aftere searching in Empower knowledge base, I've found this :
If the Content-Type header field specifies a content type for which no content
handler has been registered, Integration Server uses the default content
handler (ContentHandler_Default), which treats the content as text/html.
This explains why I have to change the content-types.xml
file in the config directory of the WmMediator package.
Secondly, I've found that issue :
SMGME-6616 (Fix 18)
MultiRoot node elements of JSON type are not passed for a custom content type.
When a custom content type for JSON is executed and a multi root node
element is passed as a request for virtual rest API, then only the first
node is passed to the backend native API. This issue is resolved.
This seems a good explanation why I don't have the full content of my response, because with the Siren Hypermedia format, we have multiple roots in the json message.
So, no solution except patching.
Edit:
After patching, the problem is resolved