Configuring Custom Content-Types
By default, Mediator supports the following Content-Types:
application/xml
application/json and application/json/badgerfish
application/octet-stream
text/xml
text/plain
multipart/form-data
application/soap+xml
application/x-www-form-urlencoded
In addition, you can define custom Content-Types for REST services and map them to the Content-Types.
To do this, edit the file:
Integration Server_directory\instances\instance_name\packages\WmMediator\config\resources\content-types.xml
which looks like this by default:
<?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-types>
For example, if you want to define the custom Content-Types myXMLContentType and myJsonContentType, specify those names in the <name> tag as follows:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<content-types xmlns="http://contentTypes.mediator.softwareag">
<content-type type="xml">
<name>myXMLContentType</name>
</content-type>
<content-type type="json">
<name>myJsonContentType>/name>
</content-type>
</content-types>
The type attribute of the content-type type describes the way this content-type must be handled by Mediator. In this example, the content-type myJsonContentType is parsed as JSON since its type attribute is json.
The valid values for the type attribute are:
content-type type Value | Base Content-Type |
text | text\plain |
multipart | multipart\form-data |
xml | application\xml |
soap | application\soap+xml, text\xml (mostly for SOAP services.) |
json | application\json |
json-badgerfish | application\json\badgerfish |
binary | application\octet-stream and other generic binary. |
url-encoded | application\x-www-form-urlencoded |
After you finish defining the custom Content-Types, you must reload the WmMediator package.
Note: | If a Content-Type with the same name already exists, then the existing Content-Type is overridden with the new one. |