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/09/27 06:24:59 UTC
svn commit: r450308 [1/2] - in /webservices/axis2/trunk/java/xdocs/1_1:
tcp-transport.html transport_howto.html userguide1.html userguide2.html
Author: chatra
Date: Tue Sep 26 21:24:56 2006
New Revision: 450308
URL: http://svn.apache.org/viewvc?view=rev&rev=450308
Log:
Committing minor corrections. Thanks Hasmin
Modified:
webservices/axis2/trunk/java/xdocs/1_1/tcp-transport.html
webservices/axis2/trunk/java/xdocs/1_1/transport_howto.html
webservices/axis2/trunk/java/xdocs/1_1/userguide1.html
webservices/axis2/trunk/java/xdocs/1_1/userguide2.html
Modified: webservices/axis2/trunk/java/xdocs/1_1/tcp-transport.html
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/xdocs/1_1/tcp-transport.html?view=diff&rev=450308&r1=450307&r2=450308
==============================================================================
--- webservices/axis2/trunk/java/xdocs/1_1/tcp-transport.html (original)
+++ webservices/axis2/trunk/java/xdocs/1_1/tcp-transport.html Tue Sep 26 21:24:56 2006
@@ -1,119 +1,119 @@
-<html>
-<head>
- <meta content="">
- <meta content="">
- <meta content="">
- <meta http-equiv="content-type" content="">
- <title>TCP transport</title>
-</head>
-
-<body lang="en">
-<h1>TCP Transport</h1>
-This document will explain how to send and receive SOAP Messages via TCP in
-Axis2. Sample with be used for more clarity
-
-<p><i>Send your feedback or questions to: <a
-href="mailto:axis-dev@ws.apache.org">axis-dev@ws.apache.org</a></i>. Prefix
-subject with [Axis2]. To subscribe to mailing list see <a
-href="http://ws.apache.org/axis2/mail-lists.html">here.</a></p>
-
-<h2>Content</h2>
-<ul>
- <li><a href="#intro">Introduction</a></li>
- <li><a href="#start">How to Start the TCPServer</a></li>
- <li><a href="#send">How to Send SOAP Messages Using TCP Transport</a></li>
- <li><a href="#samples">Samples</a></li>
- <li><a href="#components">Transport Components</a></li>
-</ul>
-<a name="intro"></a>
-
-<h2>Introduction</h2>
-
-<p>Axis2 supports TCP as a transport. Axis2 has support for both send and
-receive SOAP Messages via TCP. TCP transport does not have any application
-level headers and the SOAP Message that is send should be self contained.
-This makes the interaction fast and simple. Since there are no application
-headers, it does not have the privilege of having request URI, and Service
-dispatching should be done with a alternative method. Thus,
-RequestURIBasedDispatcher can not be used. Following are the two main
-alternatives available in dispatching in Axis2 Environment.</p>
-<ol>
- <li>Use the name space URI of the first child element of SOAPBody.
- (SOAPMessageBodyBasedDispatcher)</li>
- <li>Enable the WS-Addressing. In the case of 1.1 release addressing is
- default (SOAPActionBasedDispatcher)</li>
-</ol>
-
-<p>When TCP request is sent it's user's responsibility to use either
-addressing or SOAP body base mechanism.</p>
-<a name="start"></a>
-
-<h2>How to Start the TCPServer</h2>
-
-<p>The TCP server can be started by running the class
-org.apache.axis2.transport.tcp.TCPServer with two parameters <a
-href="../faq.html#c5">repository</a> and port number as argument. This class
-needs all the axis dependency jars in the classpath. New Services can be
-added in the usual way by dropping the archives to repository (See <a
-href="userguide.html">User's Guide</a> for more information)</p>
-
-<p>Alternatively the TCP Server can run with tcp-server.bat/ tcp-server.sh
-file in the bin directory of the Binary distribution of TCP Server.</p>
-<a name="send"></a>
-
-<h2>How to Send SOAP Messages Using TCP Transport</h2>
-
-<p>The TCP transport can be enabled easily from the call API. Following code
-segment demonstrate how it can be done.</p>
-<source><pre>OMElement payload = ...
-
-ServiceClient serviceClient = new ServiceClient();
-Options options = new Options();
-options.setTo(targetEPR);
-options.useSeperateListener(false);
-serviceClient.setOptions(options);
-
-OMElement response =
- serviceClient.sendReceive(payload);</pre>
-</source>
-<p>The transport that should be invoked is inferred from the targetEPR
-(tcp://...). In this case it is TCP and the listener, also TCP . SOAP Message
-has to be self contained in order to use addressing. Only other option one
-can think of is to use the URI of the first child of the SOAP Body to
-dispatch the service. The Parameter is of the type <a
-href="../faq.html#a2">OMElement</a>, the XML representation of Axis2.</p>
-<a name="sample"></a>
-
-<h2>Sample</h2>
-
-<p>Sample for a TCP Client can be found from the
-samples/userguide/src/userguide/clients/TCPClient.java in the binary
-distribution. This access the same web service explained in the <a
-href="userguide.html">Axis2 User's Guide</a>. The client first starts the
-TCPServer with the same repository used for the <a
-href="userguide.html">Axis2 User's Guide</a> samples. Since sample is already
-deployed in the repository while trying the userguide it will be
-automatically available.</p>
-<a name="components"></a>
-
-<h2>Transport Components</h2>
-
-<p>Axis2 TCP transport has two components, a transport Listener for receiving
-the Messages and transport Sender to send the SOAP Messages. Axis2
-installation has both the components built in to itself by default. In the
-axis2.xml configuration file the two TCP transport components would look like
-as follows.</p>
-
-<p>If the TCP server is started manually this configuration does not take
-effect. In return this effects the transport Listener's start by Axis2. (e.g.
-Listener started by the Complete Async interaction)</p>
-
-<p>Following xml lines initializes the TCPTransport Receiver:</p>
-<source><pre><transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer">
- <parameter name="port" locked="false">6060</parameter>
-</transportReceiver></pre>
-</source>
-<p>Following xml lines adds the TCPTransport Sender:</p>
-<source><pre><transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/></pre>
-</source></body>
-</html>
+<html>
+<head>
+ <meta content="">
+ <meta content="">
+ <meta content="">
+ <meta http-equiv="content-type" content="">
+ <title>TCP transport</title>
+</head>
+
+<body lang="en">
+<h1>TCP Transport</h1>
+This document will explain how to send and receive SOAP Messages via TCP in
+Axis2.
+
+<p><i>Send your feedback or questions to: <a
+href="mailto:axis-dev@ws.apache.org">axis-dev@ws.apache.org</a></i>. Prefix
+subject with [Axis2]. To subscribe to mailing list see <a
+href="http://ws.apache.org/axis2/mail-lists.html">here.</a></p>
+
+<h2>Content</h2>
+<ul>
+ <li><a href="#intro">Introduction</a></li>
+ <li><a href="#start">How to Start the TCPServer</a></li>
+ <li><a href="#send">How to Send SOAP Messages Using TCP Transport</a></li>
+ <li><a href="#samples">Samples</a></li>
+ <li><a href="#components">Transport Components</a></li>
+</ul>
+<a name="intro"></a>
+
+<h2>Introduction</h2>
+
+<p>Axis2 supports TCP as a transport. It has support for both send and
+receive SOAP Messages via TCP. TCP transport does not have any application
+level headers and the SOAP Message that is sent should be self contained.
+This makes the interaction fast and simple. However since there are no
+application headers, it does not have the privilege of having request URI,
+and Service dispatching should be done by an alternative method. Thus,
+RequestURIBasedDispatcher can not be used. Following are the two main
+alternatives available for dispatching in the Axis2 environment.</p>
+<ol>
+ <li>Use the name space URI of the first child element of SOAPBody.
+ (SOAPMessageBodyBasedDispatcher)</li>
+ <li>Enable WS-Addressing. In the case of version 1.1 release Addressing is
+ default (SOAPActionBasedDispatcher)</li>
+</ol>
+
+<p>When the TCP request is sent it is the user's responsibility to use either
+Addressing or SOAP body base mechanism.</p>
+<a name="start"></a>
+
+<h2>How to Start the TCPServer</h2>
+
+<p>The TCP server can be started by running the class
+org.apache.axis2.transport.tcp.TCPServer with two parameters - <a
+href="../faq.html#c5">repository</a> and port number, as arguments. This
+class needs all the Axis dependency jars in the classpath. New services can
+be added in the usual way by dropping the archives to the repository (See <a
+href="userguide.html">User's Guide</a> for more information)</p>
+
+<p>Alternatively the TCP Server can run with tcp-server.bat/ tcp-server.sh
+file in the bin directory of the Binary distribution of TCP Server.</p>
+<a name="send"></a>
+
+<h2>How to Send SOAP Messages Using TCP Transport</h2>
+
+<p>TCP transport can be enabled easily from the call API. Following code
+segment demonstrate how it can be done.</p>
+<source><pre>OMElement payload = ...
+
+ServiceClient serviceClient = new ServiceClient();
+Options options = new Options();
+options.setTo(targetEPR);
+options.useSeperateListener(false);
+serviceClient.setOptions(options);
+
+OMElement response =
+ serviceClient.sendReceive(payload);</pre>
+</source>
+<p>The transport that should be invoked is inferred from the targetEPR
+(tcp://...). In this case it is TCP and the listener, also TCP . SOAP Message
+has to be self contained in order to use Addressing. The other option is to
+use the URI of the first child of the SOAP Body to dispatch the service. The
+Parameter is of the type <a href="../faq.html#a2">OMElement</a>, the XML
+representation of Axis2.</p>
+<a name="sample"></a>
+
+<h2>Sample</h2>
+
+<p>Sample for a TCP Client can be found from the
+samples/userguide/src/userguide/clients/TCPClient.java in the binary
+distribution. This accesses the same Web service explained in the <a
+href="userguide.html">Axis2 User's Guide</a>. The client first starts the
+TCPServer with the same repository used for the <a
+href="userguide.html">Axis2 User's Guide</a> samples. Since sample is already
+deployed in the repository while trying the userguide it will be
+automatically available.</p>
+<a name="components"></a>
+
+<h2>Transport Components</h2>
+
+<p>Axis2 TCP transport has two components, a transport Listener for receiving
+the Messages and transport Sender to send the SOAP Messages. Axis2
+installation has both the components built in to itself by default. In the
+axis2.xml configuration file the two TCP transport components would look as
+follows.</p>
+
+<p>If the TCP server is started manually this configuration does not take
+effect. In return this effects the transport Listener's start by Axis2. (e.g.
+Listener started by the Complete Async interaction)</p>
+
+<p>Following xml lines initializes the TCPTransport Receiver:</p>
+<source><pre><transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer">
+ <parameter name="port" locked="false">6060</parameter>
+</transportReceiver></pre>
+</source>
+<p>Following xml lines adds the TCPTransport Sender:</p>
+<source><pre><transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/></pre>
+</source></body>
+</html>
Modified: webservices/axis2/trunk/java/xdocs/1_1/transport_howto.html
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/xdocs/1_1/transport_howto.html?view=diff&rev=450308&r1=450307&r2=450308
==============================================================================
--- webservices/axis2/trunk/java/xdocs/1_1/transport_howto.html (original)
+++ webservices/axis2/trunk/java/xdocs/1_1/transport_howto.html Tue Sep 26 21:24:56 2006
@@ -1,218 +1,218 @@
-<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-httpclient 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 transport independent. 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 = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repository_directory,
-axis2xmllocation);
-} 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.{Following code
-snippet extracted from MailListener as an example}</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>
+<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, before we get started, I will
+quickly list the transports that are already supported in Axis2 with a small
+description. </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-httpclient 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 thread 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. If you are not familiar with the Axis2
+architecture, please go through 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 messages that arrive though some channel into the Axis2 engine. The
+core of Axis2 is transport independent. All data that is transport specific
+is striped out of the incoming message and inserted into the MessageContext.
+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. I will take you through the process of adding the entries
+in relevent sections.</p>
+
+<h2>Transport Receiver</h2>
+
+<p>Any message that is coming into Axis2 needs to go through 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, without further delay lets 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 = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repository_directory,
+axis2xmllocation);
+} 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 the engine.receive(msgContext) method.{Following code
+snippet is extracted from MailListener as an example}</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 that we have the coding in place, we need to let Axis2 know about our
+new transport receiver. We do this by adding 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>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 of 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>Therefor, depending on if 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>
Modified: webservices/axis2/trunk/java/xdocs/1_1/userguide1.html
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/xdocs/1_1/userguide1.html?view=diff&rev=450308&r1=450307&r2=450308
==============================================================================
--- webservices/axis2/trunk/java/xdocs/1_1/userguide1.html (original)
+++ webservices/axis2/trunk/java/xdocs/1_1/userguide1.html Tue Sep 26 21:24:56 2006
@@ -1,150 +1,148 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html>
-<head>
- <meta http-equiv="content-type" content="">
- <title>Axis2 User's Guide</title>
-</head>
-
-<body lang="en-US" dir="ltr">
-<h4><a name="Axis2_User's_Guide">Axis2 User's Guide</a></h4>
-
-<p><i>User Feedback: <a
-href="mailto:axis-user@ws.apache.org">axis-user@ws.apache.org</a></i>. Prefix
-subject with [Axis2]. To subscribe to mailing list see <a
-href="http://ws.apache.org/axis2/mail-lists.html">here.</a></p>
-
-<p align="right">Pages: <a href="userguide.html">Content</a>, <b>1</b>, <a
-href="userguide2.html">2</a>, <a href="userguide3.html">3</a>, <a
-href="userguide4.html">4</a>, <a href="userguide5.html">5</a></p>
-
-<h2><a name="Introduction">Introduction</a></h2>
-
-<p>Welcome to Axis2, the next generation of Apache Axis!!! This User's Guide
-will help you to understand what Axis2 has to offer and how to get started
-with it. We hope you will benefit from the power of Axis2.</p>
-
-<h3><a name="Attention">Attention</a></h3>
-<ul>
- <li><p style="margin-bottom: 0in">This User's Guide is written based on
- Axis2 standard binary distribution. (The standard binary distribution can
- be created from the source distribution using the maven goal <code>$maven
- dist-std-bin</code>). Please refer the <a
- href="installationguide.html#Download_Axis2">Installation Guide</a> for
- further information on the downloadables available in this release.</p>
- </li>
- <li><p>If you are new to Axis, it's highly recommended that you read <a
- href="http://ws.apache.org/axis/java/user-guide.html"
- target="_blank">Axis 1.x User's Guide</a> before you go any further in
- this guide.</p>
- </li>
-</ul>
-
-<h3><a name="What_is_Axis2_">What is Axis2?</a></h3>
-
-<p>Axis2 is the next generation of Apache Axis. In late August 2004, during
-the Axis2 Summit held in Colombo, Sri Lanka, a new architecture for Axis was
-introduced which was much more flexible, efficient and configurable. Although
-the architecture is new, some of the well established concepts from Axis 1.x
-like handlers are preserved in Axis2. Axis2 comes with many new features,
-enhancements and industry specification implementations.</p>
-
-<p>After months of continued discussion and coding in this direction, Axis2
-now delivers the following key features:</p>
-<ul>
- <li><p style="margin-bottom: 0in"><strong>Speed</strong> - Axis2 uses its
- own object model and StAX (Streaming API for XML) parsing to achieve
- significantly greater speed than earlier versions of Apache Axis.</p>
- </li>
- <li><p style="margin-bottom: 0in"><strong>Low memory foot print</strong>-
- Axis2 was designed ground-up keeping low memory foot print in mind.</p>
- </li>
- <li><p style="margin-bottom: 0in"><strong>AXIOM</strong> - Axis2 comes with
- its own light-weight object model, AXIOM, for message processing which is
- extensible, high performance and developer convenient</p>
- </li>
- <li><p style="margin-bottom: 0in"><strong><a name="Hot_Deployment">Hot
- Deployment</a></strong> - Axis2 is equipped with the capability of
- deploying Web service & handlers while system is up and running. In
- other words, new services can be added to the system without having to
- shut down server.Drop the required Web service archive into the services
- directory in the repository and deployment model will automatically
- deploy the service and make it available for use.</p>
- </li>
- <li><p style="margin-bottom: 0in"><strong>Asynchronous Web
- services</strong> - Axis2 now supports asynchronous Web services &
- asynchronous Web services invocation using non-blocking clients and
- transports .</p>
- </li>
- <li><p style="margin-bottom: 0in"><strong>MEP Support</strong> - Axis2 now
- comes handy with the flexibility to support Message Exchange Patterns
- (MEPs) with in-built support for basic MEPs defined in WSDL 2.0.</p>
- </li>
- <li><p style="margin-bottom: 0in"><strong>Flexibility</strong> - The Axis2
- architecture gives the developer complete freedom to insert extensions
- into the engine for custom header processing, system management, or
- <em>anything else you can imagine</em>.</p>
- </li>
- <li><p style="margin-bottom: 0in"><strong>Stability</strong> - Axis2
- defines a set of published interfaces which change relatively slowly
- compared to the rest of Axis.</p>
- </li>
- <li><p style="margin-bottom: 0in"><strong>Component-oriented
- Deployment</strong> - You can easily define reusable networks of Handlers
- to implement common patterns of processing for your applications, or to
- distribute to partners.</p>
- </li>
- <li><p style="margin-bottom: 0in"><strong>Transport Framework</strong> - We
- have a clean and simple abstraction for integrating and using Transports
- (i.e., senders and listeners for SOAP over various protocols such as
- SMTP, FTP, message-oriented middleware, etc), and the core of the engine
- is completely transport-independent.</p>
- </li>
- <li><p style="margin-bottom: 0in"><strong>WSDL support</strong> - Axis2
- supports the Web service Description Language, version <a
- href="http://www.w3.org/TR/wsdl">1.1</a> and <a
- href="http://www.w3.org/TR/wsdl20/">2.0</a>, which allows you to easily
- build stubs to access remote services, and also to automatically export
- machine-readable descriptions of your deployed services from Axis2.</p>
- </li>
- <li><p style="margin-bottom: 0in"><strong>Add-ons</strong> Several Web
- services specifications have been incorporated including <a
- href="http://ws.apache.org/wss4j/" target="_blank">WSS4J</a> for security
- (Apache Rampart), <a href="http://ws.apache.org/sandesha/"
- target="_blank">Sandesha</a> for reliable messaging, <a
- href="http://ws.apache.org/kandula/" target="_blank">Kandula</a> which is
- an encapsulation of WS-Coordination, WS-AtomicTransaction and
- WS-BusinessActivity.</p>
- </li>
- <li><p style="margin-bottom: 0in"><strong>Composition and
- Extensibility</strong> - modules and phases improve support for
- composability and extensibility. Modules supports composability and is
- able to add support for new WS-* specifications in a simple and clean
- manner. They are however not <a href="#Hot_Deployment">hot deployable</a>
- as they change the overall behavior of the system.</p>
- </li>
-</ul>
-
-<p>We hope you enjoy using Axis2. Please note that this is an open-source
-effort. If you feel the code could use some new features or fixes, please get
-involved and lend us a hand! The Axis developer community welcomes your
-participation.</p>
-
-<p>Let us know what you think!</p>
-
-<p>Please send your feedback on Axis2 to "<a
-href="mailto:axis-user@ws.apache.org">axis-user@ws.apache.org</a>" and make
-sure to prefix the subject of the mail with [Axis2].</p>
-
-<h3><a name="Axis2_Complete_Features_List">Axis2 Feature List and
-Tools</a></h3>
-
-<p>To get precise information on Axis2 feature list and tools included in
-this release see <a href="../index.html" target="_blank">Home page</a>.</p>
-
-<p align="right"><a href="userguide.html"><img src="images/arrow_left.gif">
-Previous</a> | <a href="userguide2.html">Next <img
-src="images/arrow_right.gif"></a></p>
-Pages: <a href="userguide.html">Content</a>, <b>1</b>, <a
-href="userguide2.html">2</a>, <a href="userguide3.html">3</a>, <a
-href="userguide4.html">4</a>, <a href="userguide5.html">5</a></body>
-</html>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="content-type" content="">
+ <title>Axis2 User's Guide</title>
+</head>
+
+<body lang="en-US" dir="ltr">
+<h4><a name="Axis2_User's_Guide">Axis2 User's Guide</a></h4>
+
+<p><i>User Feedback: <a
+href="mailto:axis-user@ws.apache.org">axis-user@ws.apache.org</a></i>. Prefix
+subject with [Axis2]. To subscribe to mailing list see <a
+href="http://ws.apache.org/axis2/mail-lists.html">here.</a></p>
+
+<p align="right">Pages: <a href="userguide.html">Content</a>, <b>1</b>, <a
+href="userguide2.html">2</a>, <a href="userguide3.html">3</a>, <a
+href="userguide4.html">4</a>, <a href="userguide5.html">5</a></p>
+
+<h2><a name="Introduction">Introduction</a></h2>
+
+<p>Welcome to Axis2, the next generation of Apache Axis! This User's Guide
+will help you understand what Axis2 has to offer and how to get started. We
+hope you will benefit from the power of Axis2.</p>
+
+<h3><a name="Attention">Attention</a></h3>
+<ul>
+ <li><p style="margin-bottom: 0in">This User's Guide is written based on
+ Axis2 standard binary distribution. (The standard binary distribution can
+ be created from the source distribution using the maven goal <code>$maven
+ dist-std-bin</code>). Please refer the <a
+ href="installationguide.html#Download_Axis2">Installation Guide</a> for
+ further information on the downloadables available in this release.</p>
+ </li>
+ <li><p>If you are new to Axis, it is highly recommended that you read <a
+ href="http://ws.apache.org/axis/java/user-guide.html"
+ target="_blank">Axis 1.x User's Guide</a> before you go any further in
+ this guide.</p>
+ </li>
+</ul>
+
+<h3><a name="What_is_Axis2_">What is Axis2?</a></h3>
+
+<p>Apache Axis2 the core engine for Web services. In late August 2004, during
+the Axis2 Summit held in Colombo, Sri Lanka, a new architecture for Axis was
+introduced which was much more flexible, efficient and configurable. Although
+the architecture is new, some of the well established concepts from Axis 1.x
+like handlers are preserved in Axis2. Axis2 comes with many new features,
+enhancements and industry specification implementations.</p>
+
+<p>After months of continued discussion and coding in this direction, Axis2
+now delivers the following key features:</p>
+<ul>
+ <li><p style="margin-bottom: 0in"><strong>Speed</strong> - Axis2 uses its
+ own object model and StAX (Streaming API for XML) parsing to achieve
+ significantly greater speed than earlier versions of Apache Axis.</p>
+ </li>
+ <li><p style="margin-bottom: 0in"><strong>Low memory foot print</strong>-
+ Axis2 was designed ground-up keeping low memory foot print in mind.</p>
+ </li>
+ <li><p style="margin-bottom: 0in"><strong>AXIOM</strong> - Axis2 comes with
+ its own light-weight object model, AXIOM, for message processing which is
+ extensible, highly performant and is developer convenient.</p>
+ </li>
+ <li><p style="margin-bottom: 0in"><strong><a name="Hot_Deployment">Hot
+ Deployment</a></strong> - Axis2 is equipped with the capability of
+ deploying Web service & handlers while the system is up and running.
+ In other words, new services can be added to the system without having to
+ shut down the server. Simply drop the required Web service archive into
+ the services directory in the repository and the deployment model will
+ automatically deploy the service and make it available for use.</p>
+ </li>
+ <li><p style="margin-bottom: 0in"><strong>Asynchronous Web
+ services</strong> - Axis2 now supports asynchronous Web services &
+ asynchronous Web services invocation using non-blocking clients and
+ transports .</p>
+ </li>
+ <li><p style="margin-bottom: 0in"><strong>MEP Support</strong> - Axis2 now
+ comes handy with the flexibility to support Message Exchange Patterns
+ (MEPs) with in-built support for basic MEPs defined in WSDL 2.0.</p>
+ </li>
+ <li><p style="margin-bottom: 0in"><strong>Flexibility</strong> - The Axis2
+ architecture gives the developer complete freedom to insert extensions
+ into the engine for custom header processing, system management, and
+ <em>anything else you can imagine</em>.</p>
+ </li>
+ <li><p style="margin-bottom: 0in"><strong>Stability</strong> - Axis2
+ defines a set of published interfaces which change relatively slowly
+ compared to the rest of Axis.</p>
+ </li>
+ <li><p style="margin-bottom: 0in"><strong>Component-oriented
+ Deployment</strong> - You can easily define reusable networks of Handlers
+ to implement common patterns of processing for your applications, or to
+ distribute to partners.</p>
+ </li>
+ <li><p style="margin-bottom: 0in"><strong>Transport Framework</strong> - We
+ have a clean and simple abstraction for integrating and using Transports
+ (i.e., senders and listeners for SOAP over various protocols such as
+ SMTP, FTP, message-oriented middleware, etc), and the core of the engine
+ is completely transport-independent.</p>
+ </li>
+ <li><p style="margin-bottom: 0in"><strong>WSDL support</strong> - Axis2
+ supports the Web Service Description Language, version <a
+ href="http://www.w3.org/TR/wsdl">1.1</a> and <a
+ href="http://www.w3.org/TR/wsdl20/">2.0</a>, which allows you to easily
+ build stubs to access remote services, and also to automatically export
+ machine-readable descriptions of your deployed services from Axis2.</p>
+ </li>
+ <li><p style="margin-bottom: 0in"><strong>Add-ons</strong> - Several Web
+ services specifications have been incorporated including <a
+ href="http://ws.apache.org/wss4j/" target="_blank">WSS4J</a> for security
+ (Apache Rampart), <a href="http://ws.apache.org/sandesha/"
+ target="_blank">Sandesha</a> for reliable messaging, <a
+ href="http://ws.apache.org/kandula/" target="_blank">Kandula</a> which is
+ an encapsulation of WS-Coordination, WS-AtomicTransaction and
+ WS-BusinessActivity.</p>
+ </li>
+ <li><p style="margin-bottom: 0in"><strong>Composition and
+ Extensibility</strong> - Modules and phases improve support for
+ composability and extensibility. Modules supports composability and is
+ able to add support for new WS-* specifications in a simple and clean
+ manner. They are however not <a href="#Hot_Deployment">hot deployable</a>
+ as they change the overall behavior of the system.</p>
+ </li>
+</ul>
+
+<p>We hope you enjoy using Axis2. Please note that this is an open-source
+effort. If you feel the code could use some new features or fixes, please get
+involved and lend us a hand! The Axis developer community welcomes your
+participation.</p>
+
+<p>Let us know what you think! Send your feedback on Axis2 to "<a
+href="mailto:axis-user@ws.apache.org">axis-user@ws.apache.org</a>". Make sure
+to prefix the subject of the mail with [Axis2].</p>
+
+<h3><a name="Axis2_Complete_Features_List">Axis2 Feature List and
+Tools</a></h3>
+
+<p>To get detail information on Axis2 features list and tools included in
+this release see <a href="../index.html" target="_blank">Home page</a>.</p>
+
+<p align="right"><a href="userguide.html"><img src="images/arrow_left.gif">
+Previous</a> | <a href="userguide2.html">Next <img
+src="images/arrow_right.gif"></a></p>
+Pages: <a href="userguide.html">Content</a>, <b>1</b>, <a
+href="userguide2.html">2</a>, <a href="userguide3.html">3</a>, <a
+href="userguide4.html">4</a>, <a href="userguide5.html">5</a></body>
+</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org