Lowlevelbitstorage

Soap webservices

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 my 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.

  1. 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

  1. web/WEB-INF/wsdl must contain the wsdl file. This one will not be pasted here.
  2. build.xml must contain the following

<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>