BoldChat API Documentation


Getting Started

The Boldchat web service provides access to customer account data by means of SOAP over HTTP. The following are instructions for getting started.

WSDL URL

Customers are provided the URL of the service's WSDL. For the time being, users should request this URL by emailing support@boldchat.com.

The URL is of the form https://ws.boldchat.com/aid/123/services/CustomerService?wsdl where 123 is the user's account identifier. The service provides access to a single account.

Use of the https version of the URL (as opposed to the http one) is required and enforced by the web service.

Stub generation

The Web Service Definition Language (WSDL) document provides meta-information about the web service.

There are tools that can be used to generate stub code from WSDL specifications. For example, Axis2 provides a tool named Wsdl2java which converts a WSDL document into Java stub classes. It may be run as follows.

 

wsdl2java -or -o /path/to/code -uri [WSDL URL]
 

Authentication

Note:
The username and password required to access the service for an account should be requested from Boldchat support for the time being. You may additionally request restricting access to a specific set of IPs.

The Boldchat web service supports BASIC HTTP authentication, which is secure provided it is done over a secure channel, such as https. Again, https is required by the Boldchat web service.

Client code should check for SSL certificate errors and reject the connection if there are any.

HTTP authentication in a client based on Axis2 stubs is straight forward.


CustomerServiceStub stub = new CustomerServiceStub();

ServiceClient serviceClient = stub._getServiceClient();

HttpTransportProperties.Authenticator authentication =

 new HttpTransportProperties.Authenticator();

authentication.setUsername("USERNAME");

authentication.setPassword("PASSWORD");

serviceClient.getOptions().setProperty(HTTPConstants.AUTHENTICATE, authentication);

Sample Code

The following code, based on Axis2 1.3 generated stubs, prints out a list of chat IDs and creation dates for chats created in the last 24 hours.

 

import org.apache.axis2.client.*;

import org.apache.axis2.transport.http.*;

import java.util.*;

 

public class WsTestEntry {

   public static void main(String[] arg) throws Exception {

       CustomerServiceStub stub = new CustomerServiceStub();

       ServiceClient serviceClient = stub._getServiceClient();

       HttpTransportProperties.Authenticator authentication =

         new HttpTransportProperties.Authenticator();

       authentication.setUsername("USERNAME");

       authentication.setPassword("PASSWORD");

       serviceClient.getOptions().setProperty(HTTPConstants.AUTHENTICATE, authentication);

       CustomerServiceStub.GetChatFoldersResponse response = stub.getChatFolders();

       CustomerServiceStub.FoldersResult result = response.get_return();

       CustomerServiceStub.FolderInfo[] folders = result.getFolders();

       for (int i = 0; i < folders.length; i++) {

    System.out.println("Folder ID=" + folders[i].getFolderID() +

                   ", Name=" + folders[i].getName());

    CustomerServiceStub.GetInactiveChats gic =

                   new CustomerServiceStub.GetInactiveChats();

    CustomerServiceStub.GetInactiveChatsInfo gici =

                   new CustomerServiceStub.GetInactiveChatsInfo();

    gic.setGetChatsInfo(gici);

    gici.setFolderID(folders[i].getFolderID());

    Calendar startDate = Calendar.getInstance();

    startDate.add(Calendar.HOUR, -24);

    gici.setFromDate(startDate);

    CustomerServiceStub.ChatInfo[] chats = stub.getInactiveChats(gic)

                   .get_return().getChats();

    if (chats != null) {

    for (int j = 0; j < chats.length; j++) {

    System.out.println("Chat ID=" + chats[j].getChatID() +

            ", Created=" + chats[j].getCreated().getTime());

    }

    }

    }

   }

}

Note:
Axis2 1.3 generated stubs will use primitives for nullable properties of type Integer or Long. A value of null is represented as Integer.MIN_VALUE and Long.MIN_VALUE, respectively.

API Reference

We provide an API Reference Documentation with details about the classes and methods made available by the web service.