Configuring and Enabling Transports
There are some methods to configure and enable transports in WSO2 Carbon or any Carbon based solution.
- #Using the axis2.xml file
- #Using the WSO2 Carbon Management Console
- #Configuring Servlet Transports in the Standalone Mode Using the transports.xml File
- #Configuring Transports at Service Level
Note
Globally enabled and configured transports will effect all the services deployed on the Carbon instance.
Using the axis2.xml File
WSO2 Carbon and all Carbon based products ship with a configuration file named axis2.xml.
This XML configuration file can be found at $CARBON_HOME/conf
directory. This is similar to the axis2.xml
file that ships with "Apache Axis2" and "Apache Synapse." It contains the global configuration for WSO2 Carbon and the Carbon based products. The axis2.xml
configuration generally includes configuration details for modules, phases, handlers, global configuration parameters and transports. The elements <transportReceiver
> and <transportSender
> are used to configure transport receivers and senders respectively. In the axis2.xml
file that comes with WSO2 Carbon or any Carbon based product some transports are already configured and enabled by default, including the HTTP and HTTPS transports.
The HTTP transport receiver configuration would be something similar to the following.
<transportReceiver name="http" class="org.wso2.carbon.core.transports.http.HttpTransportListener"> <parameter name="port">9763</parameter> </transportReceiver>
<transportResiever
> attributes and elements:
- name - A mandatory attribute which indicates a unique name for the transport receiver.
- class - A mandatory attribute which indicates the transport receiver implementation class.
- parameters - Configuration parameters for the transport receiver. It should be included as child elements of the <
transportReceiver
> element.
In the above example, the parameter named "port
" for the HTTP transport receiver was defined.
Similarly <transportSender
> elements can be used to configure and enable transport senders in WSO2 Carbon. Given below is the HTTP transport sender configuration that comes with WSO2 Carbon by default. It contains three parameters.
<transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> <parameter name="PROTOCOL">HTTP/1.1</parameter> <parameter name="Transfer-Encoding">chunked</parameter> <parameter name="OmitSOAP12Action">true</parameter> </transportSender>
Note
The axis2.xml
file will be loaded to the memory only during server startup. Therefore any changes made to the file while the server is up and running has no effect. In such cases the server must be restarted for the changes to take effect.
Note
Simply having <transportReceiver
> and <transportSender
> elements in the axis2.xml
file causes those transports to be loaded and activated during server startup. Therefore any dependency JARs required by those transport implementations must be included in the server classpath to prevent the server from running into exceptions at startup. In addition to that, an inaccurate transport configuration (for example, a wrong parameter value) might cause the transport to be not enabled properly.
Using the WSO2 Carbon Management Console
As an alternative to the traditional axis2.xml
file based configuration method, one might use the WSO2 Carbon Management Console to manage transport receivers and senders.
Note
Earlier versions of WSO2 Carbon did not enable the user to manage transport senders through the management console. This functionality was first introduces in WSO2 Carbon 2.0.
Carbon Management Console loads transport configurations from the embedded registry and any changes made to the configurations through the UI will also be saved back into the registry.
To manage transports from the Management Console you must first login to the server management console. Then click on "Transports" under the "Manage" menu to the left of the screen. This will take you to the "Transport Management" home page from where you can configure, enable or disable individual transport receivers and senders. See more information about Transport Management in Configuring Transports.
As of WSO2 Carbon version 2.0, the management console also allows adding new parameters to the transport configurations. Also note that Carbon Management Console does not allow the user to disable HTTP, HTTPS transports. This is because those transports are required by the management console and all the related administrative services.
When a transport is enabled from the management console, its configuration will be saved in the registry and will be loaded automatically during the next server startup.
Note
Transport configurations specified in axis2.xml
get higher priority over configurations stored in the registry. Therefore if the same transport is enabled in axis2.xml
as well as in the registry, transport configuration in axis2.xml
will be loaded and activated.
This method of configuration is mainly intended for relatively novice users. However, it is very useful even for advanced users because it enables one to try out different transport settings without having to restart the server many times.
Configuring Servlet Transports in the Standalone Mode Using the transports.xml File
In addition to the two methods discussed above, there is a third method to globally configure transport receivers in Carbon which works only when Carbon is running in the standalone mode (in other words, no external servelet container is being used to deploy Carbon). By default, WSO2 Carbon and all Carbon based products run in the standalone mode and hence it is important that users be aware of this configuration method.
When Carbon is running in the standalone mode one could use the $CARBON_HOME/conf/transports.xml
file to specify transport receiver configurations. By default, you will find the HTTP and HTTPS servlet transports configured in this file. The XML syntax to configure transports in the transports.xml
file is similar to the syntax used in the axis2.xml
file, with only difference being the <transport
> element taking the place of the <transportReceiver
> element. The default HTTP receiver configuration specified in the transports.xml
file is given below.
<transport name="http" class="org.wso2.carbon.server.transports.http.HttpTransport"> <parameter name="port">9763</parameter> <parameter name="maxHttpHeaderSize">8192</parameter> <parameter name="maxThreads">150</parameter> <parameter name="minSpareThreads">25</parameter> <parameter name="maxSpareThreads">75</parameter> <parameter name="enableLookups">false</parameter> <parameter name="disableUploadTimeout">false</parameter> <parameter name="clientAuth">false</parameter> <parameter name="maxKeepAliveRequests">100</parameter> <parameter name="acceptCount">100</parameter> <parameter name="compression">force</parameter> <parameter name="compressionMinSize">2048</parameter> <parameter name="noCompressionUserAgents">gozilla, traviata</parameter> <parameter name="compressableMimeType"> text/html,text/javascript,application/x-javascript,application/javascript,application/xml,text/css,application/xslt+xml,text/xsl,image/gif,image/jpg,image/jpeg </parameter> </transport>
However, there is a fundamental difference between transports configured in axis2.xml
and transports configured in transports.xml.
Transport receivers configured in transports.xml
will be loaded through a special "Transport Manager" implementation in Carbon. Therefore the classes specified in the <transport
> element must implement the interface org.wso2.carbon.server.transports.Transport
. Currently only the default servlet transports of Carbon can be configured from the transports.xml
file.
Configuring Transports at Service Level
WSO2 Carbon and Carbon based products enable the user to configure transports at service level. Transports configured at the service level will effect individual services and not all the services deployed on the Carbon instance. Some transport implementations such as JMS and FIX mandate configuring certain transport parameters at service level.
Service level transport configuration is performed by editing the service.xml
file associated with each service. When dealing with Proxy Services (for example in WSO2 ESB) using the Carbon's proxyadmin component, service level transport parameters should be specified in the Proxy Service configuration by using the provided Proxy Service management tools in the Carbon management console. See more information about Proxy Services in Service Mediation.