BioNemus Web Services generation tool


SOAP based web services

Generated Web Services may be deployed on a range of Java Application Servers that comply with Enterprise Java 5 specification.

It is also possible to use Web Container like Apache Tomcat with installed JAX-WS Reference Implementation - METRO.

To innstall the generated proxy application you would need:

Note that not all combinations of Java, Tomcat and Metro are compatible. Also a configuration of Tomcat may differ. While sopported, we encourage not to use Java 5 as obsolete.

You can follow METRO instructions to integrate it with a Tomcat, but here is a simple way to do it manually. Just copy several java archives from METRO installation package into appropriate Tomcat directories. Tomcat 6/7 + JDK 6 + Metro 2.0:

$tomcat_home$/lib/webservices-rt.jar
$tomcat_home$/lib/endorsed/webservices-api.jar
$tomcat_home$/lib/endorsed/jsr173_api.jar

Where $tomcat_home$ is a directory where Tomcat is installed.

The last thing will be to copy your generated proxy.war application into

$tomcat_home$/webapps/proxy.war

RESTful web services

Generated Web Services may be deployed on any Java Application Servers that supports JAX-RS 1.0 specification.

Apache Tomcat can be also used for this purpose. Here we will use a reference JAX-RS implementation - Jersey.

A list of libraries to put into the $tomcat_home$/lib/ directory:

These libraries could be obtained directly from projects' repositories: Jersey  ,  Jackson or here...
New versions are continuously released, so probably there are newer versions available...

Note: Generated application configured according JAX-RS to comply with Servlet 3.0 specification. Tomcat 6 does not support Servlet 3.0. This means that to successfully deploy a proxy.war on Tomcat 6, its web.xml configuration file must be configured specifically for the JAX-RS implementation in use (in this case Jersey).

Here is an example of web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app 
  version="2.5" 
  xmlns="http://java.sun.com/xml/ns/javaee" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">

  <servlet>
    <servlet-name>Jersey</servlet-name>
    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Jersey</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>
</web-app>
      

Configuring Apache 2

RESTful web services can be used directly from JavaScript through an AJAX request*.

Most browsers follow Cross-Origin Resource Sharing (CORS) specification to apply same-origin restrictions to network requests. To allow generated RESTful proxy services beeing executed from web-pages, CORS headers must be properly configured. If a Tomcat server lays behind an Apache web server, an easy way is to configure the last one.

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{REQUEST_METHOD} OPTIONS
  Rewrite ^(.*)$ $1 [R=200,L]
</IfModule>

<IfModule mod_headers.c>
  Header always set Access-Control-Allow-Origin "*"
  Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS"
  Header always set Access-Control-Allow-Headers "Content-Type"
</IfModule>