当我们在WEBSERVICES中的方法中使用复杂的BEAN对象时,使用不同的工具,利用WSDL文件产生的类,调用方法不同,产生的类也不同,如用IBM本身的工具和利用AXIS中的WSDL2JAVA工具就明显不同了;所以我们在编码的时候,CLIENT端的调用方法也不同;如利用AXIS中的WSDL2JAVA工具产生的复杂BEAN的调用方法,需要将返回类型进行BeanSerializer和BeanDeserializer定义;代码如下:
public static void main(String[] args)
{
String endpoint = "http://localhost:7777/QuoteEngineIDTH/services/QuoteService";
Service service = new Service();
Call call = null;
try
{
call = (Call) service.createCall();
call.setTargetEndpointAddress(endpoint);
call.setMaintainSession(true);
call.setUseSOAPAction(true);
call.setSOAPActionURI( "http://service.quote.ecommerce.cigna.intl.com");
call.setOperationName("queryProduct");
QName paramerType = new QName("QueryProductParam");
QName returnParamerType = new QName("QueryProductResult");
call.addParameter(
"parameter1",
paramerType,
QueryProductParam.class,
javax.xml.rpc.ParameterMode.IN);
call.setReturnType(returnParamerType);
call.registerTypeMapping(
QueryProductResult.class,
returnParamerType,
new BeanSerializerFactory(
QueryProductResult.class,
returnParamerType),
new BeanDeserializerFactory(
QueryProductResult.class,
returnParamerType));
QueryProductParam queryProductParam = new QueryProductParam();
queryProductParam.setCampaigncode("BOB_CAMPAIGN");
queryProductParam.setCountry("ID");
queryProductParam.setLanguage("en");
queryProductParam.setOffercode("BOB_OFFER");
queryProductParam.setAgent("");
QueryProductResult queryProductResult =
(QueryProductResult) call.invoke(
new Object[] { queryProductParam });
System.out.println(queryProductResult.getResultCode());
}
catch (Exception e)
{
e.printStackTrace();
}
这里就将类QueryProductResult进行了BeanSerializer和BeanDeserializer,因在远程方法访问中,我们需要将对象序列化才能够传送;利用IBM WEBSPHERE中的工具产生的类来访问远程方法都被封装好了,只需要调用其中的类就可以使用,IBM已经将上面的大部分代码定义到工具产生的类中!
分享到:
相关推荐
IBM WebSphere MQ是IBM业界领先面向消息的中间件产品,也是MQ系列产品的基础和核心,它使不同的应用程序能够以企业级的性能,在广泛的平台上安全而可靠地通讯。
Websphere 下 发布webservice
IBM WebSphere MQ安装使用教程详细图解,根据本教程您可以迅速使用mq,不要犹豫了,快点下载吧
对应BLOG 文章 http://blog.csdn.net/keyboardsun/archive/2009/07/18/4359338.aspx
IBM Information Server FastTrack, IBM WebSphere® Business Glossary, IBM Information Server Business Glossary Anywhere, IBM WebSphere DataStage®, IBM WebSphere Information Analyzer, IBM WebSphere ...
The dictionary defines a portal as a grand or imposing door or entrance; hence, that picture on the cover. In this book, you will learn why the word portal has become a major buzzword in the world of ...
IBM WebSphere MQ 技术白皮书.doc
IBM WebSphere DataStage教程,供datastage学习者使用。
IBM WebSphere应用服务器简介
IBM WebSphere Portal 解决方案
IBM Websphere MQ 教程之备份与恢复
IBM WebSphere 应用开发实验指导 PDF
IBM websphereMQ 8.0.0.5 lib包; IBM\WebSphere MQ\java\lib下的文件 文件列表: com.ibm.mq.jms.Nojndi.jar com.ibm.mq.pcf.jar com.ibm.mq.allclient.jar com.ibm.mq.postcard.jar com.ibm.mq.axis2.jar ...
使用Java代码操作IBM WebSphere Portal 用户
IBM webSphere认证的试题,这是我们老师给的
IBM WebSphere DataStage Basic Reference Guide
IBM Websphere 集群配置 参考文档 供开发配置人员使用
从IBM官网下载的WebSphere应用服务器.安装的时候需要在IBM注册账号,验证账号.
This book offers a customer-focused perspective on building messaging solutions based on JMS and the leading messaging provider, IBM WebSphere Application Server. The author, Kareem Yusuf, uses his ...
IBM Websphere ESB企业服务总线