Skip to content

Wilma Service API library for Java

Tamás Kőhegyi edited this page May 22, 2021 · 9 revisions

A new library is introduced recently in order to communicate with Wilma Application by using a java library. Its name is wilma-service.api.jar it is available both from the source and can be referenced directly from MavenCentral.

Using from MavenCentral

Just add it as external reference. In case of gradle build you may do it in the following way:

dependencies {
    implementation group: 'com.epam.wilma', name: 'wilma-service-api', version: '2.0.451'
}

The available versions are accessible here.

####Using from Source First of all, you need to build wilma-service-api from its source. Please note, that in the sample below, a local repo is used.

./gradlew clean build createPom uploadLocal -PlocalRepository=file:///opt/wilma/repo/

This will create and install wilma-service-api-2.0.x.jar into your local repository. You may specify other local repository path too.

After the build, you may refer to the prepared jar from your build.gradle

#note: myLocalRepository should be specified in gradlew command, 
#      like: -PmyLocalRepository=file:///opt/wilma/repo/

repositories {
    maven { url "${myLocalRepository}" }
}

dependencies {
    implementation group: 'com.epam.wilma', name: 'wilma-service-api', version: '2.0.x'
}

Note: you may find the actual value of 'x' value in version.properties file.

API calls within your apps

The following example code shows how to connect to a running Wilma instance, and how to get version information from it.


    public void getWilmaVersionInformation() {
        //build connection to Wilma
        Properties props = new Properties();
        props.add("wilma.host", <wilma host name>);
        props.add("wilma.port.internal", <Wilma internal/UI port>);
        WilmaService wilmaService = new WilmaService(props);

        //now get the the actual version of Wilma
        String version = wilmaService.getVersionInformation();
        if (version != null) {
            //you have the Wilma version string in version variable
        } else {
            //ups, there was a communication problem with Wilma
        }

Available API calls right now

Runtime configuration

Message Logging configuration

HTTP API call HTTP method Wilma-service-api call
<Wilma-UI-URL>/config/public/logging/status GET MessageLoggingControlStatus getMessageLoggingStatus()
<Wilma-UI-URL>/config/admin/logging/on GET boolean setMessageLoggingStatus(MessageLoggingControl.ON)
<Wilma-UI-URL>/config/admin/logging/off GET boolean setMessageLoggingStatus(MessageLoggingControl.OFF)

Operation configuration

HTTP API call HTTP method Wilma-service-api call
<Wilma-UI-URL>/config/public/switch/status GET OperationMode getOperationMode()
<Wilma-UI-URL>/config/admin/switch/[MODE]
(where MODE can be wilma, stub and proxy)
GET setOperationMode(OperationMode.WILMA)
boolean setOperationMode(OperationMode.STUB)
boolean setOperationMode(OperationMode.PROXY)

Localhost blocking configuration

HTTP API call HTTP method Wilma-service-api call
<Wilma-UI-URL>/config/public/localhost/status GET LocalhostControlStatus getLocalhostBlockingStatus()
<Wilma-UI-URL>/config/admin/localhost/on GET boolean setLocalhostBlockingStatus(LocalhostControl.ON)
<Wilma-UI-URL>/config/admin/localhost/off GET boolean setLocalhostBlockingStatus(LocalhostControl.OFF)

Handle stub configuration

HTTP API call HTTP method Wilma-service-api call
<Wilma-UI-URL>/config/public/stubdescriptor GET JSONObject getStubConfigInformation()
<Wilma-UI-URL>/config/admin/stub/changestatus?nextstatus=&groupname= GET boolean changeStubConfigStatus(groupName, StubConfigStatus.DISABLED/ENABLED)
<Wilma-UI-URL>/config/admin/stub/changeorder?direction=&groupname= GET boolean changeStubConfigOrder(groupName, StubConfigOrder.UP/DOWN)
<Wilma-UI-URL>/config/admin/stub/drop?groupname= GET boolean dropStubConfig(groupName)
<Wilma-UI-URL>/config/admin/stub/save GET boolean persistActualStubConfig()

Providing application information

HTTP API call HTTP method Wilma-service-api call
<Wilma-UI-URL>/config/public/actualload GET JSONObject getActualLoadInformation()

Resource uploading

HTTP API call HTTP method Wilma-service-api call
<Wilma-UI-URL>/config/admin/stub/conditionchecker?fileName= POST boolean uploadConditionChecker(filename)
<Wilma-UI-URL>/config/admin/stub/templates?fileName= POST boolean uploadTemplate(filename)
<Wilma-UI-URL>/config/admin/stub/responseformatter?fileName= POST boolean uploadResponseFormatter(filename)
<Wilma-UI-URL>/config/admin/stub/stubconfig?fileName= POST boolean uploadStubConfiguration(filename)

Version information

HTTP API call HTTP method Wilma-service-api call
<Wilma-UI-URL>/config/public/version GET String getVersionInformation()

Shut down application

HTTP API call HTTP method Wilma-service-api call
<Wilma-UI-URL>/config/admin/shutdown GET/POST boolean shutdownApplication()

Planned calls, not-yet available

HTTP API call HTTP method Wilma-service-api call
GET dropAllStubConfig()
<Wilma-UI-URL>/config/public/livesequences GET JSONOBject getSequencesLiveInformation()

Stub Configuration via API

Further configaruation possibilities are available, those are not built into the API library. See: this page

Clone this wiki locally