Kora фреймворк для написания Java / Kotlin приложений с упором на производительность, эффективность, прозрачность сделанный разработчиками Т-Банк / Тинькофф

Kora is a framework for writing Java / Kotlin applications with a focus on performance, efficiency, transparency made by T-Bank / Tinkoff developers

Skip to content

SOAP client

A module for creating and registering SOAP services by classes annotated javax.jws.WebService/jakarta.jws.WebService.

Dependency

Dependency build.gradle:

implementation "ru.tinkoff.kora:soap-client"

Module:

@KoraApp
public interface Application extends SoapClientModule { }

Dependency build.gradle.kts:

implementation("ru.tinkoff.kora:soap-client")

Module:

@KoraApp
interface Application : SoapClientModule

Requires the HTTP client implementation to be connected.

Description

It is understood that we have classes annotated with javax.jws.WebService/jakarta.jws.WebService that can be created by other means, such as Gradle Plugin.

Based on such classes, Kora is used to create SOAP client implementations with the Impl suffix in the same package and register them as a module with config.

Then the configuration and the SOAP service itself become available for dependency injection automatically.

Configuration

All configurations for SOAP clients are created with the prefix soapClient, and the bulk of the client configuration is under the client name from the WSDL annotation @WebService, which corresponds often to the <wsdl:binding type="tns:SimpleService"> tag in the WSDL configuration.

SOAP service named SimpleService will have a configuration with the path soapClient.SimpleService.

Example of the complete configuration described in the SoapServiceConfig class (default or example values are specified):

soapClient {
    SimpleService {
        url = "https://localhost:8090" //(1)!
        timeout = "60s" //(2)!
        telemetry {
            logging {
                enabled = false //(3)!
            }
            metrics {
                enabled = true //(4)!
                slo = [ 1, 10, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 30000, 60000, 90000 ] //(5)!
            }
            tracing {
                enabled = true //(6)!
            }
        }
    }
}
  1. URL of the service where requests will be sent (required)
  2. Maximum request time
  3. Enables module logging (default false)
  4. Enables module metrics (default true)
  5. Configures SLO for DistributionSummary metrics
  6. Enables module tracing (default true)
soapClient:
  SimpleService:
    url: "https://localhost:8090" #(1)!
    timeout: "60s" #(2)!
    telemetry:
    logging:
        enabled: false #(3)!
      metrics:
        enabled: true #(4)!
        slo: [ 1, 10, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 30000, 60000, 90000 ] #(5)!
      telemetry:
        enabled: true #(6)!
  1. URL of the service where requests will be sent (required)
  2. Maximum request time
  3. Enables module logging (default false)
  4. Enables module metrics (default true)
  5. Configures SLO for DistributionSummary metrics
  6. Enables module tracing (default true)

Usage

Once all components have been created the created SOAP service is available for deployment, an example for a SimpleService service is shown below:

@Component
public final class SomeService {

    private final SimpleService service;

    public SomeService(SimpleService service) {
        this.service = service;
    }
}
@Component
class SomeService(val service: SimpleService) {

}

Wsdl2java plugin

Gradle Plugin can be used as one option to create classes annotated javax.jws.WebService/jakarta.jws.WebService based on WSDL.

Dependency

Plugin build.gradle:

plugins {
    id "com.github.bjornvester.wsdl2java" version "2.0.2"
}

Plugin build.gradle.kts:

plugins {
    id("com.github.bjornvester.wsdl2java") version ("2.0.2")
}

Usage

Suppose we have a WSDL where SimpleService is declared, then configuring the plugin for jakarta annotation will look like this:

Plugin setup build.gradle:

wsdl2java {
    cxfVersion = "4.0.2"
    wsdlDir = layout.projectDirectory.dir("src/main/resources/wsdl")
    useJakarta = true
    markGenerated = true
    verbose = false
    packageName = "ru.tinkoff.kora.generated.soap"
    generatedSourceDir.set(layout.buildDirectory.dir("generated/sources/wsdl2java/java"))
    includesWithOptions = [
        "**/simple-service.wsdl": ["-wsdlLocation", "https://kora.tinkoff.ru/simple/service?wsdl"],
    ]
}

Plugin setup build.gradle.kts:

wsdl2java {
    cxfVersion = "4.0.2"
    wsdlDir = layout.projectDirectory.dir("src/main/resources/wsdl")
    useJakarta = true
    markGenerated = true
    verbose = false
    packageName = "ru.tinkoff.kora.generated.soap"
    generatedSourceDir.set(layout.buildDirectory.dir("generated/sources/wsdl2java/java"))
    includesWithOptions.putAll(
        mapOf(
            "**/simple-service.wsdl" to listOf(
                "-wsdlLocation",
                "https://kora.tinkoff.ru/simple/service?wsdl"
            )
        )
    )
}