Home > Back-end >  Xe2 invoke the web service interface operation, over time, abnormal, cannot allocate more Internet h
Xe2 invoke the web service interface operation, over time, abnormal, cannot allocate more Internet h

Time:09-19

Program runs for a long time after the interface call places will start to quote exception,
An error detailed information is as follows:
Unable to load the WSDL File/Location: http://localhost:8080/InterFaceService/service/InterFaceService? WSDL. The Error [cannot allocate more Internet handle - URL: http://localhost:8080/InterFaceService/service/InterFaceService?wsdl - SOAPAction: & amp; quot; & amp; quot;] "/& gt;

Interface source code:
The 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 the or were referred
//to but never [!] Declared in the document. The types from the latter category
//typically map to a predefined/known XML or Embarcadero types; Or, they could also
//indicate incorrect WSDL documents that failed to declare the 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
//the port: InterFaceService
//URL: http://localhost:8080/InterFaceService/service/InterFaceService
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
InterFaceBean=interface (IInvokable)
[' {54258081 - E132-7265-9562 - CB0F456F6FC2} ']
The function interFace_ (const strYwdm: string; Const strXml: string; Const strMd5: string) : string; Stdcall;
end;

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


Implementation
USES the SysUtils;

The 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;
The begin
Result:=nil;
If (Addr=' ') then
The begin
If UseWSDL then
Addr:=defWSDL
The else
Addr:=defURL;
end;
If HTTPRIO=nil then
RIO:=THTTPRIO. Create (nil)
The else
RIO:=HTTPRIO;
Try
Result:=(RIO as InterFaceBean);
If UseWSDL then
The begin
RIO. WSDLLocation:=Addr;
RIO. Service:=defSvc;
RIO. Port:=defPrt;
End the else
LTD URL:=Addr;
The 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.


The calling code:
The function YWVerification (ABarcode, ASeqID: WideString; The out FailMsg: WideString) : WideString;
Var
VFunc: InterFaceBean;
VXml: TXMLDocument;
VRoot, vNode: IXMLNode;
TmpComp: TComponent;
VSendstr, vRes: string;
The begin
Result:=';
If ABarcode="' then
The begin
FailMsg:='incoming bar code is empty;
The Exit;
end;
If ASeqID="' then
The begin
FailMsg:='verify the serial number is empty;
The Exit;
end;
TmpComp:=TComponent. Create (nil);
The vXml: TXMLDocument.=the 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 (' the parm);
VNode. NodeValue:=ABarcode;
VNode:=vRoot AddChild (' the parm);
VNode. NodeValue:=ASeqID;
VSendstr:=vXml. XML. The Text;

VRes:=vFunc interFace_ (' human_004 vSendstr, 'l9PW1eO8HLU=');
If vRes="' then
The begin
FailMsg:='call interface failure, returns an empty;
The Exit;
end;
Result:=UTF8Encode (vRes);
Except,
On e: the Exception do
The begin
FailMsg:='call YWVerification anomalies: + e.M essage.
end;
end;
The finally
VXml. Free;
TmpComp. Free;
end;
end;