This document shall give a short overview to the ALE class from the Fosstrak filtering and collection, to the ALEServicePort and to the ALEServiceBinding.
The ALE is the responsible class for the communication with the applications of the Layer above. It provides:
The ALEServicePort provides the interface that allows clients to connect to the ALE. The service port provides:
The ALE provides the following methods to create or modify EventCycles:
Whenever a client wants to use an ALE service it has to register.
The ALE interface provides 2 mechanisms for "one-off-queries":
The interface to the ALE is modelled in the WebServices Description Language WSDL.
The interface basically describes the methods that are available on the webservice. Consequently the messages that are exchanged (this includes even Exceptions) are modelled in the wsdl as well.
This guide will not discuss how a wsdl-file has to be written. For further information refer to Apache cxf. This guide just gives a short explanation how the java stubs can be created out of the wsdl file and what changes have to be done to the generated stubs.
For technical references you can refer to the w3c standard documentation for wsdl 1.1: http://www.w3.org/TR/wsdl
There are many bogus "how to" in the internet. If you ever encounter a problem with the serialization of an xml i advice the following procedure:
To compile the wsdl file you need Apache cxf.
We will use the wsdl2java program to translate the wsdl to java classes.
Compile the wsdl:
wsdl2java -impl -v -p urn:epcglobal:xsd:1=org.fosstrak.ale.xsd.epcglobal -p urn:epcglobal:ale:xsd:1=org.fosstrak.ale.xsd.ale.epcglobal -p urn:epcglobal:ale:wsdl:1=org.fosstrak.ale.wsdl.ale.epcglobal EPCglobal-ale-1_1-ale.wsdl
The flags in detail:
To implement the service binding you need to implement the java class ALEServicePortTypeImpl.
In the Fosstrak Filtering and Collection most parts of the wsdl are auto-generated and you need not to change anything (see the pom.xml if you are interested).
The ALEServicePortTypeImpl is stored in the module fc-server (see the next chapter of this guide).
The stubs described in the former chapter are used for the communication between two services. However the binding from these stubs to the actual implementation of the ALE has to be defined explicitly. This task is performed by the ALEServicePortTypeImpl.
For each method defined in EPCglobal-ale-1_1-ale.wsdl there exists a method in the java file ALEServicePortTypeImpl. Whenever a client calls a method on its local method stub, the messages involved get serialized into xml, sent over the communication channel and then deserialized by the server stub. The stub then calls the corresponding method on the ALEServicePortTypeImpl. The ALEServicePortTypeImpl reformatts the incomming message (if necessary) and calls the ALE accordingly.
example for getStandardVersion: public java.lang.String getStandardVersion(EmptyParms parms) throws ImplementationExceptionResponse { if (!isInitialized) { initialize(); } return ALE.getStandardVersion(); }
You need to implement all the methods that shall be provided to clients in the ALEServicePortTypeImpl.