Differences between revisions 1 and 2
Revision 1 as of 2009-10-06 15:05:15
Size: 14331
Editor: abr
Comment:
Revision 2 as of 2009-10-06 15:23:43
Size: 4246
Editor: abr
Comment:
Deletions are marked like this. Additions are marked like this.
Line 58: Line 58:
 3. web/WEB-INF/wsdl must contain the wsdl file.  3. web/WEB-INF/wsdl must contain the wsdl file. This one will not be pasted here.


 4. build.xml must contain the following
Line 60: Line 63:
<?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>
<project name="lowlevelbitstorage" basedir=".">
Line 111: Line 65:
    <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>
    <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"/>
Line 124: Line 70:
    <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>
Line 172: Line 71:
        <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">
Line 194: Line 72:
            <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>
    <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"/>
Line 239: Line 80:
            <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"/>
Line 257: Line 81:
            </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>
Line 275: Line 82:
                <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>
    <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"/>
Line 293: Line 91:
        </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">
    <!--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>
Line 311: Line 97:
            <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>
</project>

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

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