Network Deployment (Distributed operating systems), v8.0 > End-to-end paths > Communications enabled applications > Access telephony services with web services clients

  Previous Step   Next Step


Develop an application.

 Step 6: Access telephony services with web services clients JAX-WS

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:

Attention: For another example, see the CEA sample application that comes with the CEA feature.

Restart the application server.


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


   ...
}


Support information (generally applicable)


What to do next

Install and start the new application.

  Previous Step   Next Step







+

Search Tips   |   Advanced Search