HTTP Servlet Configuration Details
This section describes the HTTP servlet configuration when using JiBX/WS specific configuration files. For Spring configured services, see Using JiBX/WS with Spring.
The JiBX/WS server must be configured in the WEB-INF/web.xml file for a web application (which will normally be deployed in the form of a war file).
Here's an example of the JiBX/WS configuration within a WEB-INF/web.xml file:
<web-app> <servlet> <servlet-name>soap_servlet</servlet-name> <servlet-class>org.jibx.ws.http.servlet.WsServlet</servlet-class> <init-param> <param-name>quake-service</param-name> <param-value>quake-service.xml</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>soap_servlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app>
The <servlet> element in the sample configures JiBX/WS to use the service definition file at WEB-INF/quake-service.xml to define a service named "quake-service". The <servlet-mapping> element defines the path used to access the JiBX/WS server. Here the path is just set to /, meaning that the JiBX/WS server will by default handle all requests received for the containing web application. All together, this configures a single service that will be accessed at the path /quake-service within the web application.
For the example only a single service is configured; if you want to define multiple services using a single instance of the JiBX/WS server you can do so by just using a separate <init-param> element for each service. The <param-name> child element gives the name of the service (which must be unique), while the <param-value> value is the corresponding service definition file name.
You can also define multiple instances of the JiBX/WS server within your web application, and can combine the JiBX/WS server with other servlet definitions.
An HTTP request is matched to a service definition based on the request's URI. If the URI contains extra path information between the servlet path and query string, the service path is set to this extra path information. If no extra path information is present, the service path is set to the servlet path. JiBX/WS will match the service path to the service defined with a corresponding <param-name> in an <init-param> element. If no match can be found, the servlet will return a 404 Not Found status code.