Lowlevelbitstorage

build.xml

<project name="lowlevelbitstorage" basedir=".">

    <property name="global.dir" value="${basedir}/../.."/>
    <property name="warfilename" value="lowlevelbitstorage.war"/>
    <!--Contain the normal build tasks, including war-->
    <import file="${global.dir}/build-includes.xml"/>



    <property name="properties.package"
              value="dk.statsbiblioteket.doms.bitstorage.lowlevel"/>
    <property name="config.xsd" value="web/WEB-INF/bitstorageSsh.xsd"/>
    <!--Contain the targets to build the config classes from the config.xsd
        add it as a module lib
    -->
    <import file="${global.dir}/build-jaxb-properties.xml"/>



    <property name="wsdl.package"
              value="dk.statsbiblioteket.doms.bitstorage.lowlevel"/>
    <property name="wsdl.location"
                  value="${basedir}/web/WEB-INF/wsdl/lowlevel.wsdl"/>
    <!--Contain the targets to build the webservice interface from the
        wsdl.location and add it as a module lib
    -->
    <import file="${global.dir}/build-soap-webservices.xml"/>

    <!--Project libs used by this module-->
    <fileset id="project.libs" dir="${global.dir}/lib">
        <include name="sbutils-0.4.6/jars/**/*.jar"/>
        <include name="jaxws-ri-2.1.7/jars/**/*.jar"/>
    </fileset>

</project>

build-includes.xml

Contain the basic tasks, including war that are nessesary for normal operation of the module.

build-jaxb-properties.xml

Properties are handled by jaxb serialisation. A schema must be provides for a config file. Through the build-jaxb-properties.xml this schema is translated to a java class, and packaged as a jar in the module library. Implementations needing to use the config system can then unmarshall instances of this class from the properties file.

The schema is the defining feature, from which the java is made, so to change the layout of the config file, the schema must be changed. And, the config files can be schema validated.

build-soap-webservices.xml

Soap webservices are made with Jaxws-ri-2.x. At the time of writing we are using version 2.1.7

The basic idea of this framework is WSDL first, java second. To use the framework, you must write a WSDL file yourself, and the framework will then translate that to java code. The java code will be put in a jar file, in the module libs, so that you do not run the rist of editing it. All interface edits should take place in the WSDL, and then be probagated to the java interface. The java interface should then be implemented by your implementation.

In order to use this framework, the following prerequisites must be fulfilled:

web.xml

web/WEB-INF must contain web.xml, with the following content

<?xml version="1.0" encoding="UTF-8"?>
<web-app 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/javaee/web-app_2_5.xsd"
           version="2.5">

    <listener>
        <listener-class>
            com.sun.xml.ws.transport.http.servlet.WSServletContextListener
        </listener-class>
    </listener>
    <servlet>
        <description>JAX-WS endpoint</description>
        <display-name>WSServlet</display-name>
        <servlet-name>WSServlet</servlet-name>
        <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>WSServlet</servlet-name>
        <url-pattern>/lowlevel/*</url-pattern>
    </servlet-mapping>
</web-app>

where lowlevel of course should be changed to the correct path.

sun-jaxws.xml

web/WEB-INF must contain sun-jaxws.xml with the following content

<?xml version="1.0" encoding="UTF-8"?>

<endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime' version='2.0'>

    <endpoint
            name='Bitstorage'
            interface='dk.statsbiblioteket.doms.bitstorage.lowlevel.BitstorageSoapWebservice'
            implementation='dk.statsbiblioteket.doms.bitstorage.lowlevel.frontend.BitstorageSoapWebserviceImpl'
            wsdl='WEB-INF/wsdl/lowlevel.wsdl'
            service="{http://lowlevel.bitstorage.doms.statsbiblioteket.dk/}BitstorageSoapWebserviceService"
            port="{http://lowlevel.bitstorage.doms.statsbiblioteket.dk/}BitstorageSoapWebservicePort"
            url-pattern='/lowlevel/'
            />
</endpoints>

url-pattern should match the one set in web.xml. The important fields are interface and implementation. The interface field should be set to the interface autogenerated from the WSDL, and the implementation is the one you have made

WSDL

LowLevelBitStorageDesignDoc (last edited 2010-03-17 13:12:54 by localhost)