Ru-Board.club
← Вернуться в раздел «Прикладное программирование»

» SOAP и таймер

Автор: 1datr
Дата сообщения: 03.10.2009 11:58
Делаешь по таймеру SOAP-запрос. Выходит еррор:

Conversion from class TTimer to SOAP is not supported. SOAP classes must derive from TRemotable.

При том, что из формы SOAP вызывается нормально. Как быть?
Вот код клиента:

Код:
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://localhost/xml/users.php?wsdl
// Encoding : ISO-8859-1
// Version : 1.0
// (02.10.2009 21:02:55 - 1.33.2.5)
// ************************************************************************ //

unit users;

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 Borland types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:int - "http://www.w3.org/2001/XMLSchema"
// !:string - "http://www.w3.org/2001/XMLSchema"

UserListData = class; { "urn:userswsdl" }
UserType = class; { "urn:userswsdl" }



// ************************************************************************ //
// Namespace : urn:userswsdl
// ************************************************************************ //
UserListData = class(TRemotable)
private
Fgroup_id: Integer;
Fsess_id: WideString;
published
property group_id: Integer read Fgroup_id write Fgroup_id;
property sess_id: WideString read Fsess_id write Fsess_id;
end;



// ************************************************************************ //
// Namespace : urn:userswsdl
// ************************************************************************ //
UserType = class(TRemotable)
private
Fid: Integer;
Fnick: WideString;
published
property id: Integer read Fid write Fid;
property nick: WideString read Fnick write Fnick;
end;

ArrayOfUsersType = array of UserType; { "urn:userswsdl" }

// ************************************************************************ //
// Namespace : urn:userswsdl
// soapAction: urn:userswsdl#userlist
// transport : http://schemas.xmlsoap.org/soap/http
// style : rpc
// binding : userswsdlBinding
// service : userswsdl
// port : userswsdlPort
// URL : http://localhost/xml/users.php
// ************************************************************************ //
userswsdlPortType = interface(IInvokable)
['{764CD106-2F61-B282-2A06-50EB9C85D82A}']
function userlist(const params: UserListData): ArrayOfUsersType; stdcall;
end;

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


implementation

uses CommonData;

function GetuserswsdlPortType(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): userswsdlPortType;
const
defSvc = 'userswsdl';
defPrt = 'userswsdlPort';
var
RIO: THTTPRIO;
cfg : TConfigData;
defURL : String;
defWSDL : String;
begin
AppCommonData.GetConfigParams(cfg);
defWSDL:=cfg.server+'/xml/users.php?wsdl';
defURL:=cfg.server+'/xml/users.php';
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 userswsdlPortType);
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
InvRegistry.RegisterInterface(TypeInfo(userswsdlPortType), 'urn:userswsdl', 'ISO-8859-1');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(userswsdlPortType), 'urn:userswsdl#userlist');
RemClassRegistry.RegisterXSClass(UserListData, 'urn:userswsdl', 'UserListData');
RemClassRegistry.RegisterXSClass(UserType, 'urn:userswsdl', 'UserType');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfUsersType), 'urn:userswsdl', 'ArrayOfUsersType');

end.
Автор: volser
Дата сообщения: 05.10.2009 10:27
1datr
Не создал экземпляр класса udata : UserListData;

Страницы: 1

Предыдущая тема: Многопоточный клиент на Delphi к TCP серверам


Форум Ru-Board.club — поднят 15-09-2016 числа. Цель - сохранить наследие старого Ru-Board, истории становления российского интернета. Сделано для людей.