J2EE Web服务客户端质量报告(二)[Java编程]
本文“J2EE Web服务客户端质量报告(二)[Java编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
服务器Web 服务软件包
服务器Web 服务软件包可自动生成.在Sun ONE Studio中,Web模块的成立只要挑选一组EJB Java办法便可,并且Web服务软件包的类可由Web模块成立.
该软件包包含很多类和接口.这里最关键的一个就是<ServiceName>ServantInterface_Tie 类,在这个类中服务名就是<ServiceName> .类Tie是Web服务模块最上面的仓库;它将引入的服务调用绑定到成立它的EJB组件上.我们只需改正类Tie便可以增添次数记录.
Tie包含很多办法,但是我们只需改正与EJB商业办法invoke_<X>关联的那一个办法.在办法invoke_<X>中,<X>表示EJB商业办法的名称.我们增添一个 import Payload.*; 到类 Tie上,并对每个商业办法作了一个小小的改正.让我们看看下面的办法 invoke_SubmitWork() :
/*
* This method does the actual method invocation for operation: SubmitWork
*/
private void invoke_SubmitWork(StreamingHandlerState state) throws Exception {
TransactionService.XactServiceGenServer.
XactServiceServantInterface_SubmitWork_RequestStruct
myXactServiceServantInterface_SubmitWork_RequestStruct = null;
Object myXactServiceServantInterface_SubmitWork_RequestStructObj =
state.getRequest().getBody().getValue();
/* Line added to generated method: */
Serializer.queueFirstAttachmentText(state.getMessageContext());
if (myXactServiceServantInterface_SubmitWork_RequestStructObj
instanceof SOAPDeserializationState) {
myXactServiceServantInterface_SubmitWork_RequestStruct =
(TransactionService.XactServiceGenServer.
XactServiceServantInterface_SubmitWork_RequestStruct)
((SOAPDeserializationState)
myXactServiceServantInterface_SubmitWork_RequestStructObj)
.getInstance();
} else {
myXactServiceServantInterface_SubmitWork_RequestStruct =
(TransactionService.XactServiceGenServer.
XactServiceServantInterface_SubmitWork_RequestStruct)
myXactServiceServantInterface_SubmitWork_RequestStructObj;
}
java.lang.String result =
((TransactionService.XactServiceGenServer.XactServiceServantInterface)
getTarget()).SubmitWork
(myXactServiceServantInterface_SubmitWork_RequestStruct.getString_1());
TransactionService.XactServiceGenServer.
XactServiceServantInterface_SubmitWork_ResponseStruct
myXactServiceServantInterface_SubmitWork_ResponseStruct =
new TransactionService.XactServiceGenServer
.XactServiceServantInterface_SubmitWork_ResponseStruct();
SOAPHeaderBlockInfo headerInfo;
myXactServiceServantInterface_SubmitWork_ResponseStruct.setResult(result);
SOAPBlockInfo bodyBlock = new SOAPBlockInfo
(ns1_SubmitWork_SubmitWorkResponse_QNAME);
bodyBlock.setValue(myXactServiceServantInterface_SubmitWork_ResponseStruct);
bodyBlock.setSerializer
(myXactServiceServantInterface_SubmitWork_ResponseStruct_SOAPSerializer);
state.getResponse().setBody(bodyBlock);
}
我们增添了一个单行到invoke_SubmitWork()上:
Serializer.queueFirstAttachmentText(state.getMessageContext());
getMessageContext()返回实现接口javax.xml.rpc.handler.soap.SOAPMessageContext 的对象.该对象供应对当前SOAP信息的拜候.我们传送实现接口SOAPMessageContext 的对象到Payload.Serializer中的一个静态办法上.该静态办法从第一个信息附件中获得XML字符串并将它列队等候次数处理器EJB组件的调用.
我们对每个invoke_<X>办法作了一样的改正.
以上是“J2EE Web服务客户端质量报告(二)[Java编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |