Previous Step   Previous Step Next Step   Next Step

Develop an application.

Map Step 7 towards the goal: Accessing telephony services with Web services clients

About this task

The application that you develop is to call the Web services interface.
Attention: For another example, see the CEA sample application that comes with the CEA feature.

Before you begin

Restart the application server.

Procedure

  1. W3CEndpointReference openSession(CommWsRequest)
  2. void makeCall(CommWsRequest)
  3. void endCall()
  4. void closeSession()

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();
   }

   ...
}

What to do next

Install and start the new application.

Previous Step   Previous Step Next Step   Next Step


Terms and conditions for information centers | Feedback

Last updated: Jun 11, 2013 12:22:08 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=v700cea&product=was-nd-mp&topic=tcea_manage_calls_webservice_step7
File name: tcea_manage_calls_webservice_step7.html