SOAP client
A module for creating and registering SOAP services by classes annotated javax.jws.WebService/jakarta.jws.WebService.
Dependency¶
Dependency build.gradle:
Module:
Dependency build.gradle.kts:
Module:
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)!
            }
        }
    }
}
- URL of the service where requests will be sent (required)
- Maximum request time
- Enables module logging (default false)
- Enables module metrics (default true)
- Configures SLO for DistributionSummary metrics
- 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)!
- URL of the service where requests will be sent (required)
- Maximum request time
- Enables module logging (default false)
- Enables module metrics (default true)
- Configures SLO for DistributionSummary metrics
- 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:
Wsdl2java plugin¶
Gradle Plugin can be used as one option to create classes annotated javax.jws.WebService/jakarta.jws.WebService
based on WSDL.
Dependency¶
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"
            )
        )
    )
}