1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: 401: 402: 403: 404: 405: 406: 407: 408: 409: 410: 411: 412: 413: 414: 415: 416: 417: 418: 419: 420: 421: 422: 423: 424: 425: 426: 427: 428: 429: 430: 431: 432: 433: 434: 435: 436: 437: 438: 439: 440: 441: 442: 443: 444: 445: 446: 447: 448: 449: 450: 451: 452: 453:
| unit league1;
interface
uses InvokeRegistry, Types, XSBuiltIns;
type
LeagueRequest = class; TableRequest = class; LeagueResponse = class; TableEntry = class; TableResponse = class; ResultsRequest = class; Result = class; ResultsResponse = class; GamesRequest = class; Game = class; GamesResponse = class; ScorerResponse = class; ScorerRequest = class;
LeagueRequest = class(TRemotable) private FDevId: Integer; FDevCode: String; published property DevId: Integer read FDevId write FDevId; property DevCode: String read FDevCode write FDevCode; end;
TableRequest = class(LeagueRequest) private FMode: Smallint; FLanguage: Smallint; FSeason: Smallint; FClub: String; FLeagueCode: Smallint; FGroup: Smallint; FLatestGroupOnly: Boolean; published property Mode: Smallint read FMode write FMode; property Language: Smallint read FLanguage write FLanguage; property Season: Smallint read FSeason write FSeason; property Club: String read FClub write FClub; property LeagueCode: Smallint read FLeagueCode write FLeagueCode; property Group: Smallint read FGroup write FGroup; property LatestGroupOnly: Boolean read FLatestGroupOnly write FLatestGroupOnly; end;
LeagueResponse = class(TRemotable) private FCopyright: String; FDisclaimer: String; FDate: String; FServiceVersion: String; FServiceImplementation: String; published property Copyright: String read FCopyright write FCopyright; property Disclaimer: String read FDisclaimer write FDisclaimer; property Date: String read FDate write FDate; property ServiceVersion: String read FServiceVersion write FServiceVersion; property ServiceImplementation: String read FServiceImplementation write FServiceImplementation; end;
TableEntry = class(TRemotable) private FRank: Integer; FTeam: String; FLeagueCode: Smallint; FLeague: String; FGroup: Smallint; FGamesPlayed: Integer; FWins: Integer; FWinsAfterOvertime: Integer; FDraws: Integer; FDefeats: Integer; FDefeatsAfterOvertime: Integer; FGoalsScored: Integer; FGoalsReceived: Integer; FPoints: Integer; published property Rank: Integer read FRank write FRank; property Team: String read FTeam write FTeam; property LeagueCode: Smallint read FLeagueCode write FLeagueCode; property League: String read FLeague write FLeague; property Group: Smallint read FGroup write FGroup; property GamesPlayed: Integer read FGamesPlayed write FGamesPlayed; property Wins: Integer read FWins write FWins; property WinsAfterOvertime: Integer read FWinsAfterOvertime write FWinsAfterOvertime; property Draws: Integer read FDraws write FDraws; property Defeats: Integer read FDefeats write FDefeats; property DefeatsAfterOvertime: Integer read FDefeatsAfterOvertime write FDefeatsAfterOvertime; property GoalsScored: Integer read FGoalsScored write FGoalsScored; property GoalsReceived: Integer read FGoalsReceived write FGoalsReceived; property Points: Integer read FPoints write FPoints; end;
ArrayOfTableEntry = array of TableEntry;
TableResponse = class(LeagueResponse) private FTable: ArrayOfTableEntry; public destructor Destroy; override; published property Table: ArrayOfTableEntry read FTable write FTable; end;
ResultsRequest = class(LeagueRequest) private FMode: Smallint; FSeason: Smallint; FLanguage: Smallint; FLeagueCode: Smallint; FGroup: Smallint; FClub: String; FRounds: Smallint; FLatestGroupOnly: Boolean; published property Mode: Smallint read FMode write FMode; property Season: Smallint read FSeason write FSeason; property Language: Smallint read FLanguage write FLanguage; property LeagueCode: Smallint read FLeagueCode write FLeagueCode; property Group: Smallint read FGroup write FGroup; property Club: String read FClub write FClub; property Rounds: Smallint read FRounds write FRounds; property LatestGroupOnly: Boolean read FLatestGroupOnly write FLatestGroupOnly; end;
Result = class(TRemotable) private FRound: Smallint; FLeagueCode: Smallint; FLeague: String; FGroup: Smallint; FHomeTeam: String; FAwayTeam: String; FGoalsHomeTeam: Smallint; FGoalsAwayTeam: Smallint; FGoalsHomeTeamPeriod1: Smallint; FGoalsHomeTeamPeriod2: Smallint; FGoalsHomeTeamPeriod3: Smallint; FGoalsHomeTeamOvertime: Smallint; FGoalsHomeTeamPenalty: Smallint; FGoalsAwayTeamPeriod1: Smallint; FGoalsAwayTeamPeriod2: Smallint; FGoalsAwayTeamPeriod3: Smallint; FGoalsAwayTeamOvertime: Smallint; FGoalsAwayTeamPenalty: Smallint; FPlayed: Boolean; FOvertime: Boolean; FForfait: Boolean; FDate: String; published property Round: Smallint read FRound write FRound; property LeagueCode: Smallint read FLeagueCode write FLeagueCode; property League: String read FLeague write FLeague; property Group: Smallint read FGroup write FGroup; property HomeTeam: String read FHomeTeam write FHomeTeam; property AwayTeam: String read FAwayTeam write FAwayTeam; property GoalsHomeTeam: Smallint read FGoalsHomeTeam write FGoalsHomeTeam; property GoalsAwayTeam: Smallint read FGoalsAwayTeam write FGoalsAwayTeam; property GoalsHomeTeamPeriod1: Smallint read FGoalsHomeTeamPeriod1 write FGoalsHomeTeamPeriod1; property GoalsHomeTeamPeriod2: Smallint read FGoalsHomeTeamPeriod2 write FGoalsHomeTeamPeriod2; property GoalsHomeTeamPeriod3: Smallint read FGoalsHomeTeamPeriod3 write FGoalsHomeTeamPeriod3; property GoalsHomeTeamOvertime: Smallint read FGoalsHomeTeamOvertime write FGoalsHomeTeamOvertime; property GoalsHomeTeamPenalty: Smallint read FGoalsHomeTeamPenalty write FGoalsHomeTeamPenalty; property GoalsAwayTeamPeriod1: Smallint read FGoalsAwayTeamPeriod1 write FGoalsAwayTeamPeriod1; property GoalsAwayTeamPeriod2: Smallint read FGoalsAwayTeamPeriod2 write FGoalsAwayTeamPeriod2; property GoalsAwayTeamPeriod3: Smallint read FGoalsAwayTeamPeriod3 write FGoalsAwayTeamPeriod3; property GoalsAwayTeamOvertime: Smallint read FGoalsAwayTeamOvertime write FGoalsAwayTeamOvertime; property GoalsAwayTeamPenalty: Smallint read FGoalsAwayTeamPenalty write FGoalsAwayTeamPenalty; property Played: Boolean read FPlayed write FPlayed; property Overtime: Boolean read FOvertime write FOvertime; property Forfait: Boolean read FForfait write FForfait; property Date: String read FDate write FDate; end;
ArrayOfResult = array of Result;
ResultsResponse = class(LeagueResponse) private FResults: ArrayOfResult; public destructor Destroy; override; published property Results: ArrayOfResult read FResults write FResults; end;
GamesRequest = class(LeagueRequest) private FMode: Smallint; FSeason: Smallint; FLanguage: Smallint; FLeagueCode: Smallint; FGroup: Smallint; FClub: String; FRounds: Smallint; FLatestGroupOnly: Boolean; published property Mode: Smallint read FMode write FMode; property Season: Smallint read FSeason write FSeason; property Language: Smallint read FLanguage write FLanguage; property LeagueCode: Smallint read FLeagueCode write FLeagueCode; property Group: Smallint read FGroup write FGroup; property Club: String read FClub write FClub; property Rounds: Smallint read FRounds write FRounds; property LatestGroupOnly: Boolean read FLatestGroupOnly write FLatestGroupOnly; end;
Game = class(TRemotable) private FRound: Smallint; FLeagueCode: Smallint; FLeague: String; FGroup: Smallint; FHomeTeam: String; FAwayTeam: String; FGymName: String; FPlace: String; FDate: String; FTime: String; published property Round: Smallint read FRound write FRound; property LeagueCode: Smallint read FLeagueCode write FLeagueCode; property League: String read FLeague write FLeague; property Group: Smallint read FGroup write FGroup; property HomeTeam: String read FHomeTeam write FHomeTeam; property AwayTeam: String read FAwayTeam write FAwayTeam; property GymName: String read FGymName write FGymName; property Place: String read FPlace write FPlace; property Date: String read FDate write FDate; property Time: String read FTime write FTime; end;
ArrayOfGame = array of Game;
GamesResponse = class(LeagueResponse) private FGames: ArrayOfGame; public destructor Destroy; override; published property Games: ArrayOfGame read FGames write FGames; end;
ScorerResponse = class(LeagueResponse) private published end;
ScorerRequest = class(LeagueRequest) private published end;
League = interface(IInvokable) ['{0ADA2515-89E1-3475-02E6-59153ECCB522}'] function table(const request: TableRequest): TableResponse; stdcall; function tableLeague(const DevId: Integer; const DevCode: String; const Language: Smallint; const Season: Smallint; const LeagueCode: Smallint; const Group: Smallint): TableResponse; stdcall; function tableTeam(const DevId: Integer; const DevCode: String; const Language: Smallint; const Season: Smallint; const Club: String; const LeagueCode: Smallint; const LatestGroupOnly: Boolean): TableResponse; stdcall; function tableTeamGroup(const DevId: Integer; const DevCode: String; const Language: Smallint; const Season: Smallint; const Club: String; const LeagueCode: Smallint; const Group: Smallint): TableResponse; stdcall; function tableClub(const DevId: Integer; const DevCode: String; const Language: Smallint; const Season: Smallint; const Club: String; const LatestGroupOnly: Boolean): TableResponse; stdcall; function results(const request: ResultsRequest): ResultsResponse; stdcall; function resultsLeague(const DevId: Integer; const DevCode: String; const Language: Smallint; const Season: Smallint; const LeagueCode: Smallint; const Group: Smallint; const Rounds: Smallint): ResultsResponse; stdcall; function resultsTeam(const DevId: Integer; const DevCode: String; const Language: Smallint; const Season: Smallint; const Club: String; const LeagueCode: Smallint; const Rounds: Smallint; const LatestGroupOnly: Boolean): ResultsResponse; stdcall; function resultsTeamGroup(const DevId: Integer; const DevCode: String; const Language: Smallint; const Season: Smallint; const Club: String; const LeagueCode: Smallint; const Group: Smallint; const Rounds: Smallint): ResultsResponse; stdcall; function resultsClub(const DevId: Integer; const DevCode: String; const Language: Smallint; const Season: Smallint; const Club: String; const Rounds: Smallint; const LatestGroupOnly: Boolean): ResultsResponse; stdcall; function games(const request: GamesRequest): GamesResponse; stdcall; function gamesLeague(const DevId: Integer; const DevCode: String; const Language: Smallint; const Season: Smallint; const LeagueCode: Smallint; const Group: Smallint; const Rounds: Smallint): GamesResponse; stdcall; function gamesTeam(const DevId: Integer; const DevCode: String; const Language: Smallint; const Season: Smallint; const Club: String; const LeagueCode: Smallint; const Rounds: Smallint; const LatestGroupOnly: Boolean): GamesResponse; stdcall; function gamesTeamGroup(const DevId: Integer; const DevCode: String; const Language: Smallint; const Season: Smallint; const Club: String; const LeagueCode: Smallint; const Group: Smallint; const Rounds: Smallint): GamesResponse; stdcall; function gamesClub(const DevId: Integer; const DevCode: String; const Language: Smallint; const Season: Smallint; const Club: String; const Rounds: Smallint; const LatestGroupOnly: Boolean): GamesResponse; stdcall; function test(const request: LeagueRequest): LeagueResponse; stdcall; function testSimple(const DevId: Integer; const DevCode: String): LeagueResponse; stdcall; function echo(const request: String): String; stdcall; end;
function GetLeague(UseWSDL: Boolean=System.False; Addr: string=''): League;
implementation uses SOAPHTTPClient;
function GetLeague(UseWSDL: Boolean; Addr: string): League; const defWSDL = 'http://www.swissunihockey.ch/weblounge/webservices/league?wsdl'; defURL = 'http://www.swissunihockey.ch/weblounge/webservices/league'; defSvc = 'LeagueService'; defPrt = 'league'; 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 League); finally if Result = nil then RIO.Free; end; end;
destructor TableResponse.Destroy; var I: Integer; begin for I := 0 to Length(FTable)-1 do if Assigned(FTable[I]) then FTable[I].Free; SetLength(FTable, 0); inherited Destroy; end;
destructor ResultsResponse.Destroy; var I: Integer; begin for I := 0 to Length(FResults)-1 do if Assigned(FResults[I]) then FResults[I].Free; SetLength(FResults, 0); inherited Destroy; end;
destructor GamesResponse.Destroy; var I: Integer; begin for I := 0 to Length(FGames)-1 do if Assigned(FGames[I]) then FGames[I].Free; SetLength(FGames, 0); inherited Destroy; end;
initialization InvRegistry.RegisterInterface(TypeInfo(League), 'urn:league', 'UTF-8'); InvRegistry.RegisterDefaultSOAPAction(TypeInfo(League), ''); RemClassRegistry.RegisterXSClass(LeagueRequest, 'urn:league', 'LeagueRequest'); RemClassRegistry.RegisterXSClass(TableRequest, 'urn:league', 'TableRequest'); RemClassRegistry.RegisterXSClass(LeagueResponse, 'urn:league', 'LeagueResponse'); RemClassRegistry.RegisterXSClass(TableEntry, 'urn:league', 'TableEntry'); RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfTableEntry), 'urn:league', 'ArrayOfTableEntry'); RemClassRegistry.RegisterXSClass(TableResponse, 'urn:league', 'TableResponse'); RemClassRegistry.RegisterXSClass(ResultsRequest, 'urn:league', 'ResultsRequest'); RemClassRegistry.RegisterXSClass(Result, 'urn:league', 'Result'); RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfResult), 'urn:league', 'ArrayOfResult'); RemClassRegistry.RegisterXSClass(ResultsResponse, 'urn:league', 'ResultsResponse'); RemClassRegistry.RegisterXSClass(GamesRequest, 'urn:league', 'GamesRequest'); RemClassRegistry.RegisterXSClass(Game, 'urn:league', 'Game'); RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfGame), 'urn:league', 'ArrayOfGame'); RemClassRegistry.RegisterXSClass(GamesResponse, 'urn:league', 'GamesResponse');
end. |