Skip to content

API to generate a SoapUI project from an OpenAPI Specification (fka Swagger Specification) Given an OpenAPI Specification, either v2 or v3, a SoapUI project is generated with the requests for each resource operation and a test suite. The response is the content of the SoapUI project in XML format to save as file and import into the SoapUI applic…

License

Notifications You must be signed in to change notification settings

apiaddicts/openapi2soapui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

πŸ› οΈ OpenAPI2SoapUI Release Swagger Java License: LGPL v3

API to generate a SoapUI project from an OpenAPI Specification (fka Swagger Specification)

Given an OpenAPI Specification, either v2 or v3, a SoapUI project is generated with the requests for each resource operation and a test suite. The response is the content of the SoapUI project in XML format to save as file and import into the SoapUI application.

This repository is intended for :octocat: community use, it can be modified and adapted without commercial use. If you need a version, support or help for your enterprise or project, please contact us πŸ“§ devrel@apiaddicts.org

Twitter Discord LinkedIn Facebook YouTube

πŸ™Œ Join the OpenAPI2SoapUI Adopters list

πŸ“’ If OpenAPI2SoapUI is part of your organization's toolkit, we kindly encourage you to include your company's name in our Adopters list. πŸ™ This not only significantly boosts the project's visibility and reputation but also represents a small yet impactful way to give back to the project.

Organization Description of Use / Referenc
CloudAppi Apification and generation of microservices
RSI Generation of microservices

πŸ‘©πŸ½β€πŸ’» Contribute to ApiAddicts

We're an inclusive and open community, welcoming you to join our effort to enhance ApiAddicts, and we're excited to prioritize tasks based on community input, inviting you to review and collaborate through our GitHub issue tracker.

Feel free to drop by and greet us on our GitHub discussion or Discord chat. You can also show your support by giving us some GitHub stars ⭐️, or by following us on Twitter, LinkedIn, and subscribing to our YouTube channel! πŸš€

"Buy Me A Coffee"

βš™οΈ Functionalities

Here you can check the definition of the API Swagger to SoapUI

  • Base64 Decoding of Open API Specification Content
  • Parse Open API Specification Content into swagger-core representation as Java POJO
  • Create SoapUI Project
    • Add OAuth 2.0 Profiles to SoapUI Project
    • Add new REST Service to SoapUI Project
      • Add Endpoints to REST Service
      • Set basePath to REST Service
      • Add Resources (Paths) to REST Service
        • Add Methods (Verbs / Operations) to each Resource
          • Set REST Request to each Method
            • Set Credentials (OAuth 2.0 Profile)
            • Set Parameters examples to REST Request
            • Set Request Body example to REST Request
            • Set Custom Headers to REST Request
    • Add new TestSuites to SoapUI Project for each Method
      • Add TestCases to TestSuite
        • Add Execution Test Step (REST Request)

Nomenclature used:

  • SoapUI Project: {apiName}_{apiVersion}
  • REST Service: {apiName}
  • Resource: {path}
  • Method: {httpMethodInUppercase}
  • Request: {defaultRequestName}
  • Test Suite: {path}_{httpMethodInUppercase}_TestSuite
  • Test Case (Default): Success_TestCase
  • Test Case: {testCaseName}_TestCase
  • Test Step: Execution_{httpMethodInUppercase}_TestStep

The variables are obtained from:

  • apiName: property apiName of request body
  • apiVersion: version defined in the 'info' section of the OpenAPI Spec
  • path: each path defined in the OpenAPI Spec
  • httpMethodInUppercase: each HTTP methods of paths defined in OpenAPI Spec
  • testCaseName: each test case name defined in the property testCaseNames of request body

Technology stack

Overview

Technology Description
Core Framework Spring Boot 2

Server - Backend

Technology Description
JDK 11 Java Development Kit
Spring Boot 2 Framework to ease the bootstrapping and development of new Spring Applications
Maven 3 Dependency Management
Tomcat 9 Server deploy WAR

Libraries and Plugins

Technology Description
Lombok Never write another getter or equals method again, with one annotation your class has a fully featured builder, Automate your logging variables, and much more.
Hibernate Validator Express validation rules in a standardized way using annotation-based constraints and benefit from transparent integration with a wide variety of frameworks.
Springdoc OpenAPI UI OpenAPI 3 Library for spring boot projects. Is based on swagger-ui, to display the OpenAPI description.
SoapUI core module SoapUI is the world's leading Functional Testing tool for SOAP and REST testing.
Swagger Parser Parses OpenAPI definitions in JSON or YAML format into swagger-core representation as Java POJO, returning any validation warnings/errors.

πŸ“‘ Getting started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

External dependencies

The project use "SoapUI Core Module" dependency, which is not maven dependency, so you must have internet access to download the dependency from the external repository, below is the repository configuration inside the pom.xml file.

  ...

  <repositories>
    <repository>
      <id>SmartBearPluginRepository</id>
      <url>https://rapi.tools.ops.smartbear.io/nexus/content/groups/public/</url>			
    </repository>
  </repositories>
  
  ...

Running the application with IDE

There are several ways to run a Spring Boot application on your local machine. One way is to execute the main method in the Openapi2SoapUIApplication class from your IDE.

Example (Eclipse and its offshoots) :

  • Download the zip or clone the Git repository.
  • Unzip the zip file (if you downloaded one)
  • Open IDE
    • File -> Import -> Existing Maven Project -> Navigate to the folder project
    • Select the project
  • Choose the Spring Boot Application file (search for @SpringBootApplication)
  • Right Click on the file and Run as Java Application
  • URL to access: http://localhost:8080/api-openapi-to-soapui/v1/soap-ui-projects

Running the application locally with Maven

Alternatively you can use the Spring Boot Maven plugin like so:

  • Download the zip or clone the Git repository.
  • Unzip the zip file (if you downloaded one)
  • Open Command Prompt and Change directory (cd) to folder containing pom.xml
  • To build and start the server type
$ mvn spring-boot:run

Running the application in Docker

  • Download the zip or clone the Git repository.
  • Unzip the zip file (if you downloaded one)
  • Open Command Prompt and Change directory (cd) to folder containing pom.xml
  • To build and start the docker container type
$ mvn clean package -Pjar
$ docker-compose up -d

Running the application deploying WAR on Tomcat

The code can also be built into a war and then deployed on a Tomcat server.

  • Download the zip or clone the Git repository.
  • Unzip the zip file (if you downloaded one)
  • Open Command Prompt and Change directory (cd) to folder containing pom.xml
  • To build the war type
$ mvn clean package
  • Once the war is built, copy the output WAR to Tomcat's webapps directory.
$CATALINA_HOME/webapps/openapi2soapui-<version>.war

Files and Directories Structure

The project directory has a particular directory structure. A representative project is shown below:

Project Structure

.
β”œβ”€β”€ src
β”‚   └── main
β”‚       └── java
β”‚           β”œβ”€β”€ org.apiaddicts.apitools.openapi2soapui
β”‚           β”‚ 
β”‚           β”œβ”€β”€ org.apiaddicts.apitools.openapi2soapui.config
β”‚           β”‚  
β”‚           β”œβ”€β”€ org.apiaddicts.apitools.openapi2soapui.constants
β”‚           β”‚ 
β”‚           β”œβ”€β”€ org.apiaddicts.apitools.openapi2soapui.controller
β”‚           β”‚ 
β”‚           β”œβ”€β”€ org.apiaddicts.apitools.openapi2soapui.error
β”‚           β”œβ”€β”€ org.apiaddicts.apitools.openapi2soapui.error.exceptions
β”‚           β”œβ”€β”€ org.apiaddicts.apitools.openapi2soapui.error.validators
β”‚           β”‚     
β”‚           β”œβ”€β”€ org.apiaddicts.apitools.openapi2soapui.model
β”‚           β”‚
β”‚           β”œβ”€β”€ org.apiaddicts.apitools.openapi2soapui.request
β”‚           β”‚
β”‚           β”œβ”€β”€ org.apiaddicts.apitools.openapi2soapui.service
β”‚           β”‚
β”‚           └── org.apiaddicts.apitools.openapi2soapui.util
β”œβ”€β”€ src
β”‚   └── main
β”‚       └── resources
β”‚           β”œβ”€β”€ static
β”‚           β”‚   └── api.yaml
β”‚           β”‚   
β”‚           β”œβ”€β”€ application.properties
β”‚           β”œβ”€β”€ log4j.properties
β”‚           └── messages.properties
β”œβ”€β”€ JRE System Library
β”œβ”€β”€ Maven Dependencies
β”œβ”€β”€ src
β”œβ”€β”€ target
β”‚   └──openapi2soapui-1.0.2
β”œβ”€β”€ .gitlab-ci.yaml
β”œβ”€β”€ lombok.config
β”œβ”€β”€ mvnw
β”œβ”€β”€ mvnw.cmd
β”œβ”€β”€ pom.xml
└── README.md

Packages

  • config - app configurations;
  • constants - app contants;
  • controller - listen to the client;
  • error - manage errors;
  • exceptions - custom exception handling;
  • validators - custom validations;
  • model - entities;
  • request - body request model/entities;
  • service - business logic;
  • util - utility classes;

Resources

  • resources/ - contains all the static resources, templates and property files.
  • resources/static - contains static resources.
  • resources/static/api.yaml - contains Open API Specification.
  • resources/application.properties - contains application-wide properties. Spring reads the properties defined in this file to configure your application. You can define server’s default port, server’s context path, database URLs etc, in this file.
  • resources/log4j.properties - contains contains the entire runtime configuration used by log4j. This file will contain log4j appenders information, log level information and output file names for file appenders.
  • resources/messages.properties - contains the error messages used in the application.
  • mvnw / mvnw.cmd - This allows you to run the Maven project without having Maven installed and present in the path. Download the correct version of Maven if it can't be found (as far as I know by default in your user home directory). The mvnw file is for Linux (bash) and mvnw.cmd is for the Windows environment.
  • pom.xml - contains all the project dependencies

Deploy

  • Build the war type
$ mvn clean package
  • Once the war is built, copy the output WAR to Tomcat's webapps directory.
$CATALINA_HOME/webapps/openapi2soapui.war
  • Restart Tomcat Server
  • URL to access: <protocol>://<host>:<port>/openapi2soapui/api-openapi-to-soapui/v1/soap-ui-projects

Documentation

mvn javadoc:javadoc

πŸ’› Sponsors

cloudappi

About

API to generate a SoapUI project from an OpenAPI Specification (fka Swagger Specification) Given an OpenAPI Specification, either v2 or v3, a SoapUI project is generated with the requests for each resource operation and a test suite. The response is the content of the SoapUI project in XML format to save as file and import into the SoapUI applic…

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 3

  •  
  •  
  •