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.

  • Rasheed Waraich

    Excellent Jeeva. Superb article.
    Thanks for sharing.

  • m.bilici

    Dear Jeeva, i love your articles. Great Work! Espacially the Andromda Tutorials.
    Maybe you can also help me out with that… I read somewhere that it is also possible to send an email from an andromda application using maven2 and jboss. do you have any tutorials on that? if yes, it would be great to share it with us.
    Keep up the good work, we will constantly and faithfully follow your site.
    Greets from Germany

    • Hello m.bilici – I’m glad reading your comment. For a moment I do not have an article with me, however I will try to take out sometime for same.


  • Angelo Fernandes

    Great article.

    I was trying to follow your ws generation for soap

    I have landed into a bottleneck where the wsdl directory which is located at
    C:tmpgeneric-repo-mastergeneric-repo-mastersoap-webservicewebservicesrcmainwebappwsdl ( from the downloaded project)

    not seem to get generated from my maven install command from my project
    after following the steps. Subsequently the cxf-client maven goal
    fails. Rest are all successful.

    I am using MagicDraw17.0.2 for model ( compared the model xml with the the screenshot on the article and it is the same)

    is there something that I am missing?
    If I just take the wsdl directory and put into my project in the respective location, all goals are a success.

    Any ideas to debug this issue will be greatly appreciated.



  • Angelo Fernandes

    solved issue. I had to export the model.