How to Configure Axis2 to use HTTPS or HTTP or both HTTP and HTTPS.

When we deploy a webservice application in servlet container like Tomcat or WebSphere or WebLogic or may be a Jboss server. The default protocol is working for HTTP. Now when it comes to HTTPS,(after configuring the server container to accept HTTPS request) ,web service will stop responding to HTTPS request but the rest part or web application would be working. The reason behind it is HTTPS request will be reaching to servlet container but will not be able to invoke or connect to webservice. Axisservlet configured in web.xml will not be able to find out the right port. Ahhhh which port???


Well! HTTPS port is different from HTTP port. What are the configurations?


There are two configuration that you need to do. They are below.
1. org.apache.axis2.transport.http.AxisServlet must be registered and mapped as a servlet in web.xml

 <servlet>
        <servlet-name>AxisServlet</servlet-name>
        <display-name>Apache-Axis Servlet</display-name>
        <servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>AxisServlet</servlet-name>
        <url-pattern>/services/*</url-pattern>
    </servlet-mapping>
               

2. Configuring axis2.xml to enable HTTPS or HTTP or both.
We need to declare one or more org.apache.axis2.transport.http.AxisServletListener instances as transport receivers in axis2.xml. If only a single protocol is used, no further configuration is required. For example, if only HTTP is used, the following declaration must be present in axis2.xml:

<transportReceiver name="https" class="org.apache.axis2.transport.http.AxisServletListener"/>
                OR
<transportReceiver name="http" class="org.apache.axis2.transport.http.AxisServletListener"/>

If both HTTP and HTTPS are used, then things become a bit more complicated. We need to put the port informations as well so that both HTTP and HTTPS ports are recognised by AxisServlet.


<transportReceiver name="http" class="org.apache.axis2.transport.http.AxisServletListener">
    <parameter name="port">8080</parameter>
</transportReceiver>

<transportReceiver name="https" class="org.apache.axis2.transport.http.AxisServletListener">
    <parameter name="port">8443</parameter>
</transportReceiver>
Share on Google Plus

About chetan

Howsstuff

2 comments:

  1. perform exceptionally well once they get there it's generally a wasted effort. I am considering search engines and your competition when I set the bar at "exceptionally well". If you do what your competitor does, then you must do it better. supergold govt nz

    ReplyDelete
  2. Psychologically, young buyers like us fail to truly do the math on property taxes, homeowners Insurance, flood Insurance, earthquake Insurance, plumbing, yardwork, general maintenance, drainage, so on and so forth.  Young couples buy what we can afford, not what we will need: our home is too small now that we have added a second child. What Is Aetna Critical Illness Insurance

    ReplyDelete