You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2006/01/06 07:31:04 UTC
svn commit: r366437 [5/6] - in /webservices/axis2/trunk/java/xdocs: ./ 0_93/
0_93/adb/ 0_93/adb/images/ 0_93/images/ 0_93/images/archi-guide/
0_93/images/faq/ 0_93/images/tools/ 0_93/images/tools/service/
0_93/images/tools/wsdl/ 0_93/images/userguide/ ...
Added: webservices/axis2/trunk/java/xdocs/0_93/tools/idea-guide/guide.html
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/0_93/tools/idea-guide/guide.html?rev=366437&view=auto
==============================================================================
--- webservices/axis2/trunk/java/xdocs/0_93/tools/idea-guide/guide.html (added)
+++ webservices/axis2/trunk/java/xdocs/0_93/tools/idea-guide/guide.html Thu Jan 5 22:24:56 2006
@@ -0,0 +1,347 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
+ <TITLE></TITLE>
+ <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.4 (Win32)">
+ <META NAME="AUTHOR" CONTENT="Indika Deepal Jayasinghe">
+ <META NAME="CREATED" CONTENT="20050926;14373300">
+ <META NAME="CHANGEDBY" CONTENT="Indika Deepal Jayasinghe">
+ <META NAME="CHANGED" CONTENT="20050927;22421282">
+ <STYLE>
+ <!--
+ @page { size: 8.5in 11in; margin-left: 1.25in; margin-right: 1.25in; margin-top: 1in; margin-bottom: 1in }
+ P { margin-bottom: 0.08in }
+ -->
+ </STYLE>
+</HEAD>
+<BODY LANG="en-US" DIR="LTR">
+<P STYLE="margin-bottom: 0in">Code generation IDEA plug-in</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">Introduction
+</P>
+<P STYLE="margin-bottom: 0in">This document explains installation and
+usage of IDEA code generation plug-in.
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">Installation</P>
+<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-style: normal"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>First
+download the plug-in <FONT COLOR="#800000">link</FONT> which is a
+zipped file, and extract that into plugins directory in IDEA
+installation directory or plugins directory in user directory
+(usre/idea/conf/plugins), if you have correctly extracted the file
+you would see a directory called Axis2 and inside there should be
+only one directory called lib and bunch of .jar files can be seen
+inside that.</FONT></FONT></P>
+<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
+</P>
+<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-style: normal"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Next
+step is to restart IDEA to changes to be taken place , when you
+restart IDEA you would see following icons in IDEA if the plug-in has
+been installed correctly. </FONT></FONT>
+</P>
+<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_3b1c4fe5.jpg" NAME="Graphic1" ALIGN=LEFT WIDTH=194 HEIGHT=67 BORDER=0><BR CLEAR=LEFT>As
+well as if you right-click on editor page you would see a link for
+the same plug-in form that too.
+</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_4b4b2664.jpg" NAME="Graphic2" ALIGN=LEFT WIDTH=294 HEIGHT=291 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">When you click one of them a window
+will appear by asking to select one from two options.</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_m7325ea.jpg" NAME="Graphic3" ALIGN=LEFT WIDTH=290 HEIGHT=226 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">Click on WSDL2Java codegenaration and
+click OK to generate code from a WSDL file. Then the following window
+will appear.</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_m537364e3.png" NAME="Graphic4" ALIGN=LEFT WIDTH=547 HEIGHT=332 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P ALIGN=LEFT STYLE="margin-bottom: 0in"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>To
+move on to the next page the WSDL file location must be given. The
+browse button can be used to easily browse for a file rather than
+typing the whole path.</FONT></FONT></P>
+<P ALIGN=LEFT STYLE="margin-bottom: 0in"><BR>
+</P>
+<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Once
+the WSDL file is selected, codegen options are to be selected. By far
+this is the most important page in this wizard, which determines the
+characteristics of the code being generated. Novices need not worry
+about these options since the most common options are defaulted, But
+advanced users will find it very easy to "turn the knobs"
+using these options.</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_m57c66fa3.png" NAME="Graphic5" ALIGN=LEFT WIDTH=547 HEIGHT=332 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in">Output language can be Java, C# or C++
+but we not fully tested C# and C++ codegenration there for it is
+better to select Java as output language.
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">Since Axis2 support both synchronous
+and asynchronous client programming model , the tool has provide a
+way to select the options.
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">Data binding type , the default data
+binding type is pure OM, though the tool is capable of providing XML
+beans due to class loading issues in XML beans current implementation
+only generate code with OM.</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_m13753cdd.png" NAME="Graphic6" ALIGN=LEFT WIDTH=545 HEIGHT=313 BORDER=0><BR CLEAR=LEFT>Package
+name : The package name of the generated code , you can set the
+package name that you want.
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">To select the output location or the
+location that the to be generated , you do not need to type the
+output location you can brows and select the location.</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_4a61fcdd.gif" NAME="Graphic7" ALIGN=LEFT WIDTH=548 HEIGHT=334 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in">If everything has gone well you will
+see output like above.
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">IDEA service archive generation plug-in</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">First step is to click on Axis2 IDEA
+plug-in icon and select service archive creation on that.</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_m162cbb77.png" NAME="Graphic8" ALIGN=LEFT WIDTH=326 HEIGHT=272 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in">Then a wizard will appear by asking to
+select archive type
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_m554c5834.png" NAME="Graphic9" ALIGN=LEFT WIDTH=576 HEIGHT=403 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in">Select archive type : In Axis2 user can
+deploy single service or service group so you can select the service
+type you want to create.</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">If you already have services.xml you
+can skip some of the steps in the wizard so if you have services.xml
+with you click on “I already have services.xml” and click
+on next , if you do not have the tool will create services.xml for
+you.</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">Depending on the option you select
+there can be three sub wizards,
+</P>
+<OL>
+ <LI><P STYLE="margin-bottom: 0in; text-decoration: none">Sub wizard
+ 1(create single service and its services.xml)</P>
+ <LI><P STYLE="margin-bottom: 0in; text-decoration: none">Sub wizard
+ 2 (create service group and its services.xml)</P>
+ <LI><P STYLE="margin-bottom: 0in; text-decoration: none">Sub wizard
+ 3 (create service/service group using give services.xml)</P>
+</OL>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in; text-decoration: none">Option 1 and
+option 2 follow the same set of steps except some looping mechanism
+in the middle of the wizard.
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><U>Sub wizard 1 & Sub wizard 3</U></P>
+<P STYLE="margin-bottom: 0in; text-decoration: none">From the
+following page you have to select the location of classes directory ,
+where you compile output location , you do not need to type it, you
+can easily browse and select
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_m4f4e131a.png" NAME="Graphic10" ALIGN=LEFT WIDTH=576 HEIGHT=403 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in; text-decoration: none">When you click
+on next button , the page is to select service specific external
+libraries and service WSDL file(if you want to add multiple WSDL
+files you can do that too , in the case of service group you can add
+any number of WSDL files depending on the services in service group)</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_e71dcbb.png" NAME="Graphic11" ALIGN=LEFT WIDTH=576 HEIGHT=403 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><SPAN STYLE="text-decoration: none">Adding
+libraries first click on small button to browse li</SPAN>brary file
+and then click on Add then the selected file will be appear in the
+list box.</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">To add WSDLs first click on small
+button to select WSDL file and then click Add button to add the file
+to the list.
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_m64d1e33a.png" NAME="Graphic12" ALIGN=LEFT WIDTH=553 HEIGHT=372 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">Next page is to select service
+implementation class (in the case of service group same page will be
+looped to select multiple service implementation classes)</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">Step 1:</P>
+<P STYLE="margin-bottom: 0in">Select a service implementation class
+by browsing and the press Load button to load all the public methods
+in that class and you can select the methods that you want to
+publish.</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_m525c6fd4.png" NAME="Graphic13" ALIGN=LEFT WIDTH=571 HEIGHT=377 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">In service name textbox you can type
+the name of the service you want , but remember service name should
+be across the system.
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">When you have complete on this
+particular service press Done (in the first place if you have
+selected service group when you press the button then the following
+dialog will appear to add some more service to service group)</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_21cf5dea.png" NAME="Graphic14" ALIGN=LEFT WIDTH=309 HEIGHT=122 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in">If you press yes , you have to follow
+the same procedure to add some other service to service group.</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">If you press No you can , Next button
+will be enabled and you can go to next page.</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">Note from this onward the steps are
+similar to all the sub wizards.</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_m11f3ff8a.png" NAME="Graphic15" ALIGN=LEFT WIDTH=576 HEIGHT=403 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in">This page displays the servics.xml file
+(either you given one in the case of “I already have
+services.xml” or the system generated one for you.)</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">This page can editable and provide a
+way to add parameters and module references to any level.
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">Note : When you click on one of those
+button remember corresponding texts will be added to the current
+mouse position. Therefor click on the location you want to add the
+parameter and then press the button . If you click on the parameter
+button a window will appear asking to give parameter name and
+parameter value.
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_34f80643.png" NAME="Graphic16" ALIGN=LEFT WIDTH=300 HEIGHT=180 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in">Or you can manually add parameters to
+any where in the document as you wish.
+</P>
+<P STYLE="margin-bottom: 0in">Adding module references can be done by
+clicking on +ModuleRef button in the window you have to type the name
+of the module to be engaged.</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_md0694ad.png" NAME="Graphic17" ALIGN=LEFT WIDTH=300 HEIGHT=100 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in">When you complete press the Next button
+to go to final stage.
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_7eee430d.png" NAME="Graphic18" ALIGN=LEFT WIDTH=576 HEIGHT=403 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in">Next step is to select output location
+, the location output archive file should be created.</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">In the Archive Name just type the name
+of the archive file you want to put and that will finally become the
+service group name.
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">Note : Do not include file extension
+name when you write archive name we will create that for you.</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">When you are done click the Finish
+button , if everything has gone well you will see following message.
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_75a33d2f.png" NAME="Graphic19" ALIGN=LEFT WIDTH=268 HEIGHT=122 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><U>Sub wizard 2</U></P>
+<P STYLE="margin-bottom: 0in; text-decoration: none">In the case of
+services.xml is already available , the steps look like as follows,</P>
+<P STYLE="margin-bottom: 0in"><IMG SRC="guide_html_b2fa277.png" NAME="Graphic20" ALIGN=LEFT WIDTH=576 HEIGHT=403 BORDER=0><BR CLEAR=LEFT><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">This page is to select both location of
+services.xml and the location of classes directory, you can press
+select button and browse the file system to find required document
+and location.
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in">If we click on Next button then the
+procedure is same as above, in next page provide a way to edit
+services.xml as mentioned earlier.
+</P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+</BODY>
+</HTML>
\ No newline at end of file
Added: webservices/axis2/trunk/java/xdocs/0_93/tools/idea-guide/idaeguide.pdf
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/0_93/tools/idea-guide/idaeguide.pdf?rev=366437&view=auto
==============================================================================
Binary file - no diff available.
Propchange: webservices/axis2/trunk/java/xdocs/0_93/tools/idea-guide/idaeguide.pdf
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: webservices/axis2/trunk/java/xdocs/0_93/tools/idea-guide/idea-icons.GIF
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/0_93/tools/idea-guide/idea-icons.GIF?rev=366437&view=auto
==============================================================================
Binary file - no diff available.
Propchange: webservices/axis2/trunk/java/xdocs/0_93/tools/idea-guide/idea-icons.GIF
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: webservices/axis2/trunk/java/xdocs/0_93/tools/idea-guide/idea-icons.JPG
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/0_93/tools/idea-guide/idea-icons.JPG?rev=366437&view=auto
==============================================================================
Binary file - no diff available.
Propchange: webservices/axis2/trunk/java/xdocs/0_93/tools/idea-guide/idea-icons.JPG
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: webservices/axis2/trunk/java/xdocs/0_93/tools/idea-guide/idea-popup.JPG
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/0_93/tools/idea-guide/idea-popup.JPG?rev=366437&view=auto
==============================================================================
Binary file - no diff available.
Propchange: webservices/axis2/trunk/java/xdocs/0_93/tools/idea-guide/idea-popup.JPG
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: webservices/axis2/trunk/java/xdocs/0_93/transport_howto.html
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/0_93/transport_howto.html?rev=366437&view=auto
==============================================================================
--- webservices/axis2/trunk/java/xdocs/0_93/transport_howto.html (added)
+++ webservices/axis2/trunk/java/xdocs/0_93/transport_howto.html Thu Jan 5 22:24:56 2006
@@ -0,0 +1,216 @@
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="">
+ <title></title>
+</head>
+
+<body>
+<h1>How to write your own Axis2 transport</h1>
+
+<h2>Prologue</h2>
+
+<p>To stop you from reinventing the wheel I will quickly list the transports
+that are already supported in Axis2 with a small description before we get
+started.</p>
+
+<p></p>
+<ul>
+ <li><b>HTTP</b> - In the HTTP transport, the transport Listener is a
+ Servlet or a Simple HTTP server provided by Axis2. The transport Sender
+ uses sockets to connect and send the SOAP Message. Currently we have the
+ commons-HTTP-client based HTTP Transport sender as the default
+ transport.</li>
+ <li><b>TCP</b> This is the most simple transport, but needs addressing
+ support to be functional.</li>
+ <li><b>SMTP</b> This can work off a single email account or a mailserver.
+ The Mail Transport Receiver is a tread that checks for emails in fixed
+ time intervals.</li>
+</ul>
+
+<p>To understand the rest of this document you will need some understanding
+of the Architecture of Axis2. Therefor if you are not familiar with the
+Architecture of Axis2 you will have to first read the <a
+href="Axis2ArchitectureGuide.html">Axis2 Architecture Guide</a> before you
+read any further.</p>
+
+<h2>Introduction</h2>
+
+<p>Broadly speaking a transport inside Axis2 can be classified as a way of
+getting a messages that arrive though some channel into the Axis2 engine. The
+core of Axis2 is a transport agnostic one. All data that is transport
+specific is striped out of the incoming message and inserted into the
+MessageContext and on the outgoing message all transport specific information
+like headers are added and sent.</p>
+
+<p>To write your own transport you will need to primarily write two classes,
+one is the TransportSender and the other is the TransportReceiver. To
+register a transport with Axis2 you will need to put two entries in the
+axis2.xml file. One for the transport receiver and the other for the
+transport sender. We will walk though the process of adding the entries in
+the relevent sections.</p>
+
+<h2>Transport Receiver</h2>
+
+<p>Any message that is comming into Axis2 needs to go though a transport
+receiver. All information about how the message is received at the Axis2
+server from the wire [or by snail mail for that matter:)] is isolated inside
+the transport receiver. It extracts the data that is coming on the wire and
+transforms it into a state that the Axis2 server understands.</p>
+
+<p>So now that we have some background information about how transports work
+inside Axis2 with out further delay why don't we dive into some coding and
+start building out own transport.</p>
+
+<p></p>
+
+<p>To get things stared you will first need to extend from the
+org.apache.Axis2.transport.TransportListener class and write you own
+transport listener. To create an engine to process the MessageContext we need
+a configuration context. The following code fragment will do this. This
+should ideally be only done once for the lifetime of the Transport
+receiver.</p>
+
+<p><source></p>
+<pre>try {
+ //Create a factory
+ ConfigurationContextFactory factory = new ConfigurationContextFactory();
+ //Use the factory and an Axis2 repository to create a new Configuration Context
+ configurationContext = factory.buildConfigurationContext(repository_directory);
+} catch (Exception e) {
+ log.info(e.getMessage());
+}</pre>
+</source>
+<p>Now we need some kind of a listener to listen to the requests that come
+in. This you will need to implement according to the transport that you are
+trying to build. After a message is received at the receiver you can use the
+following code to process the request and then forward the message context to
+the engine using thing the engine.receive(msgContext) method.</p>
+<source><pre>AxisEngine engine = new AxisEngine(configurationContext);
+MessageContext msgContext = null;
+// create and initialize a message context
+try {
+ TransportInDescription transportIn =
+ reg.getAxisConfiguration().getTransportIn(new QName(Constants.TRANSPORT_NAME));
+ TransportOutDescription transportOut =
+ reg.getAxisConfiguration().getTransportOut(new QName(Constants.TRANSPORT_NAME));
+ if (transportIn != null && transportOut != null) {
+ //create Message Context
+ msgContext = new MessageContext(configurationContext, transportIn, transportOut);
+ msgContext.setServerSide(true);
+ msgContext.setProperty(MailSrvConstants.CONTENT_TYPE, message.getContentType());
+ msgContext.setProperty(MessageContext.CHARACTER_SET_ENCODING, message.getEncoding());
+
+ String soapAction = message.getSOAPActionHeader();
+ msgContext.setWSAAction(soapAction);
+ msgContext.setSoapAction(soapAction);
+
+ // Here we are trying to set the reply to if it is present in the transport information.
+ msgContext.setReplyTo(new EndpointReference(message.getReplyTo());
+
+ //Create the SOAP Message -- This code in from the mail transport and will change depending
+ //on how the data is handled in each transport.
+ ByteArrayInputStream bais = new ByteArrayInputStream(message.getContent().toString().getBytes());
+ XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(bais);
+
+ String soapNamespaceURI = "";
+ if(message.getContentType().indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) > -1){
+ soapNamespaceURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+ }else if(message.getContentType().indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1){
+ soapNamespaceURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+ }
+
+ StAXBuilder builder = new StAXSOAPModelBuilder(reader, soapNamespaceURI);
+
+ SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
+ msgContext.setEnvelope(envelope);
+ if (envelope.getBody().hasFault()) {
+ engine.receiveFault(msgContext);
+ } else {
+ engine.receive(msgContext);
+ }
+ } else {
+ throw new AxisFault(Messages.getMessage("unknownTransport",Constants.TRANSPORT_NAME));
+ }
+
+} catch (Exception e) {
+ try {
+ if (msgContext != null) {
+ MessageContext faultContext = engine.createFaultMessageContext(msgContext, e);
+ engine.sendFault(faultContext);
+ } else {
+ log.error(e);
+ }
+ } catch (AxisFault e1) {
+ log.error(e);
+ }
+}</pre>
+</source>
+<p>Now we have the coding in place and we need to let Axis2 know about our
+new transport receiver. How we do this is by addind an entry into the
+axis2.xml file. If you need to pass any properties for the transport to
+operate it can also be done through the axis2.xml file.</p>
+<source><pre> <transportReceiver name="TRANSPORT_NAME" class="org.apache.Axis2.transport.TRANSPORT_NAME.TRANSPORT_LISTNER_CLASS">
+ <parameter name="PROPERTY_NAME" locked="false">PROPERTY_VALUE</parameter>
+ <parameter name="PROPERTY_NAME_2" locked="false">PROPERTY_VALUE_2</parameter>
+ </transportReceiver>
+ </pre>
+</source>
+<p>Using a code fragment like
+Utils.getParameterValue(transportOut.getParameter(MailSrvConstants.SMTP_USER))
+we can extract the parameters that we insert into the axis2.xml file.</p>
+
+<p>So as you can see getting a new transport receiver up and running is a
+task that requires very little effort.</p>
+
+<h2>Transport Sender</h2>
+
+<p>Any message that is to be sent out from Axis2 is sent through the
+Transport Sender. The Transport Sender needs to be extended from the
+org.apache.Axis2.transport.AbstractTransportSender class.</p>
+
+<p>The following bit of code from the abstract transport sender will call the
+Transport Sender that you wrote.</p>
+<source><pre>// If an EPR is present then the message is going on a diffrent channel.
+if (epr != null) {
+ out = openTheConnection(epr, msgContext);
+ OutputStream newOut = startSendWithToAddress(msgContext, out);
+ if (newOut != null) {
+ out = newOut;
+ }
+ writeMessage(msgContext, out);
+ finalizeSendWithToAddress(msgContext, out);
+ } else {
+ out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);
+ if (out != null) {
+ startSendWithOutputStreamFromIncomingConnection(msgContext, out);
+ writeMessage(msgContext, out);
+ finalizeSendWithOutputStreamFromIncomingConnection(msgContext, out);
+ } else {
+ throw new AxisFault(
+ "Both the TO and Property MessageContext.TRANSPORT_WRITER is Null, No way to send response.");
+ }
+}</pre>
+</source>
+<p>So depending on whether your transport is using the same channel to send
+the responce or using a different channel you will need to implement a
+sub-set of the methods from the abstract class.</p>
+
+<p>After implementing the necessary methods you can let Axis2 know about your
+new transport sender by adding an entry to the axis2.xml file like you did
+for the Transport Receiver.</p>
+<source><pre> <transportSender name="TRANSPORT_NAME" class="org.apache.Axis2.transport.TRANSPORT_NAME.TRANSPORT_SENDER_CLASS">
+ <parameter name="PROPERTY_NAME" locked="false">PROPERTY_VALUE</parameter>
+ <parameter name="PROPERTY_NAME_2" locked="false">PROPERTY_VALUE_2</parameter>
+ </transportSender>
+ </pre>
+</source>
+<p>Have a look at org.apache.Axis2.transport.mail.MailTransportSender for a
+very simple Transport Sender. Also have a look at
+org.apache.Axis2.transport.http.CommonsHTTPTransportSender which is used to
+send HTTP responses.</p>
+
+<p>Once we have written our transport receiver and our transport sender, and
+inserted the needed entries into the axis2.xml file we are done. It is as
+simple as that. :-)</p>
+</body>
+</html>