1,593
社区成员
发帖
与我相关
我的任务
分享
//取Web Service接口
function GetMapXSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): MapXSoap;
const
defWSDL = 'http://192.168.1.48/MapX/mapX.asmx?WSDL';
defURL = 'http://192.168.1.48/MapX/mapX.asmx';
defSvc = 'MapX';
defPrt = 'MapXSoap';
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;
RIO.HTTPWebNode.UseUTF8InHeader := true;
try
Result := (RIO as MapXSoap);
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;
//调用
function TMapXServices.Select(const DBIndex: Integer; const Where,
CustomTable: string): TXmlDataSet;
var
Json: string;
begin
try
//取单个项目
Json := GetMapXSoap.Select(DBIndex, Where, CustomTable);
Result := JsonToXmlDataSet(Json);
except
on E: Exception do
begin
Result := nil;
FLastError := E.Message;
TAppUtils.WriteErrorFile('TMapXServices.Select:' + FLastError);
end;
end;
end;