delphi中调用webservice时,出错,请大虾帮忙~~~
--这是我写的函数
function Tfrm_login.InitADAuth: string;
var
furls: string;
Iservice : ADAuthSoap;
begin
//取WS地址
QueryOpen(tempquery1,'select top 1 * from pln_message where class_id = ''ADAuth'' and remark = ''ccc'' ');
if not tempquery1.Isempty then
begin
//验证
Iservice := GetADAuthSoap(true,'http://svn.ccin.com/MOAWebService/ADAuth.asmx?WSDL');
result := Iservice.ADAuthByFlag(UserName,password,tempquery1.Fieldbyname('mes_name').asstring);
end
else
begin
result := 'false';
Iservice.free;
end;
end;
调用如下webservice
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://svn.ccin.com/MOAWebService/ADAuth.asmx?wsdl
// Encoding : utf-8
// Version : 1.0
// (2011-9-4 13:43:12 - $Revision: 1.9.1.0.1.0.1.9 $)
// ************************************************************************ //
unit ADAuth;
interface
uses InvokeRegistry, 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 Borland 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 : http://tempuri.org/
// soapAction: http://tempuri.org/%operationName%
// transport : http://schemas.xmlsoap.org/soap/http
// binding : ADAuthSoap
// service : ADAuth
// port : ADAuthSoap
// URL : http://svn.ccin.com/MOAWebService/ADAuth.asmx
// ************************************************************************ //
ADAuthSoap = interface(IInvokable)
['{56D59372-0D3E-E8B9-1A41-10407C99CD92}']
function IsAuthPass(const strUserName: String; const strPassword: String): String; stdcall;
function ADAuthByFlag(const name: String; const pwd: String; const flag: String): String; stdcall;
end;
function GetADAuthSoap(UseWSDL: Boolean=System.False; Addr: string=''): ADAuthSoap;
implementation
uses SOAPHTTPClient;
function GetADAuthSoap(UseWSDL: Boolean; Addr: string): ADAuthSoap;
const
defWSDL = 'http://svn.ccin.com/MOAWebService/ADAuth.asmx?wsdl';
defURL = 'http://svn.ccin.com/MOAWebService/ADAuth.asmx';
defSvc = 'ADAuth';
defPrt = 'ADAuthSoap';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
RIO := THTTPRIO.Create(nil);
try
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
Result := (RIO as ADAuthSoap);
finally
if Result = nil then
RIO.Free;
end;
end;
initialization
InvRegistry.RegisterInterface(TypeInfo(ADAuthSoap), 'http://tempuri.org/', 'utf-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ADAuthSoap), 'http://tempuri.org/%operationName%');
InvRegistry.RegisterInvokeOptions(TypeInfo(ADAuthSoap), ioDocument);
end.
出现奇怪的问题,按F9进行代码跟踪时,可以从服务器取数据,但直接运行exe文件时,报地址错误
---------------------------
[DEBUG]
---------------------------
Access violation at address 07992334. Write of address 07992334
---------------------------
确定
---------------------------
这是怎么回事啊~~