Child pages
  • Online mode with CXF

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

Setting up OWLSBuilder in online mode with CXF gives the possibility of deploying services and having the OWL-S descriptions automatically generated on the fly where they contain OWLSBuilder annotations.

Service Deployment

Services may be deployed through any JAX-WS compatible environment (with some caveats - this is only tested using CXF - some users have reported problems with glassfish)

If you would like OWL-S descriptions to be deployed on the fly and published in an online repository then the following instructions will be of use. This requires the following:

  • That services are being published through Apache CXF using a spring configuration
  • Services are published under a path which is different from the servlet root (e.g. /cxfservices/ws/FooService rather than /cxfservice/FooService)

An example webapp is provided in source distribution, build it by running {{ ant build.webapp}} - this builds a webapp in the dist/webapp directory.

Dependencies

In addition to the standard CXF/Spring dependencies you will also need the following in your webapp

  • OWLSBuilder.jar
  • owls-api-3.0-bath.jar (and dependencies)
  • slf4j.jar
  • spring-mvc

For repository support you will also need:

  • quartz
  • alive-repository-server.jar

Images of the currently supported dependences are available from our anonymous SVN server here: https://alis.cs.bath.ac.uk/anonsvn/alive-code/alive-common-deps/trunk/

Webapp setup:

Assuming that you have a web.xml which looks something like this::

Code Block
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<context-param>
		<param-name>log4jConfigLocation</param-name>
		<param-value>/WEB-INF/log4j.properties</param-value>
	</context-param>
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>WEB-INF/beans.xml</param-value>
	</context-param>

	<context-param>
		<param-name>webAppRootKey</param-name>
		<param-value>owlsbuilder.root</param-value>
	</context-param>

	<listener>
		<listener-class>
			org.springframework.web.context.ContextLoaderListener
		</listener-class>
	</listener>

	<listener>
		<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
	</listener>

	<servlet>
		<servlet-name>CXFServlet</servlet-name>
		<display-name>CXF Servlet</display-name>
		<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>CXFServlet</servlet-name>
		<url-pattern>/ws/*</url-pattern>
	</servlet-mapping>
</web-app>

* add classpath:edu/bath/owlsbuilder/servlet/cxf/applicationContext.xml (required) to your contextConfiguration parameter

  • Create an owls servlet as follows:
    Code Block
    <servlet>
    		<servlet-name>owlsbuilder</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<init-param>
    			<param-name>contextConfigLocation</param-name>
    			<param-value>classpath:edu/bath/owlsbuilder/servlet/servletContext.xml</param-value>
    		</init-param>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
  • And a mapping as follows:
    Code Block
    	<servlet-mapping>
    		<servlet-name>owlsbuilder</servlet-name>
    		<url-pattern>/owls/*</url-pattern>
    	</servlet-mapping>
    

The resulting web.xml should look something like:

Code Block
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<context-param>
		<param-name>log4jConfigLocation</param-name>
		<param-value>/WEB-INF/log4j.properties</param-value>
	</context-param>
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>WEB-INF/beans.xml
			classpath:edu/bath/owlsbuilder/servlet/cxf/applicationContext.xml</param-value>
	</context-param>
	<context-param>
		<param-name>webAppRootKey</param-name>
		<param-value>owlsbuilder.root</param-value>
	</context-param>

	<listener>
		<listener-class>
			org.springframework.web.context.ContextLoaderListener
		</listener-class>
	</listener>

	<listener>
		<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
	</listener>

	<servlet>
		<servlet-name>CXFServlet</servlet-name>
		<display-name>CXF Servlet</display-name>
		<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet>
		<servlet-name>owlsbuilder</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<init-param>
			<param-name>contextConfigLocation</param-name>
			<param-value>classpath:edu/bath/owlsbuilder/servlet/servletContext.xml</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>owlsbuilder</servlet-name>
		<url-pattern>/owls/*</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
		<servlet-name>CXFServlet</servlet-name>
		<url-pattern>/ws/*</url-pattern>
	</servlet-mapping>
</web-app>

create a owlsbuilder.properties file and put it into your webapp classpath (e.g. WEB-INF/classes) for example:

Code Block
# The host prefix to prepend to OWLs URLs before any servlet parts
owlsbuilder.hostbase=http://localhost:8080
#The Web service Endpoint address of the repository server to use
owlsbuilder.repositoryserver=http://localhost:8080/repo/ws/ObjectRepo?wsdl

* The owlsbuilder.hostbase property is the URL which is prefixed before the context path when URLs are exposed to the outside world

  • The owlsbuilder.repositoryserver property sets the location of an Alive Repository - this can be used to discover referenced ontologies for generating OWL-S Descriptions

Deployment

Finally Deploy the webapp to a compatible java servlet container (e.g. Tomcat/Jetty etc) - you should be able to view the list of semantic services by browsing to the page /servletname/owls/list.do

If you want to register your services to be picked up by an ALIVE repository server the URL of the discovery file is : /servletname/owls/disco.do