Applies to QAComplete 12.21 SaaS, last modified on July 15, 2019

Java 1.6 and later includes JAX-WS API (Java API for XML Web Services) for creating web services and web service clients. The easiest way to work with web services is by using proxy classes, so you do not need to handle raw SOAP XML messages and HTTP requests and responses.

  1. Use the wsimport tool (from the JDK_PATH/bin folder) to create proxy classes based on the QAComplete WSDL.

    wsimport -p com.smartbear.almcomplete -d DestDir -extension http://wsdl_url

    For wsdl_url, use one of the following:

    • For QAComplete SaaS (hosted on qacomplete.smartbear.com):

      http://soap.qacomplete.smartbear.com/psWS.asmx?WSDL

    • For QAComplete On-Premises (hosted on your company-owned server):

      http://[yourserver]/psws/psws.asmx?WSDL

    This will create the proxy classes (.class files) in the DestDir folder.

  2. Add these classes to your CLASSPATH environment variable. Or, if you use an IDE (like Eclipse or IntelliJ IDEA), point to these classes in your project properties.

Now, you can connect to the QAComplete web service and call its operations like this:

Java

package com.smartbear.almcomplete.client;

import com.smartbear.almcomplete.*;

public class QACompleteClient {
    public static void main(String[] args) {
        try {
            ServiceSoap service = new Service().getServiceSoap12();
            String version = service.getVersion();
            System.out.println(version);
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
}

Data type conversions

The LoadByCriteria operations return custom array types defined in the WSDL: ArrayOfBug, ArrayOfProject, and others. You can convert them to a Java List by using the getObjectType() method of the returned array.

Java

ArrayOfBug bugArr = service.bugsLoadByCriteria(authData, condition, sorting, pageSize, pageNumber);
List<Bug> bugs = bugArr.getBug();

See Also

SOAP API Introduction

Highlight search results