How to Enable Fast Infoset in Axis2/Java

- Sanjaya Karunasena
- - WSO2
Step 1: Configuring axis2.xml to identify the content type
In the "axis2.xml" under the section "messageFormatters" add the following Message Formatters.
<!-- ================================================= -->
<!-- Message Formatter -->
<!-- ================================================= -->
<messageFormatters>
...
<!-- Other Message Formatters -->
...
<!-- POX Message Formatter -->
<messageFormatter contentType="application/fastinfoset"
class="org.apache.axis2.fastinfoset.FastInfosetPOXMessageFormatter"/>
<!-- SOAP Message Formatter -->
<messageFormatter contentType="application/soap+fastinfoset"
class="org.apache.axis2.fastinfoset.FastInfosetMessageFormatter"/>
</messageFormatters>
Under the section "messageBuilders" add the following Message Builder.
<!-- ================================================= -->
<!-- Message Builders -->
<!-- ================================================= -->
<messageBuilders>
...
<!-- Other Message Builders -->
...
<!-- POX Message Builder -->
<messageBuilder contentType="application/fastinfoset"
class="org.apache.axis2.fastinfoset.FastInfosetPOXBuilder"/>
<!-- SOAP Message Builder -->
<messageBuilder contentType="application/soap+fastinfoset"
class="org.apache.axis2.fastinfoset.FastInfosetBuilder"/>
</messageBuilders>
Step2: Setting the content type of the message
If you want to use SOAP set the content type of the message to "application/soap+fastinfoset".
ServiceClient client= serviceStub._getServiceClient();
Options options = client.getOptions();
options.setProperty(Constants.Configuration.MESSAGE_TYPE,
"application/soap+fastinfoset");
If you want to use POX set the content type to of the message to "application/fastinfoset".
ServiceClient client= serviceStub._getServiceClient();
Options options = client.getOptions();
options.setProperty(Constants.Configuration.MESSAGE_TYPE,
"application/fastinfoset");
Applies To
Axis2/Java release 1.3 onward.