About this task
The application that
you develop is to call the web services interface. Use the following
CEA web service APIs to access telephony services with web service
clients:
- W3CEndpointReference openSession(CommWsRequest)
- void makeCall(CommWsRequest)
- void endCall()
- void closeSession()
Attention: For another example, see the CEA sample
application that comes with the CEA feature.
Example
The
following example shows how each of the APIs is used. For example,
the return value from openSession is very important. It is an endpoint
reference that must be used in all other APIs called related to the
session monitoring that phone.
import com.ibm.ws.commsc.webservice.client.*;
...
public class Sample {
private ControllerService controllerService = null;
private Controller controllerPort = null;
private W3CEndpointReference EPR = null;
private Controller controllerPortWithEPR = null;
// Constructor
public Sample() {
// Access the web services client
controllerService = ControllerService();
if (controllerService!= null) {
// Access the port on which main APIs are called
controllerPort = controllerService.getControllerPort();
}
...
}
// Open a session to monitor/control a phone
public void openSession(String addressOfRecord, String notifyCallback) {
// Build a request object
CommWsRequest wsRequest = new CommWsRequest();
wsRequest.setAddressOfRecord(addressOfRecord);
wsRequest.setNotifyCallback(notifyCallback);
EPR = controllerPort.openSession(wsRequest);
controllerPortWithEPR = EPR.getPort(Controller.class, new AddressFeature(true));
}
// Make a call
public void makeCall(String calleeAddressOfRecord) {
// Build a request object
CommWsRequest wsRequest = new CommWsRequest();
wsRequest.setPeerAddressOfrecord(calleeAddressOfRecord);
// Make the call, using the EPR returned in openSession()
controllerPortWithEPR.makeCall(wsRequest);
}
// End an active call
public void endCall() {
// End the call, using the EPR returned in openSession()
controllerPortWithEPR.endCall(wsRequest);
}
// Close the session monitoring the phone
public void closeSession() {
// Close the session, using the EPR returned in openSession()
controllerPortWithEPR.closeSession();
}
...
}