How to connect to Visma Severa API (from Java)

First, create a Web Service Client (see the end of this tutorial) using Apache Axis. This will generate the files that can be used by the client to access the web service, including exception classes, entities (e.g., interfaces (e.g., and stubs (e.g. You can move these file into appropriate packages to better organize the workspace.

When the files are generated, the client stubs can be used to access the server methods. For this purpose, an instance of SeveraApiLocator is needed. For example:

SeveraAPI locator = new SeveraAPILocator();

IWorkType workTypeClient = locator.getSeveraAPIIWorkType();


In some cases, especially when using Eclipse, creating a Web Service Client may also generate the proxies (e.g. If so, using them to access the server is more straightforward:

IWorkType workTypeClient = new IWorkTypeProxy();


Providing the API Key:

Many of the methods and services in Severa API are user dependent; therefore, they need an API Key to operate properly. This API Key should be attached as a header to the SOAP message that is passed to the server in each call. Attaching this header to all the call is a tedious task, but luckily, there is a workaround for that. All the generated stubs extends org.apache.axis.client.Stub class and use its _createCall() method. Thus, the workaround is simple: create a base class for the stubs (e.g. SeveraApiStubBase) that extends org.apache.axis.client.Stub and overrides its _createCall() method, and let all the stub classes extend this class. Inside this overriden method, the header “WebServicePassword” in the namespace “” should be added to the created call, as below:

public class SeveraApiStubBase extends org.apache.axis.client.Stub {


            public org.apache.axis.client.Call _createCall() throws ServiceException {

                         org.apache.axis.client.Call _call = super._createCall();

             _call.addHeader(new org.apache.axis.message.SOAPHeaderElement(
"", "WebServicePassword", "/*API_KEY*/"));

                         return _call;



To quickly change the stubs to extend from this base class, do the following:

Eclipse: go to Search -> File…, search for extends org.apache.axis.client.Stub, and replace it by your base class (e.g. extends SeveraApiStubBase).

IntelliJ IDEA: go to Edit -> Find -> Replace in Path…, and again, replace extends org.apache.axis.client.Stub by your base class.

Creating a Web Service Client

It is possible to do the below procedures when creating a new project, or on an existing project.

In the following, the service description file is located at:


Go to File -> New -> Other…, choose Web Service Client). In the Service Definition area, write the address for the service description file, then click Finish.

IntelliJ IDEA:

Create a new Module (File -> New -> Module…). In the New Module window, select Web Service Client (the Ultimate Edition of IntelliJ IDEA may be necessary for this), select the “Generate sample client code” check box, choose Apache Axis in the version, and continue with creating the module. In the new window that is opened, write the address of the service description file, fill in the other fields appropriately, and click OK.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Powered by Zendesk