11: JAX-WS how to create a SOAP web service in Java?

Step 1:Create the Java Maven project:

Step 2: Need the libraries/frameworks

This example shows Apache CXF library as JAX-WS implementation with Spring and deployed to JBoss server 5.1.1.

Step 3: Web service interface with JAX-WS annotations

Folder: src/main/java

Step 4: Implementation of Web service interface

Step 5: Spring XML config as IoC.

Folder: src/main/resources/com/mytutorial

Note down the “address”.

Step 6: web.xml deployment descriptor

to bootstrap Spring and initialize servlet, mapping, etc. Folder: src/main/webapp/WEB-INF.

Build the war and deploy to say JBoss application server.

Step 6: JBoss deployment descriptor

Folder: src/main/webapp/WEB-INF/jboss-web.xml

The URL = http://localhost:8080/tutorial/

tutorial: defined in jboss-web.xml (application context)

JAX-WS Web Services listings on the browser

JAX-WS Web Services listings on the browser

To get the WSDL

URL: http://localhost:8180/tutorial/simpleSoapService?wsdl

WSDL structure

WSDL structure

WSDL structure

Project Structure

Maven Project Structure

Maven Project Structure

Deployable WAR file Structure

Deployable war file

Deployable war file

300+ Java & Big Data Interview FAQs

16+ Java Key Areas Interview Q&As

800+ Java Interview Q&As

300+ Java & Big Data Tutorials