Version 8.0 SP4
 —  Configuration  —

Transports

Web Services Stack supports sending and receiving of messages over the following transports:

HTTP is the single transport activated in the default Web Services Stack installation. The following instructions show how to configure and activate the other transports supported by Web Services Stack.

The information is organzied under the following headings:


TCP Transport

There are no prerequisites for the activation of TCP transport.

Activating TCP Transport (Server-side Configuration)

Start of instruction setTo activate TCP transport in Web Services Stack

  1. Go to the web application server where the Web Services Stack runtime is installed.

  2. Open the axis2.xml configuration file under the /webapps/wsstack/WEB-INF/conf directory.

  3. Uncomment the sections that define the transport receiver and transport sender with name="tcp":

    <transportReceiver name="tcp" ... />
    <transportSender name="tcp" ... />

    The only parameter required for the transport receiver is its port number. The suggested default value is 6060.

Note:
Restart the Web Services Stack runtime for the modifications to take effect.

Enabling WS-Addressing

Since the TCP transport has no application level headers (and no target endpoint URI), you need WS-Addressing to dispatch the service.

Note:
WS-Addressing is not enabled in the default Web Services Stack installation.

Start of instruction setTo enable WS-Addressing

Forcing Deployment Over TCP Transport Only

If not explicitly configured, a web service is deployed over all activated transports in the Web Services Stack runtime. In this case, the web service is accessible at all enabled endpoints.

You may, however, want to restrict a web service to be accessible only over TCP transport.

Start of instruction setTo deploy over TCP transport only

Note:
Since TCP transport has no application level headers, and thus no target endpoint URI, you need WS-Addressing to dispatch the service. If WS-Addressing is not globally enabled, you have to enable it for the service.

Invoking a Web Service Over TCP Transport (Client-side Configuration)

To make a call to a web service over TCP transport, configure the client’s repository.

Start of instruction setTo invoke a web service over TCP

  1. Uncomment the sections that define the transport receiver and transport sender with name=“tcp” in the client’s axis2.xml configuration file:

    <transportReceiver name="tcp" ... />
    <transportSender name="tcp" ... />
  2. Engage globally the WS-Addressing module (addressing.mar) in the client’s axis2.xml file:

    <module ref="addressing"/>
  3. Ensure the WS-Addressing module (addressing.mar) is present in the /modules directory in the client’s repository.

Top of page

JMS Transport

Prerequisites

Following are guidelines to the prerequisites for the activation of JMS transport.

Start of instruction setTo install and start a message broker

In order to achieve JMS communication, you need a message broker that handles the distribution of messages between communicating parties. Web Services Stack does not include a built-in message broker. This requires the use of an external one. Apache ActiveMQ is an open source message broker that you can download from http://activemq.apache.org/activemq-411-release.html.

After the installation, ActiveMQ is running with a basic configuration that is sufficient for its integration with the Web Services Stack.

Note:
If you want to terminate the broker, type the CTRL-C command in the comand prompt in which it is running.

Start of instruction setRun the ActiveMQ message broker

  1. Open the command prompt

  2. Nnavigate to the ACTIVEMQ_HOME/bin directory

  3. Run the activemq.bat file.

You can find more about installing and using Apache ActiveMQ open source message broker at http://activemq.apache.org/getting-started.html.

Start of instruction setTo provide additional libraries for the Web Services Stack runtime

Configuring Web Services Stack to work with Apache ActiveMQ message broker requires the provision of additional libraries for the Web Services Stack runtime.

  1. Go to the ACTIVEMQ_HOME/lib directory.

  2. Copy the following libraries to the <web_app_server>/webapps/wsstack/WEB-INF/lib directory of the Web Services Stack runtime in the web application server:

Activating JMS Transport (Server-Side Configuration)

Start of instruction setTo activate JMS transport in Web Services Stack

  1. Go to the web application server, where the Web Services Stack runtime is installed

  2. Open the axis2.xml configuration file under the /webapps/wsstack/WEB-INF/conf directory.

  3. Uncomment the sections that define the transport receiver and transport sender with name="jms":

    <transportReceiver name="jms" ... />
    	<transportSender name="jms" ... />
    
  4. Define the custom connection factories

    You can define custom connection factories as parameters under JMS transport receiver. They can be used by the services deployed over JMS transport. Refer to the axis2.xml configuration file to see the sample connection factories that the JMS transport receiver configuration includes.

    Note:
    One of the connection factories is named as default for use by services that do not explicitly specify in their services.xml configuration file the connection factory they want to use.

    Those connection factories are associated with Apache ActiveMQ implementation whose libraries are required for the Web Services Stack runtime. Each connection factory specifies the following parameters:

    Web Services Stack can run with the default configuration of Apache ActiveMQ. In this case, you only have to uncomment the JMS transport receiver and JMS transport sender configuration in the axis2.xml file.

    Note:
    You must always run the message broker before you start Web Services Stack.

Forcing Deployment Over JMS Transport Only

If not explicitly configured, a web service is deployed over all activated transports in the Web Services Stack runtime. However, you can restrict a web service to be deployed over JMS transport only.

Start of instruction setTo deploy over JMS transport only

Note:
You can also specify the destination where the service listens for messages, as well as the name of the connection factory to be used. The service can use one of the connection factories defined within the JMS transport receiver in the axis2.xml configuration file.

Start of instruction setTo specify the name of the connection factory

Start of instruction setTo use the Web Services Stack Eclipse plug-in to add the first of the preceding parameters to the table in the section Properties in the Services tab

  1. Choose the Add button.

  2. Type "transport.jms.ConnectionFactory" for name.

  3. "myQueueConnectionFactory" (or another connection factory defined in axis2.xml) for value.

  4. Select OK.

Start of instruction setTo use the Web Services Stack Eclipse plug-in to add the second of the preceding parameters to the table in the section Properties in the Services tab

  1. Choose the Add button.

  2. Type "transport.jms.Destination" for name.

  3. "dynamicQueues/TestQueue" (or other value of your choice) for value.

  4. Select OK.

Note:
These parameters are optional. If they are not specified, the service uses the default connection factory (named as default in the configuration of the JMS transport receiver in the axis2.xml file) and listens for messages on a JMS queue by the same name as the name of the service.

For more information about working with the Web Services Stack Eclipse plug-in, see Eclipse Plug-in.

Invoking a Web Service Over JMS Transport (Client-side Configuration)

To make a call to a web service over JMS transport, you have to configure the client’s repository.

Start of instruction setTo invoke a web service over JMS

  1. Uncomment the sections that define the transport receiver and transport sender with name=“jms” in the client’s axis2.xml configuration file:

    <transportReceiver name="jms" ... />
    <transportSender name="jms" ... />
  2. Engage globally the WS-Addressing module (addressing.mar) in the client’s axis2.xml file.

    <module ref="addressing"/>
  3. Ensure the WS-Addressing module (addressing.mar) is present in the /modules directory in the client’s repositor.

Top of page

Mail Transport

The information is organized under the following headings:

Prerequisites

To activate mail transport in Web Services Stack, you need the following prerequisites:

Install, Configure and Start a Mail Server

The activation of mail transport in Web Services Stack requires a mail server that transfers e-mail messages. The Apache Java Enterprise Mail Server (James) is an open source SMTP and POP3 mail server that is used by Web Services Stack.

Start of instruction setTo install Apache James server

  1. Download the archive with the binary distribution of the Apache James mail server from http://james.apache.org/download.cgi.

  2. Extract the files from the downloaded archive to a JAMES_HOME directory of your choice.

  3. Start and stop the mail server once so that it unpacks its configuration files.

Start of instruction setTo open the configuration files for editing

  1. Open the command prompt.

  2. Navigate to JAMES_HOME/bin directory.

  3. Run run.bat to start the server.

  4. Use the CTRL+C command to stop the mail server.

  5. Type the ipconfig/all command to check your network configuration.

    Note:
    You need this information for the next instruction (configuring the DNS servers).

Start of instruction setTo configure the DNS servers in the mail server

  1. Open the config.xml file under the JAMES_HOME/apps/james/SAR-INF directory

  2. Find the tag <dnsserver> and enter the IP address of each DNS server from your network configuration as shown in the following example:

    <dnsserver>
    		<servers>
    			<server>[DNS.Server.IP.address]</server>
    				<server>...</server>
    		</servers>
    		...
    </dnsserver>
    

    Note:
    Apache James mail server requires the valid IP addresses of the DNS servers in your network configuration.

  3. Start the mail server again.

You can read more about the configuration of Apache James mail server in the "Configuring James" section of the James server documentation at http://james.apache.org/server/2.3.1/index.html.

Create Accounts in the Mail Server

After you have installed and configured your mail server, you have to create accounts. You need to create a mail account that represents the e-mail address of the Web Services Stack runtime. Additional accounts can be created to correspond to different clients.

Start of instruction setTo create an account

  1. Start the Apache James mail server if it is not started.

    To start Apache James Server, run the console command prompt, navigate to JAMES_HOME/bin directory and run run.bat.

  2. Start James Remote Manager Service (this tool is used for administration purposes).

    Run the console command prompt and type the following telnet command:

    telnet localhost 4555

    Port number 4555 is the default port, where the Remote Manager Service starts. It is configured in the James configuration file (JAMES_HOME/apps/james/SAR-INF/config.xml). If you have changed the default port number in a previous step, use the new value in the preceding command

  3. Log on the Remote Manager. You are prompted for the logon ID and password. They are configured in the James configuration file (JAMES_HOME/apps/james/SAR-INF/config.xml). The initial values are "root" for both, the ID and the password, unless you have changed them.

    Type "root" for the logon ID and for the password.

  4. Create the account. The command for adding a new user is adduser username password. After executing the command, you get a confirmation.

    Type the following command:

    adduser server wsstack
  5. Exit the Remote Manager Service using the quit command.

    After you have executed the commands in the command prompt, you get a result similar to the following one:

    >telnet localhost 4555
    
    	JAMES Remote Administration Tool 2.3.1
    	Please enter your login and password
    	Login id:
    	root
    	Password:
    	root
    	Welcome root. HELP for a list of command
    	adduser server wsstack
    	User server added
    	quit
    	Bye
    

Activating Mail Transport

There are prerequisites for the activation of mail transport. Refer to the folowing instruction and the description of the required parameters for the transport receiver and the transport sender.

Start of instruction setTo activate mail transport in Web Services Stack

  1. Go to the /webapps/wsstack/WEB-INF/conf directory.

  2. Open the axis2.xml configuration file.

  3. Configure the context root of Web Services Stack runtime.

    In the axis2.xml file, find the parameter with the name contextRoot. Uncomment it (if it is commented) and ensure that its value is "wsstack":

    <parameter name="contextRoot" locked="false">wsstack</parameter>
  4. Activate the mail transport receiver and the mail transport sender.

    In the axis2.xml file find and uncomment the sections that define the transport receiver and the transport sender with name=“mailto”:

    <transportReceiver name="mailto" … />
    <transportSender name="mailto" … />
    

    The parameters under the transport receiver and the transport sender have fake default values. They need to be verified.

    Required Parameters for the Transport Receiver

    The following table lists the required paramters and their description:

    Parameter Description
    mail.pop3.host

    The host name (or IP address) where the James mail server is running.

    If the server is running on the same machine as the Web Services Stack runtime, then the value can be "localhost" or "127.0.0.1".

    mail.pop3.user

    The user name of a user registered in the James mail server.

    The user name in the following sample code is the user registration from the example in the preceding topic "Creating accounts in the mail server".

    transport.mail.pop3.password

    The user’s corresponding password for his account.

    mail.store.protocol

    The value "pop3" is expected for that parameter.

    transport.mail.replyToAddress

    This parameter is responsible for the followng values:

    • Supplies the endpoint reference for the response and represents the server email address.

    • Contains the user name specified in the mail.pop3.user parameter and the server name of James mail server, separated by the @ sign.

      Note:
      The server name is configured in the JAMES_HOME/apps/james/SAR-INF/config.xml configuration file. If you have not specified a different one, the initial value is "localhost".

    transport.listener.interval

    Controls the time interval (in milliseconds) for checking the mail server for new messages.

    Note:
    This parameter is optional. If omitted, its default value is = "3000 " milliseconds (which equals to 3 seconds).

    Following is a sample code listing of the usage of the required parameters for the transport receiver:

    <transportReceiver name="mailto" class="org.apache.axis2.transport.mail.SimpleMailListener">
    	<parameter name="mail.pop3.host">localhost</parameter>
    	<parameter name="mail.pop3.user">server</parameter>
    	<parameter name="transport.mail.pop3.password">wsstack</parameter>
    	<parameter name="mail.store.protocol">pop3</parameter>
    	<parameter name="transport.mail.replyToAddress">server@localhost</parameter>
    	<parameter name="transport.listener.interval">3000</parameter>
    </transportReceiver>
    

    Required Parameters for the Transport Sender

    The following table lists the required paramters and their description:

    Parameter Description
    mail.smtp.host

    The host name (or IP address), where James mail server is running.

    It corresponds to the mail.pop3.host parameter under the Mail transport receiver.

    mail.smtp.user

    Corresponds to the value of mail.pop3.user parameter of the transport receiver.

    transport.mail.smtp.password

    Corresponds to the value of transport.mail.pop3.password parameter of the transport receiver.

    mail.smtp.from

    Corresponds to the value of mail.transport.replyToAddress parameter of the transport receiver.

    Following is a sample code listing of the usage of the required parameters for the transport sender:

    <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
    	<parameter name="mail.smtp.host" locked="false">localhost</parameter>
    	<parameter name="mail.smtp.user">server</parameter>
    	<parameter name="transport.mail.smtp.password">wsstack</parameter>
    	<parameter name="mail.smtp.from">server@localhost</parameter>
    </transportSender>
    

Forcing Deployment Over Mail Transport Only

If you want to restrict a web service to be deployed only over Mail transport, you must add the following element in the web service’s services.xml file:

<service ...>
	<transports>
		<transport>mailto</transport>
	</transports>
	...
</service>

Note:
If not configured explicitly, a web service is deployed over all activated transports in the Web Services Stack runtime.

Invoking a Web Service Over Mail Transport

To call a web service over mail transport, configure the client’s repository.

Start of instruction setTo configure the client's repository

  1. In the client’s axis2.xml configuration file, find and uncomment the sections that define the transport receiver and transport sender with name=“mailto”:

    <transportReceiver name="mailto" ... />
    <transportSender name="mailto" ... />
    
  2. Check the parameters under the mail transport receiver and the mail transport sender. You must configure the user name, the password, and the e-mail address of a user registered in the James mail server. That user must be different from the one configured in the Web Services Stack runtime.

    For details, see Activating Mail Transport.

Sample Client Configuration

Following is a sample code listing of client configuration with a user that is registered in the James mail server. The user name is "client" and the password is "pass":

<transportReceiver name="mailto" class="org.apache.axis2.transport.mail.SimpleMailListener">
	<parameter name="mail.pop3.host">localhost</parameter>
	<parameter name="mail.pop3.user">client</parameter>
	<parameter name="mail.store.protocol">pop3</parameter>
	<parameter name="transport.mail.pop3.password">pass</parameter>
	<parameter name="transport.mail.replyToAddress">client@localhost</parameter>
	<parameter name="transport.listener.interval">3000</parameter>
</transportReceiver>

<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
	<parameter name="mail.smtp.host">localhost</parameter>
	<parameter name="mail.smtp.user">client</parameter>
	<parameter name="transport.mail.smtp.password">pass</parameter>
	<parameter name="mail.smtp.from">client@localhost</parameter>
</transportSender>

Top of page