IBM® WebSphere® 电信网络服务服务器,7.1 版本,向电信服务提供商提供了一种方法,去通过 RESTful 绑件(基于开发的 OneAPI 规格)以及基于 SOAP 的网络服务访问来发布网络功能。网络服务与 RESTful 界面一起,提供了以一种技术独立的方式,使用编程语言轻松访问服务功能的方法。
为了补充电信网络服务服务器中提供的 RESTful,在 WebSphere 电信工具集中为终端服务,短消息以及支付服务提供了 Dojo 工具。这些工具可以轻松嵌入到一个网络页面中,以创建 Web 2.0 样式的程序。
通信服务提供商面临着增加每位用户平均收益(ARPU)以及降低用户流失的严峻挑战。所以迫切需要对提供商已存在的网络功能进行整合(包括基础设施,例如信号系统),并以一种轻松和可控的方式方便第三方程序使用来发布它。
图 1. 电信基础设施之中的 TWSS
如图 1 所示,WebSphere 电信网络服务服务器(TWSS)的主要目标在于开发与网络服务一样方便的电信服务,以及 REST 样式的 URIs。通过整合这些 APIs 向客户创建增值服务,降低了解协议层次编程的需要,从而大大地方便第三方程序提供商。这降低了中等规模第三方程序提供商的进入门槛,这个规模的提供商没有较高技巧的雇员,但是却想要为它们的客户创建创新性的整合电信服务。例如,一个政策驱动的服务发布确定了该服务对于不同客户类别不同服务层次协议(SLA)都是可以定制的。
这一部分简单地介绍了 IBM WebSphere 电信网络服务服务器(TWSS)的结构,它由三个构件组成:
- 访问网关(AG)
- 服务政策管理器(SPM)
- 服务实施
访问网关提供了政策驱动的,流量监视,信息获取,授权和管理功能。这些服务是在程序层次上提供的,并且使用请求器,目标服务和调用操作的网络服务请求加强。访问网关为信息处理逻辑以及企业的网络政策提供了灵活性。您可以定制该逻辑来满足您的网络需求。TWSS 中 Service Implementation 层实施的服务不会直接发布到第三方程序。但是,您可以通过电信网络服务服务器访问网关得到它,在 IBM WebSphere Enterprise Service Bus 上运行。
AG 实施遵循服务构件结构(SCA)构件模型。访问网关实施由中介原语组成,它是小型的,目标驱动的信息处理逻辑,该逻辑可以合并并重新安排以创建中介流程。
查看 IBM 电信网络服务访问网关信息中心 7.1 版本以得到具体信息。在 参考资料 部分中有对它的链接。
正如前面部分所介绍的那样,访问网关构件就是政策驱动的,这意味着访问网关中介流程的中介原语行为是由配置政策治理的。服务政策管理器为该政策配置数据和运行时数据提供了管理,存储和获取功能,这些数据用于为给定的请求器编制服务。
查看 IBM WebSphere 电信网络服务服务器,7.1 信息中心的服务政策管理器部分以得到具体内容。在 参考资料 部分中可以得到对它的链接。
服务实施 (SI) 实际上会安装或者实施各种需要用第三方程序访问的服务。这些访问实施可以广泛分类为以下几种类型:
- 可以通过 SIP/IMS 操作的网络服务实施
- 基于 IBM® WebSphere® 软件的网络访问实施
- 基于 Direct Connect 协议的网络服务实施
- 基于 Parlay 的网络服务实施
查看 IBM WebSphere 电信网络服务服务器 7.1 版本 信息中心的网络服务实施部分,以得到每一个类别下关于可得到服务的更多信息。在 参考资料 部分中有对它的链接。
从 TWSS 7.1 版本开始,有一些服务实施可以从标准网络服务之外更简单的 REST(Representational State Transfer)界面得到。它基于 GSMA OneAPI(Open Network Enabler API)0.9 版本规格,它是为网络操作员向第三方程序开发员发布网络功能而准备的一系列规格。在 参考资料 部分中有对该规格的链接。至于 TWSS 7.1,接下来的操作是通过 REST 得到支持的:
终端位置
- getLocation
支付
- chargeAmount
- refundAmount
短消息
- sendSms
- getSmsDeliveryStatus
- getReceivedSms
使用 IBM WebSphere 电信网络服务服务器,7.1 版本 信息中心的 HTTP 来查看 REST 样式,以得到以上每种操作的具体信息。在 参考资料 部分之中对这些信息有链接。
本文的剩余部分关注的是 IBM TWSS 所发布的使用网络功能的不同方式,来开发电信应用程序。
该场景演示了怎样使用短信服务(SMS)以及 TWSS 所发布的终端位置网络服务,来开发一个电信应用程序。
- Debbie 作为第三方程序的订购者注册,GeoAlert,在这里她注册了一个基于位置的提醒服务,该服务在她靠近一个特定的区域时会提醒她。
- 在接受请求时,GeoAlert 程序会启动一次使用 Parlay X 终端位置网络服务的地理区域通知。GeoAlert 会请求终端位置网络服务,来在 Debbie 进入到特定区域时以一个特定的 URL 来发送一条通知。
- 当 Debbie 进入到特定的区域时,位置的通知就会被激化。GeoAlert 会在指定的 URL 得到通知,同时启动地理区域通知。该 URL 一般被叫做“Catcher URL”,或者简称为 Catcher。
- 在接受位置通知信息时,GeoAlert 会向 Debbie 发送一条短信(提醒信息)。
按照下面的步骤来开始部署程序:
- 生成 TerminalLocationNotificationManager 网络服务客户端
该客户端可以作为一个调用 Parlay X 终端位置网络服务的网络服务客户端。客户端调用了 TerminalLocationNotificationManager 界面的 startGeographicalNotification 操作。 - 开发 TerminalLocationNotification 网络服务实施
它的功能就是一个网络服务 Catcher(接受激发的通知)。该网络服务末端点会在激发 startGeographicalNotification 时得到设置,此时它作为一种接受通知的 Catcher 程序。为了完成我们的用例,我们将会从该网络服务的实施接受一条短消息(提醒),同时接受通知。 - 测试您的程序
这些步骤演示了怎样使用 IBM WebSphere 电信工具集来测试开发的程序。
- IBM Rational Application Developer 7.5.1 版本。 对于所有的页面我们都会使用它,因为它简化了客户端和网络服务实施的生成过程。
- IBM WebSphere Telecom Toolkit 7 版本。 将会安装到 Rational Application Developer 之中的工具集。它使得第三方的程序开发员能够快速构建和测试调用 SMS,MMS,Location,Presence 及 Call 控件的多功能程序。它还提供了一种平台,去开发技术证明(demos),评价方案并展示提供的不同功能。它还可以作为 IBM WebSphere 电信网络服务服务器的模拟器。
生成一个 TerminalLocationNotificationManager 网络服务客户端
- 启动 Rational Application Developer,并创建一个名为
StartNotificationClient的新 Java 项目。 - 在 Java 项目之下的
WSDL中创建一个文件名。 - 向您所创建的 WSDL 文件夹下载和复制 Parlay X 2.1 Terminal Location WSDL 文件夹。查看 Parlay X 2.1 规格以下载它。在 参考资料 部分可以得到对该规格的链接。
- 将 parlayx_terminal_location_notification_manager_service_2_3.wsdl 放到 WSDL 文件夹之中,右击并从下拉菜单之中选择 Web Services > Generate Client。
图 2. 生成终端位置通知管理器客户端
- 确定您选择了以下这些选项:
- 网络服务运行时: IBM WebSphere JAX-RPC
- 客户端项目: StartNotificationClient
图 3. 选择网络服务运行时选项
- 点击 Finish。
- 现在,在名为
StartNotificationClient.java的 com.ibm.client 包下创建一个 Java 类。
注意:整个 Java 代码是作为 下载 部分之中的 Project Interchange 提供的。确定 StartNotificationClient 项目的构建路径拥有对 <RAD75Home>\runtimes\base_v7\runtimes 中 com.ibm.ws.webservices.thinclient_7.0.0.jar 文件的引用。
代码清单 1 显示了 StartNotificationClient.java 包的范例代码,实际上它调用了终端位置服务的 startGeographicalNotification 操作。这段代码实际上在监视 Debbie 的位置。代码清单 1 中的代码创建了 startGeographicalNotification 操作所需要的不同对象。
清单 1. StartNotificationClient.java – 设置参数
// Subscriber sends location information in the form of Latitude and Longitude
String address = args[0];
float fLat = (float) Float.parseFloat(args[1]);
float fLong = (float) Float.parseFloat(args[2]);
/*Setting the Reference object. Reference specifies the endpoint where the
location notification need to sent by the terminal location web service */
SimpleReference reference = new SimpleReference();
URI endpoint =
new URI("http://localhost:9081/TestWeb/services/TerminalLocationNotification");
reference.setEndpoint(endpoint);
reference.setInterfaceName("TerminalLocation");
reference.setCorrelator("DemoCorr"+Calendar.getInstance().getTimeInMillis());
//Converting the address to URI.
URI[] addresses = new URI[1];
addresses[0]=new URI(address);
//Setting the radius and accuracy
float fRad = (float) 5.0;
float tAcc= (float) 100.0;
/*Setting the criteria.
ENTERING - Triggers the notification when subscriber enters the region specified
by Latitude, Longitude and Radius
LEAVING - Triggers the notification when subscriber leaves the region specified
by Latitude, Longitude and Radius */
EnteringLeavingCriteria crt = new EnteringLeavingCriteria("Entering");
//CheckImmediate specifies, if the location of subscriber needs to checked immediately
boolean chkImm = false;
//The frequency of the notification
TimeMetric freq = new TimeMetric();
freq.setMetric(new TimeMetrics("Millisecond"));
freq.setUnits(10000); |
代码清单 2 中的代码显示了 startGeographicalNotification 网络服务操作是如果调用的。
清单 2. StartNotificationClient.java – 调用操作
//Obtain TL Manager Proxy
TerminalLocationNotificationManagerProxy tlProxy =
new TerminalLocationNotificationManagerProxy();
//Set the endpoint where the Terminal Location Notification Manager web service
tlProxy.setEndpoint(url);
//Obtain the TL Manager
TerminalLocationNotificationManager tlMgr =
tlProxy.getTerminalLocationNotificationManager();
//Invoke the startGeographicalNotification
System.out.println("Calling the web service");
tlMgr.startGeographicalNotification(reference, addresses,
fLat, fLong, fRad, tAcc, crt, chkImm, freq); |
注意:
如果有尚未解决的类,例如 EnteringLeavingCriteria,将类的可视性更改为 public。
开发 TerminalLocationNotification 网络服务实施
对于接受通知而言,GeoAlert 必须要实施终端位置通知网络服务,该实施将会用作接受激发通知的 Catcher。
- 创建一个动态的网络项目,并将其命名为
TLCatcherWeb。 - 确定 Add project to an EAR 复选框与名为
TLCatcherWebEAR的 EAR Project Name 被选中了。 - 将 Parlay X 2.1 终端位置 WSDL 文件下载并复制到 TLCatcherWeb > WebContent > WEB-INF > wsdl 文件夹。为了进行下载操作,您可以查看 Parlay X 2.1 规格。在 参考资料 部分中有对其规格的链接。
- 将 parlayx_terminal_location_notification_service_2_2.wsdl 文件拖拉到 WSDL 文件夹,右击它,并从下拉菜单之中,选择 Web Services > Generate JavaBean skeleton。
图 4. 生成 JavaBean 框架
- 确定您为这些区域选择了以下的选项(参见图 5):
- 网络服务运行时: IBM WebSphere JAX-RPC
- 服务项目: TLCatcherWeb
- 服务 EAR 项目: TLCatcherWebEAR
图 5. 配置设置
- 点击 Finish。在点击 Finish 之后,如果要您完成服务器创建操作,那么点击 Cancel。
- 前面步骤中创建的框架包含了一系列的方法,该方法对应于终端位置通知 WSDL 中所描述的操作。在创建 bean 时,会提供每种方法的一种框架,如代码清单 3 所示。
清单 3. 终端位置通知框架代码
package org.csapi.www;
public class TerminalLocationNotificationBindingImpl
implements org.csapi.www.TerminalLocationNotification{
//This operation is invoked on a successful location notification
public void locationNotification(java.lang.String correlator,
org.csapi.www.LocationData[] data,
org.csapi.www.EnteringLeavingCriteria criteria) throws java.rmi.RemoteException {
}
//This operation is invoked on a location notification error
public void locationError(java.lang.String correlator, java.net.URI address,
org.csapi.www.ServiceError reason) throws java.rmi.RemoteException {
}
//This operation is invoked upon location notification end
public void locationEnd(java.lang.String correlator) throws java.rmi.RemoteException {
}
} |
当收到的位置通知满足 Debbie 的标准时,GeoAlert 程序就会向 Debbie 的移动电话发送一条短消息提醒。为了实现该操作,服务需要在 locationNotification 操作之内实施 sendSMS 客户端并调用 sendSMS 操作。
- 为了生成 SMS 客户端,您可以将 parlayx_sms_send_service_2_2.wsdl 文件下载并复制到 WSDL 文件夹之中,右击并选择 > Web Services > Generate Client。如果您想要下载,可以查看 Parlay X 2.1 规格。在 参考资料 部分中有对该规格的链接。
- 确定您选中了以下的选项:
- 网络服务运行时:IBM WebSphere JAX-RPC
- 客户端项目:TLCatcherWeb
- 客户端 EAR 项目:TLCatcherWebEAR
图 6. 网络服务客户端配置
这将会创建一个带有 sendSMS 操作桩块的包结构。
TerminalLocationNotificationBindingImpl 中的 locationNotification 方法就是满足 Debbie 标准时将会调用或者注明的方法。根据定义的用例,GeoAlert 会通过 SMS 向 Debbie 发送一个提醒。代码清单 3 显示了调用短消息服务 sendSMS 操作的范例代码。
清单 4. Terminal Location Notification 范例代码
//This operation is invoked on a successful location notification
public void locationNotification(java.lang.String correlator,
org.csapi.www.LocationData[] data,
org.csapi.www.EnteringLeavingCriteria criteria)
throws java.rmi.RemoteException {
String smsResp = "";
/*Fetch the address from the LocationData element.
Later use this address for sendSms operation */
URI[] addresses = new URI[1];
addresses[0] = data[0].getAddress();
/*Fetch the Location Info in the form of Latitude and Longitude.
Send this information in the SMS message to the subscriber*/
float lat = data[0].getCurrentLocation().getLatitude();
float lon = data[0].getCurrentLocation().getLongitude();
//Set the URL where Send SMS web service is running
String url = "http://localhost:9081/ParlayX21Web/services/SendSms";
try{
//Obtain SendSMS proxy
SendSmsProxy smsProxy = new SendSmsProxy();
//Set endpoint where web service is running
smsProxy.setEndpoint(url);
System.out.println("---Endpoint set---");
//Obtain the service handler
SendSms smsSvc = smsProxy.getSendSms();
System.out.println("---Handle to Service obtained. Invoking Web Service---");
//Compose the SMS message
String msg = "Hello Customer, Greetings from Location Based Reminder App. " +
"You have reached the Location where you had set a reminder. " +
"Your current location is Latitude = " + lat +
"Longitude = " + lon;
//Invoke sendSms operation of Short Message Service
smsResp= smsSvc.sendSms(addresses, "LocationBasedReminderAPP", null, msg, null);
System.out.println("---Sent Web Service request---");
}
catch(Exception e)
{
}
} |
当您在调用 locationNotification 方法时,它会向 Debbie 的移动设备发送一条短信。
在 WebSphere Telecom Toolkit 上厕所程序
为了测试您所开发的程序,您可以下载并使用 IBM WebSphere Telecom toolkit。在 参考资料 部分中有对它的链接。该款免费的工具集使得第三方的程序开发员能够快速构建和测试多功能程序,这些程序能够调用SMS,MMS,Location,Presence 以及 Call 控件。它还提供了一种平台去开发技术演示的证明,以评价方案,探讨提供的各种功能。
查看 IBM Education Assistant - WebSphere Telecom Toolkit 以得到更多的内容。在 参考资料 部分之中有对这些内容的链接。
注意:
- 在 Rational Application Developer 运行时中已经创建了 WebSphere Application Server 版本 7 概述。
- 在 Rational Application Developer 7.5.1 版本之中安装 IBM WebSphere Telecom Toolkit 7.1 版本。
- 在 Rational Application Developer 之中创建一个 WebSphere Application Server 版本 7 概述。
- 启动 WebSphere 服务器。
- 右击服务器,并选择 部署电信网络服务模拟器 (参见图 7)。这将会部署一个名为 WSSimulatorEAR 的程序。
图 7. 部署电信网络服务模拟器
- 在部署完成之后,右击服务器(参见图 8),并选择 运行电信网络服务模拟器 。
图 8. 运行电信网络服务模拟器客户端
有六种运行时视图会显示出所有的模拟器配置以及运行时数据:Activity,Call,Device,Group,Presence 以及 Map。看到 IBM Education Assistant – WebSphere Telecom Toolkit 配置以得到关于每一个视图的更多信息。
StartNotificationClient 是一种独立的 Java 程序。
EAR 项目,TLCatcherWebEAR,需要部署到一个服务器运行时之中。出于这个目的考虑,您可以使用 WebSphere Application Server 7 来作为该程序的运行时引擎。
- 右击 WebSphere Application Server 7(WAS 7),选择 Add and Remove Projects。
- 在 Add and Remove Projects 窗口之中,添加 TLCatcherWebEAR。
- 点击 Finish。
现在终端位置通知网络服务(Catcher)得到开发和运行。
在测试 GeoAlert 程序功能之前,要确认以下的内容:-
- TerminalLocationNotificationManager Endpoint 正在运行。该网络服务可以作为 Telecom Web Services Simulator 工具箱的一部分得到。http://localhost:9081/ParlayX21Web/services/TerminalLocationNotificationManager(实际端口号码可能会变化)。
- TerminalLocationNotification Endpoint 正在运行。该网络服务是在上一个练习中开发的(TLCatcherWebEAR)。http://localhost:9081/TLCatcherWeb/services/TerminalLocationNotification。(实际端口号码可能会变化)。
- 确定您在 Java 类 StartNotificationClient.java 中正确地设置末端点。
- 运行 Java 类 StartNotificationClient,提供以下的论断:
- arg1: subscriber_phone_number。该号码应该存在于电信网络服务模拟器之中。例如,电话:+1-2225552003
- arg2: 维度。例如,0.03
- arg3: 经度。例如,0.002
范例:java StartNotificationClient tel:+1-2225552003 0.03 0.002 - 确定作为参数的经纬度,在模拟器 Map 视图的附近。
注意: 为了得到地图之中特定位置的经纬度信息,您可以将任意图标拖拉到特定的位置处,并查看显示的位置,如图 9 所示。 - 切换至模拟器的 Map 视图。选择其图标来选择订购者 Debbie(电话:+1-2225552003),该图标是一个 移动电话 的图形。
图 9. 电信网络服务模拟器的 Map 视图
在从 Debbie 处接受全球之后,GeoAlert 会启动 Debbie 账户上的 Geographical Notification。您所开发的独立 Java 程序剔除了地理区域通知。
您可以在工具栏模拟器的 Map 视图中确认 Notification Started,如图 10 所示。
注意:
如果圆形的通知区域没有出现,那么就点击 Debbie 的移动电话图标。
图 10. 为 Debbie 所创建的通知
- 切换至模拟器的 Activity 视图,并确认在 Brown Motors > Debbie 下面创建了通知活动。
图 11. Activity 视图显示了为 Debbie 创建的通知
- 切换回 Map 视图。
现在 Debbie 去购物,并走到了当她靠近时想要得到提醒的通知区域。在工具箱中,您可以将 Debbie 的电话图标拖到通知环中来模拟这种情况。
图 12. Debbie 进入到指定的区域
在 Debbie 进入到通知环形区域之后,locationNotification 就会被 Terminal Location 网络服务激活。通知是由早期所开发的 GeoAlert Catcher 程序所激发的(TLCatcherWebEAR),所以 Catcher会向 Debbie 发送一条短信作为提醒。注意您调用了 Catcher 中 locationNotification 方法的 sendSMS 操作。
- 切换至 Activity 视图,并确认 Debbie 收到了 SMS 提醒。
图 13. 发送给 Debbie 的提醒
| 与范例代码相交流的项目 |
|---|
| 确定 StartNotificationClient 项目的构建路径拥有对 RAD75Home\runtimes\base_v7\runtimes 中文件 com.ibm.ws.webservices.thinclient_7.0.0.jar 的引用。 |
| 描述 | 名字 | 大小 | 下载方法 |
|---|---|---|---|
| 场景 1 的源代码 | TWSS_Usage_Sample_PI.zip | 115KB | HTTP |
学习
- 本文所引用的参考:
- IBM Telecom Web Services Access Gateway Information Center v7.1
- Service Policy Manager
- Web 服务实施
- 使用 HTTP 进行 REST 格式的访问
- Parlay X 2.1 规范
- IBM WebSphere Telecom toolkit
- IBM Education Assistant – WebSphere 电信工具集配置
- GSMA OneAPI
- IBM Rational Application Developer Version 7.5 文档
- IBM WebSphere Telecom Web Services Server Version 7.1 信息中心
- IBM WebSphere Telecom Toolkit, V7.1 学习助手
- 查找更多有关 Rational Application Developer 的信息:
- 浏览 developerWorks 页面上的 Rational Application Developer for WebSphere Software 产品专题,查找技术文章和许多相关资源的链接。
- 浏览 Rational Application Developer for WebSphere Software 信息中心。
- 访问 developerWorks 上的 Rational 软件区域,了解有关 Rational 软件交付平台产品的技术资源和最佳实践。
- 时刻关注 developerWorks 技术事件和 Web 广播,包括各种 IBM 产品和 IT 行业主题。
- 参见 developerWorksLive! 技术讲座,快速了解 IBM 产品和工具,以及 IT 行业趋势。
- 观看 developerWorks 演示中心,从初学者的产品安装和配置演示,到面向有经验开发人员的高级功能。
- 改善您的技能。查看 Rational 培训和认证 目录,其包含了许多广泛议题的课程类型。您可以在任何地方,任何时间学习它们,许多“启动”课程是免费的。
获得产品和技术
- 尝试免费使用 Rational Application Developer for WebSphere Software。
-
按照最适合您的方式IBM 产品评估试用版软件:下载进行试用,可以在线进行,在云环境中使用,或者在 IBM SOA 人员沙箱 中花一些时间了解如何有效实施面向服务架构。
讨论
- 加入 开发工具 讨论区,询问相关问题,并加入讨论。
- 通过 撰写一篇 developerWorks 文章 共享您的知识,并帮助那些使用 Rational 软件的人员。您将获得全球范围展示,RSS 企业联合组织,署名和建立,以及 developerWorks Rational web 网站专业编辑和出版的益处。
- 跟随 Facebook 和 Twitter (@ibmrational) 上的 Rational 软件,并添加您的注释和请求。
- 您可以加入 Rational 讨论区,cafés 和 wikis,询问并回答问题,增加您的专业技能。
- 通过加入 developerWorks 中文社区,与其他人员联系,分享您的兴趣爱好,并响应 开发人员驱动的博客。

Raghunath E. Nair 是班加罗尔 IBM 印度软件实验室的一名首席软件工程师。他于 2006 年加入 IBM。他最近的主要工作在 IBM WebSphere 软件电信电信软件的设计、开发和支持,包括 IBM WebSphere TWSS 和 IBM WebSphere IMS Connector。他的专业技能领域包括中间件集成,SOA,Web 服务和电信。他是 IBM 红皮书系列中使用 WebSphere Message Broker 作为一个 WebSphere Process Server ESB 的作者之一,并且拥有 Calicut 大学的电子和通信技术学士学位。

Chandrashekar B. Naik 是 IBM 印度软件实验室的一名软件工程师。他于 2004 年加入 IBM,他有软件设计、开发和测试的经验。他的专业技能包括 Java、J2EE 和 web 服务编程,包括 WebSphere Application Server,Telecom Web Services Server,Mobile Portal Accelerator,普及运算,以及电信行业 WebSphere 软件。他目前关注于 WebSphere Telecom Web Services Server 的开发、支持和测试。Chandrashekar 也是一名 Sun 认证开发人员,并且拥有 Belgaum 的 Visveswaraiah 技术大学的计算机科学工程学士学位。