SOAP Web Services using AndroMDA


The objective of this article is to provide a good start on automated generation of SOAP Web Services using MDA tool “AndroMDA”.  Here we will create a new web services project, and apply typical development iteration to it.

The sections are classified in a simple manner to provide an easy understanding on the flow:

Generating an AndroMDA Project

One of my previous article talks about creating a J2EE project using AndroMDA.  Check out the article (How to create Java/J2EE project using MDA tool – AndroMDA?) to get acquaintance with the steps to create a project.  In a similar way follow the below given specification to create web service  project using AndroMDA.

Web Services Project Generation Specification:

Type of Application    : J2EE

Parent Directory    : /Users/jeeva/Documents/svn/ (Provide your system path)

First name and Last name    : Jeevanandam Madanagopal (Provide your name)

Kind of Modeling Tool    : UML2

Project Description    : SOAP Web Service AndroMDA

Project Maven Artifact Id    : soap-webservice

Project Version    : 1.0-SNAPSHOT

Project Root Package (maven group Id)    : com.myjeeva.andromda.demo

Package Type    : war

Type of transactional/persistence    : spring

Programming Language for Service and DAO    : Java

Database backend for the persistence layer    : oracle

Workflow engine capabilities    : No

Web user interface    : No

Web Service Enabled    : Yes

SOAP stack    : CXF

JAX-WS REST provider/consumer media type    : json

The embedded Jetty web server    : Yes

Following the above response to the questions will end up getting your project generated successfully.

Let’s verify few essential things before we move to the next step UML modeling.

  • Go to your Local Maven Repository and check this path for AndroMDA UML profiles
    • {your-maven-repo-path}/org/andromda/profiles/uml2
AndroMDA UML Profiles

AndroMDA UML Profiles

  • Have a look at AndroMDA generated project in the provided directory

UML Modeling using MagicDraw UML

Considering the fact that we are familiar with MagicDraw, I picked up MagicDraw UML 17.0.2 tool to model.  Open up the model file in the MagicDraw; as per our article, the location where the model is placed under

While opening model file, MagicDraw will present you question of two Path Variables

  • maven2.repository – value is {path to your local maven repo}
  • andromda3.root – value is {path to your local maven repo}

For example: (below path as per my machine)

Now, model a couple of Value Objects, one Sample web service class, few Methods in it.  As per below package structure & UML diagram.

One of my article talk about UML Modeling for AndroMDA, you can go through and achieve the modeling comfortably.

Package Structure: SOAP Web Services Using AndroMDA

Package Structure: SOAP Web Services Using AndroMDA

UML Diagram: SOAP Web Services using AndroMDA

UML Diagram: SOAP Web Services using AndroMDA

Let us move on to the third step after successfully completing our modeling!

Creating ready-to-deployable CXF Web Service Client

We are getting into creation of web service client to consume our generated web service.

  • create a directory called 'cxf-client' inside the '{base-directory}/soap-webservice'
  • create a pom.xml file inside '{base-directory}/soap-webservice/cxf-client' directory
    • pom.xml maps the generated WSDL files and XJB Bindings files
  • Add <module>cxf-client</module> in the master pom for module chain
  • comment out <!-- module>CXF</module --> in the master pom

Note: CXF module is used to perform; java2ws portion of the build is only there to verify that the cxf code (jaxws annotations and references) generated by AndroMDA is valid for creating wsdl from the services, the result is not really used anywhere else.  Reason behind commenting out CXF module is, it may fail some times and cause trouble in the code generation flow.

Editing the andromda.xml configuration to add below element in the web service section and save the file.

Okay, we done with web service client creation module.  Let’s move on!

AndroMDA Code Generation & Compilation

Just issue a following maven command for Code generation & compilation.

Now, wait for Code generation to get complete 🙂 and you will see below message at the end.

Coding on {Web Service}WSDelegate

Now we will add our custom codes in the generated skeleton. Let us edit under core module.

Execute below maven commands to get project ready for ecilipe

Now maven modules are ready import in eclipse as a project.  Import and Add the following code snippets into respective methods.




For each Web Service method AndroMDA generates two method for value transformation purpose, can be customized for specific requirement.

  • get{web-service-method-name}TransformInput
  • get{web-service-method-name}TransformResponse

Comment out the following ANT call in mda/pom.xml to avoid deletion of Impl files in subsequent code build & generation

Download’s & Generated project from this Article

Now clone it from GitHub or download the Zip version. It include the sample project (will be used in next section) for consuming generated web service.

GitHub (soap-webservice):


Consuming Web Service with Sample Project

We will be executing the sample project to consume generated web service.  Lets start the webservice producer instance using jetty.  We have done small coding, so compile the code base.


Starting Web Service Instance:

Now web service available at http://localhost:9090/soap-webservice-webservice/services/SampleWebService?wsdl

Executing Sample Project: execute below maven command; then sample project will ready to import eclipse

After import, open ‘’ file and execute as Java Application. You will get following response in eclipse console window.