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:

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

<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.7-b01-. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.7-b01-. -->
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:tns="http://lowlevel.bitstorage.doms.statsbiblioteket.dk/"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns="http://schemas.xmlsoap.org/wsdl/"
             targetNamespace="http://lowlevel.bitstorage.doms.statsbiblioteket.dk/"
             name="BitstorageSoapWebserviceService">
    <types>
        <xsd:schema>
            <xsd:import
                    namespace="http://lowlevel.bitstorage.doms.statsbiblioteket.dk/"
                    schemaLocation="lowlevel.xsd"/>
        </xsd:schema>
    </types>
    <message name="uploadFile">
        <part name="parameters" element="tns:uploadFile"/>
    </message>
    <message name="uploadFileResponse">
        <part name="parameters" element="tns:uploadFileResponse"/>
    </message>
    <message name="ChecksumFailedException">
        <part name="fault" element="tns:ChecksumFailedException"/>
    </message>
    <message name="FileAlreadyApprovedException">
        <part name="fault" element="tns:FileAlreadyApprovedException"/>
    </message>
    <message name="InvalidFilenameException">
        <part name="fault" element="tns:InvalidFilenameException"/>
    </message>
    <message name="CommunicationException">
        <part name="fault" element="tns:CommunicationException"/>
    </message>
    <message name="NotEnoughFreeSpaceException">
        <part name="fault" element="tns:NotEnoughFreeSpaceException"/>
    </message>
    <message name="disapprove">
        <part name="parameters" element="tns:disapprove"/>
    </message>
    <message name="disapproveResponse">
        <part name="parameters" element="tns:disapproveResponse"/>
    </message>
    <message name="FileNotFoundException">
        <part name="fault" element="tns:FileNotFoundException"/>
    </message>
    <message name="approve">
        <part name="parameters" element="tns:approve"/>
    </message>
    <message name="approveResponse">
        <part name="parameters" element="tns:approveResponse"/>
    </message>

    <message name="spaceleft">
        <part name="parameters" element="tns:spaceleft"/>
    </message>
    <message name="spaceleftResponse">
        <part name="parameters" element="tns:spaceleftResponse"/>
    </message>
    <message name="getMaxFileSize">
        <part name="parameters" element="tns:getMaxFileSize"/>
    </message>
    <message name="getMaxFileSizeResponse">
        <part name="parameters" element="tns:getMaxFileSizeResponse"/>
    </message>

    <message name="getMd5">
        <part name="parameters" element="tns:getMd5"/>
    </message>
    <message name="getMd5Response">
        <part name="parameters" element="tns:getMd5Response"/>
    </message>
    <message name="isApproved">
        <part name="parameters" element="tns:isApproved"/>
    </message>
    <message name="isApprovedResponse">
        <part name="parameters" element="tns:isApprovedResponse"/>
    </message>
    <portType name="BitstorageSoapWebservice">
        <operation name="uploadFile">
            <input message="tns:uploadFile"/>
            <output message="tns:uploadFileResponse"/>
            <fault message="tns:InvalidFilenameException"
                   name="InvalidFilenameException"/>
            <fault message="tns:FileAlreadyApprovedException"
                   name="FileAlreadyApprovedException"/>
            <fault message="tns:ChecksumFailedException"
                   name="ChecksumFailedException"/>
            <fault message="tns:CommunicationException"
                   name="CommunicationException"/>
            <fault message="tns:NotEnoughFreeSpaceException"
                   name="NotEnoughFreeSpaceException"/>
        </operation>
        <operation name="disapprove">
            <input message="tns:disapprove"/>
            <output message="tns:disapproveResponse"/>
            <fault message="tns:CommunicationException"
                   name="CommunicationException"/>
            <fault message="tns:FileNotFoundException"
                   name="FileNotFoundException"/>
        </operation>
        <operation name="approve">
            <input message="tns:approve"/>
            <output message="tns:approveResponse"/>
            <fault message="tns:CommunicationException"
                   name="CommunicationException"/>
            <fault message="tns:FileNotFoundException"
                   name="FileNotFoundException"/>
            <fault message="tns:NotEnoughFreeSpaceException"
                   name="NotEnoughFreeSpaceException"/>
            <fault message="tns:ChecksumFailedException"
                   name="ChecksumFailedException"/>
        </operation>

        <operation name="spaceleft">
            <input message="tns:spaceleft"/>
            <output message="tns:spaceleftResponse"/>
            <fault message="tns:CommunicationException"
                   name="CommunicationException"/>
        </operation>
        <operation name="getMaxFileSize">
            <input message="tns:getMaxFileSize"/>
            <output message="tns:getMaxFileSizeResponse"/>
            <fault message="tns:CommunicationException"
                   name="CommunicationException"/>
        </operation>
        <operation name="getMd5">
            <input message="tns:getMd5"/>
            <output message="tns:getMd5Response"/>
            <fault message="tns:FileNotFoundException"
                   name="FileNotFoundException"/>
            <fault message="tns:CommunicationException"
                   name="CommunicationException"/>
        </operation>
        <operation name="isApproved">

            <input message="tns:isApproved"/>
            <output message="tns:isApprovedResponse"/>
            <fault message="tns:FileNotFoundException"
                   name="FileNotFoundException"/>
            <fault message="tns:CommunicationException"
                   name="CommunicationException"/>
        </operation>
    </portType>
    <binding name="BitstorageSoapWebservicePortBinding"
             type="tns:BitstorageSoapWebservice">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
                      style="document"/>
        <operation name="uploadFile">
            <soap:operation soapAction=""/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
            <fault name="FileAlreadyApprovedException">
                <soap:fault name="FileAlreadyApprovedException" use="literal"/>
            </fault>
            <fault name="ChecksumFailedException">
                <soap:fault name="ChecksumFailedException" use="literal"/>
            </fault>
            <fault name="InvalidFilenameException">
                <soap:fault name="InvalidFilenameException" use="literal"/>
            </fault>
            <fault name="CommunicationException">
                <soap:fault name="CommunicationException" use="literal"/>
            </fault>
            <fault name="NotEnoughFreeSpaceException">
                <soap:fault name="NotEnoughFreeSpaceException" use="literal"/>
            </fault>
        </operation>
        <operation name="disapprove">
            <soap:operation soapAction=""/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>

            <fault name="CommunicationException">
                <soap:fault name="CommunicationException" use="literal"/>
            </fault>
            <fault name="FileNotFoundException">
                <soap:fault name="FileNotFoundException" use="literal"/>
            </fault>
        </operation>
        <operation name="approve">
            <soap:operation soapAction=""/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
            <fault name="CommunicationException">
                <soap:fault name="CommunicationException" use="literal"/>

            </fault>
            <fault name="FileNotFoundException">
                <soap:fault name="FileNotFoundException" use="literal"/>
            </fault>
            <fault name="NotEnoughFreeSpaceException">
                <soap:fault name="NotEnoughFreeSpaceException" use="literal"/>
            </fault>
            <fault name="ChecksumFailedException">
                <soap:fault name="ChecksumFailedException" use="literal"/>
            </fault>
        </operation>
        <operation name="spaceleft">
            <soap:operation soapAction=""/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>

                <soap:body use="literal"/>
            </output>
            <fault name="CommunicationException">
                <soap:fault name="CommunicationException" use="literal"/>
            </fault>
        </operation>
        <operation name="getMaxFileSize">
            <soap:operation soapAction=""/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
            <fault name="CommunicationException">
                <soap:fault name="CommunicationException" use="literal"/>
            </fault>

        </operation>
        <operation name="getMd5">
            <soap:operation soapAction=""/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
            <fault name="FileNotFoundException">
                <soap:fault name="FileNotFoundException" use="literal"/>
            </fault>
            <fault name="CommunicationException">
                <soap:fault name="CommunicationException" use="literal"/>
            </fault>
        </operation>
        <operation name="isApproved">

            <soap:operation soapAction=""/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
            <fault name="FileNotFoundException">
                <soap:fault name="FileNotFoundException" use="literal"/>
            </fault>
            <fault name="CommunicationException">
                <soap:fault name="CommunicationException" use="literal"/>
            </fault>
        </operation>
    </binding>
    <service name="BitstorageSoapWebserviceService">
        <port name="BitstorageSoapWebservicePort"
              binding="tns:BitstorageSoapWebservicePortBinding">

            <soap:address
                    location="http://localhost:7910/lowlevelbitstorage/lowlevel/"/>
        </port>
    </service>
</definitions>