J2EE Web服务客户端质量报告(四)
2008-01-05 08:20:49 来源:WEB开发网核心提示:客户端服务软件包通过指引WSDL编译器到应用服务器提供的WSDL上可自动生成客户端服务软件包,这个软件包包含许多类,J2EE Web服务客户端质量报告(四),我们需要修改的唯一类就是客户端Stub类,同样地, 服务Stub类的名称为 <ServiceName>ServantInterface_Stub,其中<Servi
客户端服务软件包
通过指引WSDL编译器到应用服务器提供的WSDL上可自动生成客户端服务软件包。这个软件包包含许多类。我们需要修改的唯一类就是客户端Stub类。同样地,服务器Web 服务软件包也包含类Tie,它可将Web服务请求绑定到EJB方法上,客户端Stub类为每个服务商业方法的每个客户端配备一个方法。
服务Stub类的名称为 <ServiceName>ServantInterface_Stub,其中<ServiceName>就是服务名。我们看看类XactServiceServantInterface_Stub 内的submitWork()方法:
/*
* Implementation of submitWork
*/
public java.lang.String submitWork(java.lang.String string_1)
throws java.rmi.RemoteException {
try {
StreamingSenderState _state = _start(_handlerChain);
InternalSOAPMessage _request = _state.getRequest();
_request.setOperationCode(SubmitWork_OPCODE);
Xact.XactServiceServantInterface_SubmitWork_RequestStrUCt
_myXactServiceServantInterface_SubmitWork_RequestStruct =new Xact.XactServiceServantInterface_SubmitWork_RequestStruct();
_myXactServiceServantInterface_SubmitWork_RequestStruct.setString_1(string_1);
SOAPBlockInfo _bodyBlock = new SOAPBlockInfo(ns1_SubmitWork_SubmitWork_QNAME);
_bodyBlock.setValue(_myXactServiceServantInterface_SubmitWork_RequestStruct);
_bodyBlock.setSerializer(myXactServiceServantInterface_SubmitWork_RequestStruct_SOAPSerializer);
_request.setBody(_bodyBlock);
_state.getMessageContext().setPRoperty(HttpClientTransport.HTTP_SOAPACTION_PROPERTY, "");
Serializer.attachPendingReportToMessage(_state.getMessageContext());
_send((String) _getProperty(ENDPOINT_ADDRESS_PROPERTY), _state);
Xact.XactServiceServantInterface_SubmitWork_ResponseStruct
_myXactServiceServantInterface_SubmitWork_ResponseStruct = null;
Object _responSEObj = _state.getResponse().getBody().getValue();
if (_responseObj instanceof SOAPDeserializationState) {
_myXactServiceServantInterface_SubmitWork_ResponseStruct =
(Xact.XactServiceServantInterface_SubmitWork_ResponseStruct)
((SOAPDeserializationState)_responseObj).getInstance();
} else {
_myXactServiceServantInterface_SubmitWork_ResponseStruct =(Xact.XactServiceServantInterface_SubmitWork_ResponseStruct)responseObj;
}
return _myXactServiceServantInterface_SubmitWork_ResponseStruct
.getResult();
} catch (RemoteException e) {
// Let this one through unchanged
throw e;
} catch (JAXRPCException e) {
throw new RemoteException(e.getMessage(), e);
} catch (Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException)e;
} else {
throw new RemoteException(e.getMessage(), e);
}
}
}
在上述的代码中,我们在_send()之前立即添加了下面的单行:
通过指引WSDL编译器到应用服务器提供的WSDL上可自动生成客户端服务软件包。这个软件包包含许多类。我们需要修改的唯一类就是客户端Stub类。同样地,服务器Web 服务软件包也包含类Tie,它可将Web服务请求绑定到EJB方法上,客户端Stub类为每个服务商业方法的每个客户端配备一个方法。
服务Stub类的名称为 <ServiceName>ServantInterface_Stub,其中<ServiceName>就是服务名。我们看看类XactServiceServantInterface_Stub 内的submitWork()方法:
/*
* Implementation of submitWork
*/
public java.lang.String submitWork(java.lang.String string_1)
throws java.rmi.RemoteException {
try {
StreamingSenderState _state = _start(_handlerChain);
InternalSOAPMessage _request = _state.getRequest();
_request.setOperationCode(SubmitWork_OPCODE);
Xact.XactServiceServantInterface_SubmitWork_RequestStrUCt
_myXactServiceServantInterface_SubmitWork_RequestStruct =new Xact.XactServiceServantInterface_SubmitWork_RequestStruct();
_myXactServiceServantInterface_SubmitWork_RequestStruct.setString_1(string_1);
SOAPBlockInfo _bodyBlock = new SOAPBlockInfo(ns1_SubmitWork_SubmitWork_QNAME);
_bodyBlock.setValue(_myXactServiceServantInterface_SubmitWork_RequestStruct);
_bodyBlock.setSerializer(myXactServiceServantInterface_SubmitWork_RequestStruct_SOAPSerializer);
_request.setBody(_bodyBlock);
_state.getMessageContext().setPRoperty(HttpClientTransport.HTTP_SOAPACTION_PROPERTY, "");
Serializer.attachPendingReportToMessage(_state.getMessageContext());
_send((String) _getProperty(ENDPOINT_ADDRESS_PROPERTY), _state);
Xact.XactServiceServantInterface_SubmitWork_ResponseStruct
_myXactServiceServantInterface_SubmitWork_ResponseStruct = null;
Object _responSEObj = _state.getResponse().getBody().getValue();
if (_responseObj instanceof SOAPDeserializationState) {
_myXactServiceServantInterface_SubmitWork_ResponseStruct =
(Xact.XactServiceServantInterface_SubmitWork_ResponseStruct)
((SOAPDeserializationState)_responseObj).getInstance();
} else {
_myXactServiceServantInterface_SubmitWork_ResponseStruct =(Xact.XactServiceServantInterface_SubmitWork_ResponseStruct)responseObj;
}
return _myXactServiceServantInterface_SubmitWork_ResponseStruct
.getResult();
} catch (RemoteException e) {
// Let this one through unchanged
throw e;
} catch (JAXRPCException e) {
throw new RemoteException(e.getMessage(), e);
} catch (Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException)e;
} else {
throw new RemoteException(e.getMessage(), e);
}
}
}
在上述的代码中,我们在_send()之前立即添加了下面的单行:
- ››Web服务器和应用服务器的区别
- ››web安全之信息刺探防范1
- ››webqq 最新加密算法
- ››webdriver 数据库验证方法
- ››服务层
- ››WebSphere Application Server 7.0 XML Feature P...
- ››Web2.0网络时代基于社会影响力的声望值
- ››Web服务器搭建:配置Linux+Apache+Mysql+PHP(或Pe...
- ››WebLogic调整Java虚拟机性能优化参数
- ››webqq2.0协议研究(3)-ClientId生成
- ››Web.config配置文件
- ››WebBrowser组件的execWB方法——Delphi控制浏览器...
更多精彩
赞助商链接