xe2调用 webservice接口 运行时间一长就报异常,无法分配更多Internet句柄

a735208362 2017-06-02 10:39:13
程序运行长时间之后接口调用的地方就会开始报异常,
报错的详细信息如下:
Unable to load WSDL File/Location: http://localhost:8080/InterFaceService/service/InterFaceService?wsdl. Error [无法分配更多的 Internet 句柄 - URL:http://localhost:8080/InterFaceService/service/InterFaceService?wsdl - SOAPAction:""]"/>

接口源代码:
unit InterFaceService;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

type

// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Embarcadero types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:string - "http://www.w3.org/2001/XMLSchema"[]


// ************************************************************************ //
// Namespace : interface
// transport : http://schemas.xmlsoap.org/soap/http
// style : rpc
// use : encoded
// binding : InterFaceServiceSoapBinding
// service : InterFaceBeanService
// port : InterFaceService
// URL : http://localhost:8080/InterFaceService/service/InterFaceService
// ************************************************************************ //
InterFaceBean = interface(IInvokable)
['{54258081-E132-7265-9562-CB0F456F6FC2}']
function interFace_(const strYwdm: string; const strXml: string; const strMd5: string): string; stdcall;
end;

function GetInterFaceBean(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): InterFaceBean;


implementation
uses SysUtils;

function GetInterFaceBean(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): InterFaceBean;
const
defWSDL = 'http://localhost:8080/InterFaceService/service/InterFaceService?wsdl';
defURL = 'http://localhost:8080/InterFaceService/service/InterFaceService';
defSvc = 'InterFaceBeanService';
defPrt = 'InterFaceService';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
try
Result := (RIO as InterFaceBean);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;


initialization
{ InterFaceBean }
InvRegistry.RegisterInterface(TypeInfo(InterFaceBean), 'interface', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(InterFaceBean), '');
{ InterFaceBean.interFace_ }
InvRegistry.RegisterMethodInfo(TypeInfo(InterFaceBean), 'interFace_', 'interFace', '');

end.


调用代码:
function YWVerification(ABarcode,ASeqID: WideString; out FailMsg: WideString): WideString;
var
vFunc: InterFaceBean;
vXml: TXMLDocument;
vRoot,vNode: IXMLNode;
tmpComp: TComponent;
vSendstr,vRes: string;
begin
Result:='';
if ABarcode='' then
begin
FailMsg:='传入条码号为空';
Exit;
end;
if ASeqID='' then
begin
FailMsg:= '验证流水号为空';
Exit;
end;
tmpComp:= TComponent.Create(nil);
vXml:= TXMLDocument.Create(tmpComp);
try
try
vFunc:= GetInterFaceBean(True,'http://localhost:8080/InterFaceService/service/InterFaceService?wsdl');
vXml.Active:= True;
vXml.Version:='1.0';
vXml.Encoding:='UTF-8';
vRoot:= vXml.AddChild('xml');
vNode:= vRoot.AddChild('parm');
vNode.NodeValue:= ABarcode;
vNode:= vRoot.AddChild('parm');
vNode.NodeValue:= ASeqID;
vSendstr:= vXml.XML.Text;

vRes:= vFunc.interFace_('human_004',vSendstr,'l9PW1eO8HLU=');
if vRes='' then
begin
FailMsg:='调用接口失败,返回空';
Exit;
end;
Result:= UTF8Encode(vRes);
except
on e:Exception do
begin
FailMsg:='调用YWVerification发生异常:'+ e.Message;
end;
end;
finally
vXml.Free;
tmpComp.Free;
end;
end;
...全文
1700 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
内容概要:本文系统研究了基于CNN-SVM的卷积神经网络与支持向量机融合的数据分类预测方法,聚焦其在工业故障识别中的应用,提供了完整的Matlab代码实现。通过CNN提取输入数据的深层空间特征,再由SVM进行高精度分类,充分发挥两者优势,有效提升了故障识别的准确性、鲁棒性与泛化能力。该方法特别适用于处理电力系统、机械设备等领域的高维、非线性、强噪声监测数据,在变压器故障诊断、轴承缺陷识别等场景中具有重要应用价值。文档还整合了机器学习、深度学习、图像处理、路径规划、电力系统优化等多个前沿科研方向的技术资源,配套大量Matlab/Simulink仿真案例与Python代码,全面支持科研复现与工程实践。; 适合人群:具备一定编程基础,熟练掌握Matlab或Python语言,从事电气工程、自动化、人工智能、机械故障诊断等相关领域研究的研发人员及高校研究生; 使用场景及目标:① 实现工业设备的状态监测与多类别故障分类;② 深入理解CNN与SVM融合模型的设计原理与工程实现细节;③ 借助所提供的丰富算法案例开展科研复现、模型优化与系统仿真验证; 阅读建议:建议按照文档目录结构系统化学习,结合百度网盘提供的完整代码资源进行动手实践,重点关注CNN特征提取层与SVM分类器之间的数据接口设计与参数调优策略,同时可延伸学习文中涉及的其他智能算法及其在电力系统、信号处理等领域的交叉应用,全面提升科研创新能力。

1,594

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧