AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Webservice: Konvertierungsproblem D6
Thema durchsuchen
Ansicht
Themen-Optionen

Webservice: Konvertierungsproblem D6

Ein Thema von guldi · begonnen am 30. Jul 2007
Antwort Antwort
guldi

Registriert seit: 30. Jul 2007
1 Beiträge
 
#1

Webservice: Konvertierungsproblem D6

  Alt 30. Jul 2007, 10:05
Hallo Zusammen

Ich bin am verzweifeln. Ich versuche mit D6E auf den Webservice von Swissunihockey zuzugreifen. Habe die WSDL Datei importiert und die "Echo-Funktion" funktioniert einwandfrei. Jedoch wenn ich die anderen Funktionen versuche, bricht dass Programm ab, weil dieses ein leeren String versucht in eine Zahl zu Wandeln. Kann mir da jemand weiter helfen?

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, league1;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var lg: league;
    s: string;
    lr : LeagueResponse;
    tr : TableResponse;
begin
    lg := getLeague(false);
    lr := lg.testSimple(1240,'AjxsUNpBeKKfjaKSTcIwRzC2fiM=');
    s := lg.echo('test');
    tr := lg.TableLeague(1240,'AjxsUNpBeKKfjaKSTcIwRzC2fiM=',0,0,111,1);
    memo1.Text := lr.ServiceImplementation + lr.Copyright + tr.Disclaimer;
end;

end.
Delphi-Quellcode:
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : [url]http://www.swissunihockey.ch/weblounge/webservices/league?wsdl[/url]
// Encoding : UTF-8
// Codegen : [wfDebug,wfVerbose,wfSkipHttpBindings,wfAmbiguousComplexTypesAsArray,wfOutputLiteralTypes,wfIgnoreSchemaErrors,wfSkipUnusedTypes]
// Version : 1.0
// (19.07.2007 13:32:49 - $Revision: 1.9.1.0.1.0.1.9 $)
// ************************************************************************ //
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;



  // ************************************************************************ //
  // Namespace : urn:league
  // ************************************************************************ //
  LeagueRequest = class(TRemotable)
  private
    FDevId: Integer;
    FDevCode: String;
  published
    property DevId: Integer read FDevId write FDevId;
    property DevCode: String read FDevCode write FDevCode;
  end;



  // ************************************************************************ //
  // Namespace : urn:league
  // ************************************************************************ //
  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;



  // ************************************************************************ //
  // Namespace : urn:league
  // ************************************************************************ //
  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;



  // ************************************************************************ //
  // Namespace : urn:league
  // ************************************************************************ //
  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;


  // ************************************************************************ //
  // Namespace : urn:league
  // ************************************************************************ //
  TableResponse = class(LeagueResponse)
  private
    FTable: ArrayOfTableEntry;
  public
    destructor Destroy; override;
  published
    property Table: ArrayOfTableEntry read FTable write FTable;
  end;



  // ************************************************************************ //
  // Namespace : urn:league
  // ************************************************************************ //
  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;



  // ************************************************************************ //
  // Namespace : urn:league
  // ************************************************************************ //
  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;


  // ************************************************************************ //
  // Namespace : urn:league
  // ************************************************************************ //
  ResultsResponse = class(LeagueResponse)
  private
    FResults: ArrayOfResult;
  public
    destructor Destroy; override;
  published
    property Results: ArrayOfResult read FResults write FResults;
  end;



  // ************************************************************************ //
  // Namespace : urn:league
  // ************************************************************************ //
  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;



  // ************************************************************************ //
  // Namespace : urn:league
  // ************************************************************************ //
  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;


  // ************************************************************************ //
  // Namespace : urn:league
  // ************************************************************************ //
  GamesResponse = class(LeagueResponse)
  private
    FGames: ArrayOfGame;
  public
    destructor Destroy; override;
  published
    property Games: ArrayOfGame read FGames write FGames;
  end;



  // ************************************************************************ //
  // Namespace : urn:league
  // ************************************************************************ //
  ScorerResponse = class(LeagueResponse)
  private
  published
  end;



  // ************************************************************************ //
  // Namespace : urn:league
  // ************************************************************************ //
  ScorerRequest = class(LeagueRequest)
  private
  published
  end;


  // ************************************************************************ //
  // Namespace : urn:league
  // transport : [url]http://schemas.xmlsoap.org/soap/http[/url]
  // style : rpc
  // binding : leagueSoapBinding
  // service : LeagueService
  // port : league
  // URL : [url]http://www.swissunihockey.ch/weblounge/webservices/league[/url]
  // ************************************************************************ //
  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.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:22 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz