blob: ff4debc72fcd1fc7380b6530584cb7e166eeb66e [file] [log] [blame]
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="">
<meta http-equiv="content-type" content="" />
<title>Supporting new/custom message types with MessageBuilder/Formatter</title>
<body dir="ltr" lang="en-US" xml:lang="en-US">
<h1>Supporting new/custom message types with MessageBuilder/Formatter</h1>
<p>Axis2 provides extended support for new or custom message types. This is done with
using a extension point in the Axis2 architecture, called message builders and formatters.
In Axis2 a builder is responsible of building the MessageContext by looking at the raw message
transmitted and the formatter is responsible of the inverse of that, which is to serialize a
MessageContext to the wire transfer format. Let's create a
custom MessageBuilder/Formatter to add the support for a new message type.</p>
<p>Send your feedback or questions to: <a href=
( Subscription details are available on the <a href="../mail-lists.html">Axis2 site</a>.)
Kindly prefix subject with [Axis2].</p>
<li><a href="#ContentType_with_new_builder_formatter">New ContentType handling with a custom message builder and formatter</a>
<li><a href="#Step1_MessageBuilder_implementation">Step1 : MessageBuilder implementation</a></li>
<li><a href="#Step2_MessageFormatter_implementation">Step2 : MessageFormatter implementation</a></li>
<li><a href="#Step3_Register_builder_formatter">Step3 : Register the builder and formatter with Axis2</a></li>
<li><a href="#Step4_Packaging">Step4 : Packaging builder and formatter</a></li>
<li><a href="#Step5_Testing">Step5 : Testing the new ContentType with the echo service</a></li>
<a name="ContentType_with_new_builder_formatter"></a>
<h3>New ContentType handling with a custom message builder and formatter</h3>
<p>Let's write a simple builder and formatter to add the support for a new content type</p>
<a name="Step1_MessageBuilder_implementation"></a>
<h4>Step1 : MessageBuilder implementation</h4>
<!--<p>LoggingModule is the implementation class of the Axis2 module.-->
<!--Axis2 modules should implement the "<a href=-->
<!--interface with the following methods.</p>-->
<!--public void init(ConfigurationContext configContext, AxisModule module) throws AxisFault;//Initialize the module-->
<!--public void shutdown(ConfigurationContext configurationContext) throws AxisFault;//End of module processing-->
<!--public void engageNotify(AxisDescription axisDescription) throws AxisFault;-->
<!--public void applyPolicy(Policy policy, AxisDescription axisDescription) throws AxisFault ;-->
<!--public boolean canSupportAssertion(Assertion assertion) ;-->
<a name="Step2_MessageFormatter_implementation"></a>
<h4>Step2 : MessageFormatter implementation</h4>
<a name="Step3_Register_builder_formatter"></a>
<h4>Step3 : Register the builder and formatter with Axis2</h4>
<a name="Step4_Packaging"></a>
<h4>Step4 : Packaging builder and formatter</h4>
<a name="Step5_Testing"></a>
<h4>Step5 : Testing the new ContentType with the echo service</h4>