These simple projects show the minimal set of capabilities.
To run the SOAP projects, proceed as follows.
- Clone this repository to a temporary folder.
- Import the projects as described in the Java EE tutorial.
- Once you published the SoapService projects onto your application server and started the server, your adder service is accessible under http://localhost:8080/SoapService/SoapAdderServiceBean (replace
localhost
with your Docker-IP, when using Docker Toolbox). It will, however, only accept SOAP messages and has no web user interface. - The SoapClient is a plain Java project that contains the generated proxy classes and a main method in class
Adder
. Run this class from Eclipse to get a result.
This procedure uses standardized JAX-WS technology (part of Java EE). It does, however, require some manual work.
- Ensure the PATH environment variable includes the "bin" folder from the JDK installation.
- After making changes to the Web service classes, create a
res
directory in theSoapAdder-EJB
project on your command line and nevigate into it. - Execute the following command to generate the WSDL file
wsgen -verbose -wsdl -cp ../build/classes de.wwu.pi.soapadder.SoapAdderServiceBean
- Run the web service application on your server.
- On the command line, navigate into an appropriate directory outside the server project and execute
wsimport -keep -p <targetPackageName> <URL of WSDL>
, e.g. usinghttp://localhost:8080/SoapService/SoapAdderServiceBean?wsdl
. This will generate Java source and class files. - Import the generated source files into your Eclipse project that should serve as client system: File > Import > General > File System
- Depending on the Web service, several message and data classes will be generated. Furthermore, there will be a service class which inherits from javax.xml.ws.Service. Instantiate this class or, in a managed environment, use dependency injection with the annotation
@WebServiceRef
(see lecture). The service instance will offer a method that returns a port providing the Web service operation(s).