1
votes

I have newly added messageFormatter and messageBuilder similar to:

<messageFormatter contentType="application/hal+json" class="org.apache.synapse.commons.json.JsonStreamFormatter"/>

<messageBuilder contentType="application/hal+json" class="org.apache.synapse.commons.json.JsonStreamBuilder"/>

In this two files:

  • [API-HOME]/repository/conf/axis/axis2.xml
  • [API-HOME]/repository/conf/axis/axis2_blocking_client.xml

in API Manager version 3.0.0.

But in the APIM version 3.0.0 all changes in this files discards because any server configuration is: [API-HOME]/repository/conf/deployment.toml, reference: https://github.com/wso2/docs-apim/issues/498

What is the correct way of adding these lines ?

Thanks!

2

2 Answers

3
votes

Try this.

1) Open repository/resources/conf/templates/repository/conf/axis2/axis2.xml.j2.

i) Add these under <messageFormatters>

{% for message_formatter in custom_message_formatters %}
    <messageFormatter contentType="{{message_formatter.content_type}}"
                      class="{{message_formatter.class}}"/>
{% endfor %}

ii) Add these under <messageBuilders>

{% for message_builder in custom_message_builders %}
    <messageBuilder contentType="{{message_builder.content_type}}"
                    class="{{message_builder.class}}"/>
{% endfor %}

2) Add this to deployment.toml

[[custom_message_builders]]
content_type = "application/hal+json"
class="org.apache.synapse.commons.json.JsonStreamBuilder"

[[custom_message_formatters]]
content_type = "application/hal+json"
class="org.apache.synapse.commons.json.JsonStreamFormatter"

Ref: https://ei.docs.wso2.com/en/latest/micro-integrator/setup/message_builders_formatters/message-builders-and-formatters/#custom-message-formatter

1
votes

In API Manager 3.0.0, adding custom message builders, formatters cannot be done with the deployment.toml file.

Therefore, if you need to configure additional message builders, formatters, you need to edit the <APIM_HOME>/repository/resources/conf/templates/repository/conf/axis2/axis2.xml.j2 and add the required message builder and formatter.