WSO2Con 2013 CFP Banner

What Are the Global Parameters Available to Control REST Handling in AxisServlet?

Date: Tue, 5th Sep, 2006
Level:
Reads: 6262
Discuss this article on Stack Overflow
Eran Chinthaka
Software Engineer
WSO2 Inc.
chinthaka's picture

Once you deploy Apache Axis2 Web application in a servlet container, all your services, by default, will get two endpoints to interact with the external world. One for SOAP interactions and the other for REST interactions. Sometimes you might want to customize this default behaviour to suit your specific requirements.

For example, you might want to completely disable REST support, or might want to enable both REST and SOAP to be handled in a single endpoint.

Let's see how this can be done using the following newly introduced parameters to Axis2 configuration file ($CONTEXT_ROOT/axis2/WEB-INF/conf/axis2.xml. CONTEXT_ROOT will be $TOMCAT_HOME/webapps in Apache Tomcat. If you are using a different servlet container, please refer its documentation to find out the context root of it).

  • enableRESTInAxis2MainServlet - REST messages handling in the SOAP endpoint is disabled by default. But setting this flag you can enable REST handling in the main servlet. This flag helps one to have a single endpoint for both SOAP and REST messages, by enabling REST handling in the main servlet.
  • disableSeparateEndpointForREST - There is a separate endpoint enabled for REST messages by default. Setting this flag to true will disable that endpoint.
  • disableREST - REST handling is on, by default. Once this flag is set to true, this flag will disable REST handling in all the endpoints.

As mentioned above, tweaking the above three parameters helps you to control the REST handling capabilities of your Axis2 engine. For example, if you want to have one and only endpoint to handle all the messages, then you can set the parameters as follows in the axis2.xml

<parameter name="enableRESTInAxis2MainServlet" locked="true">true</parameter>

<parameter name="disableSeparateEndpointForREST" locked="true">true</parameter>

Applies To:

Apache Axis2/Java nightly builds and post 1.0 versions
saurabh.surana.in.gmail.com's picture

"want to enable both REST and SOAP to be handled in a single end

Hi Eran, I want to do the same setting that you have mentioned in the article "want to enable both REST and SOAP to be handled in a single endpoint". But when I went to $TOMCAT_HOME/webapps/axis2/WEB-INF/conf/axis2.xml file, I found that I had only disableREST flag out there. Both enableRESTInAxis2MainServlet and disableSeparateEndpointForRESTwere not found in the file. I manually added them in the axis2.xml file but still not able to get the things working. Here are the final settings from my file : (I am using Tomcat 5.5.29, and Axis 2.0) disableREST = false enableRESTInAxis2MainServlet = true disableSeparateEndpointForREST true With this settings I get two end points axis2:CalculatorSoap11Binding, axis2:CalculatorHttpBinding. I want only the first one to come there. Can you suggest what I might be doing wrong.