JAX-RPC Web Service |
|
|
![]() |
|
配置和运行 | 技术说明 | Javadoc | 使用 Ant 构建 |
配置样本 |
运行样本 |
存在两个 Stock Quote 客户机,Java 2 Standard Edition(J2SE)版本和 Java 2 Enterprise Edition(J2EE)容器管理的版本。如果您要充分利用 J2EE 容器服务的功能,请运行 J2EE 版本。
要完成此样本的配置,请在服务器上部署 JAX-RPC Web Service 样本应用程序。如果尚未部署样本应用程序,请参阅重建和部署 WebServicesSamples.ear 文件的指示信息。
验证在客户机运行前服务器是否已启动。
Stock Quote 样本包含两个客户机和单个部署在服务器上的企业 bean。 一个客户机是简单 J2SE 客户机。您可在名为 GetQuote 的程序中找到它。 另一个是 Java 2 Enterprise Edition(J2EE)客户机。您可在 GetQuoteClient.jar 中找到它。
运行 J2SE Stock Quote 简单客户机 |
运行 J2EE Stock Quote 应用程序客户机 |
Stock Quote 客户机查询 StockQuote 企业 bean,以从 Web 检索当前股票行情。“股票行情”Web Service 可返回固定值,如果因特网连接有效,可返回当前股票行情。Stock Quote 客户机的第一个参数是目标端点 URL,它指定要使用的 Web Service。第二个参数是股票代号。 使用 XXX 值可以不使用因特网连接而获取固定价格。
J2SE Stock Quote 客户机不是容器管理的客户机。
要获取有关调用 J2SE WebSphere 客户机的更全面的指示信息,请参阅信息中心中有关开发瘦应用程序客户机代码的主题。
要从 WebSphere Application Server 运行 J2SE Stock Quote 简单客户机,根据您的操作系统,执行下列步骤:
C:\>"%JAVA_HOME%\bin\java" %WAS_LOGGING% -classpath "%WAS_CLASSPATH%;%WAS_HOME%\samples\lib\WebServicesSamples\simpleClients.jar;%WAS_HOME%\runtimes\com.ibm.ws.webservices.thinclient_7.0.0.jar" samples.stock.GetQuote http://localhost:9080/StockQuote/services/xmltoday-delayed-quotes XXX XXX: 55.25 C:\>"%JAVA_HOME%\bin\java" %WAS_LOGGING% -classpath "%WAS_CLASSPATH%;%WAS_HOME%\samples\lib\WebServicesSamples\simpleClients.jar;%WAS_HOME%\runtimes\com.ibm.ws.webservices.thinclient_7.0.0.jar" samples.stock.GetQuote http://localhost:9080/StockQuote/services/xmltoday-delayed-quotes DELL DELL: 23.67 |
J2EE 应用程序 GetQuoteClient.jar 是 Stock Quote 客户机的容器管理的版本。
在以下步骤中,变量 install_root 表示 WebSphere 安装根目录。
要从 WebSphere Application Server 运行 J2EE 应用程序 Stock Quote 客户机,根据您的操作系统执行下列步骤:
C:\WebSphere\AppServer\samples>\WebSphere\AppServer\bin\launchClient \WebSphere\AppServer\samples\lib\WebServicesSamples\ApplicationClients.ear -CCjar=GetQuoteClient.jar IBM IBM WebSphere Application Server, Release 7.0 J2EE Application Client Tool Copyright IBM Corp., 1997-2008 WSCL0012I: Processing command line arguments. WSCL0013I: Initializing the J2EE Application Client Environment. [3/29/06 14:55:22:359 CST] 0000000a W UOW=null source=com.ibm.ws.ssl.config.SSLConfig org=IBM prod=WebSphere component=Application Server thread=[P=720609:O=0:CT] CWPKI0041W: One or more key stores are using the default password. WSCL0035I: Initialization of the J2EE Application Client Environment has completed. WSCL0014I: Invoking the Application Client class com.ibm.websphere.samples.webservices.stockClient.GetQuote IBM: 83.36 C:\WebSphere\AppServer\samples>\WebSphere\AppServer\bin\launchClient \WebSphere\AppServer\samples\lib\WebServicesSamples\ApplicationClients.ear -CCjar=GetQuoteClient.jar XXX IBM WebSphere Application Server, Release 7.0 J2EE Application Client Tool Copyright IBM Corp., 1997-2008 WSCL0012I: Processing command line arguments. WSCL0013I: Initializing the J2EE Application Client Environment. [3/29/06 15:00:04:062 CST] 0000000a W UOW=null source=com.ibm.ws.ssl.config.SSLConfig org=IBM prod=WebSphere component=Application Server thread=[P=2171:O=0:CT] CWPKI0041W: One or more key stores are using the default password. WSCL0035I: Initialization of the J2EE Application Client Environment has completed. WSCL0014I: Invoking the Application Client class com.ibm.websphere.samples.webservices.stockClient.GetQuote XXX: 55.25 |
参阅 Stock Quote 技术说明和查看 Java 源代码,以了解更多的客户机和应用程序工作原理。