soozh
asked on
Delphi 2010 - consuming a web service
Hello,
I am using Delphi 2010 and imported a webservice. See the attached code. (Note I have only included the interface.)
The question is how do I call any of the methods.... everything seems to have changed since Delphi 6!!
Can anyone give me an axample on how to call GetVersion?
I am using Delphi 2010 and imported a webservice. See the attached code. (Note I have only included the interface.)
The question is how do I call any of the methods.... everything seems to have changed since Delphi 6!!
Can anyone give me an axample on how to call GetVersion?
unit gnasher.wspoppis;
interface
uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;
const
IS_OPTN = $0001;
IS_REF = $0080;
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 Embarcadero 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"[Gbl]
// !:boolean - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:int - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:long - "http://www.w3.org/2001/XMLSchema"[Gbl]
GetVersion = class; { "http://Gnasher.Poppis.org/"[Lit][GblElm] }
GetVersionResponse = class; { "http://Gnasher.Poppis.org/"[Lit][GblElm] }
HelloWorld = class; { "http://Gnasher.Poppis.org/"[Lit][GblElm] }
HelloWorldResponse = class; { "http://Gnasher.Poppis.org/"[Lit][GblElm] }
GetPerson = class; { "http://Gnasher.Poppis.org/"[Lit][GblElm] }
GetPersonResponse = class; { "http://Gnasher.Poppis.org/"[Lit][GblElm] }
HeaderInfo = class; { "http://www.tietoenator.com/HCW/PopulationManager"[GblCplx] }
HeaderInfo2 = class; { "http://www.tietoenator.com/HCW/PopulationManager"[GblElm] }
HeaderErrorInfo = class; { "http://www.tietoenator.com/HCW/PopulationManager"[GblCplx] }
HeaderErrorInfo2 = class; { "http://www.tietoenator.com/HCW/PopulationManager"[GblElm] }
{$SCOPEDENUMS ON}
{ "http://www.tietoenator.com/HCW/PopulationManager"[GblSmpl] }
EnumTEHCHeaderSeverity = (None, Critical, Warning, Information);
{$SCOPEDENUMS OFF}
// ************************************************************************ //
// XML : GetVersion, global, <element>
// Namespace : http://Gnasher.Poppis.org/
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
GetVersion = class(TRemotable)
private
public
constructor Create; override;
published
end;
// ************************************************************************ //
// XML : GetVersionResponse, global, <element>
// Namespace : http://Gnasher.Poppis.org/
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
GetVersionResponse = class(TRemotable)
private
FGetVersionResult: string;
FGetVersionResult_Specified: boolean;
procedure SetGetVersionResult(Index: Integer; const Astring: string);
function GetVersionResult_Specified(Index: Integer): boolean;
public
constructor Create; override;
published
property GetVersionResult: string Index (IS_OPTN) read FGetVersionResult write SetGetVersionResult stored GetVersionResult_Specified;
end;
// ************************************************************************ //
// XML : HelloWorld, global, <element>
// Namespace : http://Gnasher.Poppis.org/
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
HelloWorld = class(TRemotable)
private
public
constructor Create; override;
published
end;
// ************************************************************************ //
// XML : HelloWorldResponse, global, <element>
// Namespace : http://Gnasher.Poppis.org/
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
HelloWorldResponse = class(TRemotable)
private
FHelloWorldResult: string;
FHelloWorldResult_Specified: boolean;
procedure SetHelloWorldResult(Index: Integer; const Astring: string);
function HelloWorldResult_Specified(Index: Integer): boolean;
public
constructor Create; override;
published
property HelloWorldResult: string Index (IS_OPTN) read FHelloWorldResult write SetHelloWorldResult stored HelloWorldResult_Specified;
end;
// ************************************************************************ //
// XML : GetPerson, global, <element>
// Namespace : http://Gnasher.Poppis.org/
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
GetPerson = class(TRemotable)
private
FUserid: string;
FUserid_Specified: boolean;
FPassword: string;
FPassword_Specified: boolean;
FPID: string;
FPID_Specified: boolean;
FotherArchives: Boolean;
procedure SetUserid(Index: Integer; const Astring: string);
function Userid_Specified(Index: Integer): boolean;
procedure SetPassword(Index: Integer; const Astring: string);
function Password_Specified(Index: Integer): boolean;
procedure SetPID(Index: Integer; const Astring: string);
function PID_Specified(Index: Integer): boolean;
public
constructor Create; override;
published
property Userid: string Index (IS_OPTN) read FUserid write SetUserid stored Userid_Specified;
property Password: string Index (IS_OPTN) read FPassword write SetPassword stored Password_Specified;
property PID: string Index (IS_OPTN) read FPID write SetPID stored PID_Specified;
property otherArchives: Boolean read FotherArchives write FotherArchives;
end;
// ************************************************************************ //
// XML : GetPersonResponse, global, <element>
// Namespace : http://Gnasher.Poppis.org/
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
GetPersonResponse = class(TRemotable)
private
FGetPersonResult: string;
FGetPersonResult_Specified: boolean;
FHeaderInfo: HeaderInfo2;
FHeaderInfo_Specified: boolean;
FHeaderErrorInfo: HeaderErrorInfo2;
FHeaderErrorInfo_Specified: boolean;
procedure SetGetPersonResult(Index: Integer; const Astring: string);
function GetPersonResult_Specified(Index: Integer): boolean;
procedure SetHeaderInfo(Index: Integer; const AHeaderInfo2: HeaderInfo2);
function HeaderInfo_Specified(Index: Integer): boolean;
procedure SetHeaderErrorInfo(Index: Integer; const AHeaderErrorInfo2: HeaderErrorInfo2);
function HeaderErrorInfo_Specified(Index: Integer): boolean;
public
constructor Create; override;
destructor Destroy; override;
published
property GetPersonResult: string Index (IS_OPTN) read FGetPersonResult write SetGetPersonResult stored GetPersonResult_Specified;
property HeaderInfo: HeaderInfo2 Index (IS_OPTN or IS_REF) read FHeaderInfo write SetHeaderInfo stored HeaderInfo_Specified;
property HeaderErrorInfo: HeaderErrorInfo2 Index (IS_OPTN or IS_REF) read FHeaderErrorInfo write SetHeaderErrorInfo stored HeaderErrorInfo_Specified;
end;
// ************************************************************************ //
// XML : HeaderInfo, global, <complexType>
// Namespace : http://www.tietoenator.com/HCW/PopulationManager
// ************************************************************************ //
HeaderInfo = class(TRemotable)
private
FRowsCount: Integer;
FMaxRows: Integer;
FSourceName: string;
FSourceName_Specified: boolean;
procedure SetSourceName(Index: Integer; const Astring: string);
function SourceName_Specified(Index: Integer): boolean;
published
property RowsCount: Integer read FRowsCount write FRowsCount;
property MaxRows: Integer read FMaxRows write FMaxRows;
property SourceName: string Index (IS_OPTN) read FSourceName write SetSourceName stored SourceName_Specified;
end;
// ************************************************************************ //
// XML : HeaderInfo, global, <element>
// Namespace : http://www.tietoenator.com/HCW/PopulationManager
// ************************************************************************ //
HeaderInfo2 = class(HeaderInfo)
private
published
end;
// ************************************************************************ //
// XML : HeaderErrorInfo, global, <complexType>
// Namespace : http://www.tietoenator.com/HCW/PopulationManager
// ************************************************************************ //
HeaderErrorInfo = class(TRemotable)
private
FFunctionName: string;
FFunctionName_Specified: boolean;
FSeverity: EnumTEHCHeaderSeverity;
FErrorType: string;
FErrorType_Specified: boolean;
FModuleName: string;
FModuleName_Specified: boolean;
FDescription: string;
FDescription_Specified: boolean;
FCode: Int64;
procedure SetFunctionName(Index: Integer; const Astring: string);
function FunctionName_Specified(Index: Integer): boolean;
procedure SetErrorType(Index: Integer; const Astring: string);
function ErrorType_Specified(Index: Integer): boolean;
procedure SetModuleName(Index: Integer; const Astring: string);
function ModuleName_Specified(Index: Integer): boolean;
procedure SetDescription(Index: Integer; const Astring: string);
function Description_Specified(Index: Integer): boolean;
published
property FunctionName: string Index (IS_OPTN) read FFunctionName write SetFunctionName stored FunctionName_Specified;
property Severity: EnumTEHCHeaderSeverity read FSeverity write FSeverity;
property ErrorType: string Index (IS_OPTN) read FErrorType write SetErrorType stored ErrorType_Specified;
property ModuleName: string Index (IS_OPTN) read FModuleName write SetModuleName stored ModuleName_Specified;
property Description: string Index (IS_OPTN) read FDescription write SetDescription stored Description_Specified;
property Code: Int64 read FCode write FCode;
end;
// ************************************************************************ //
// XML : HeaderErrorInfo, global, <element>
// Namespace : http://www.tietoenator.com/HCW/PopulationManager
// ************************************************************************ //
HeaderErrorInfo2 = class(HeaderErrorInfo)
private
published
end;
// ************************************************************************ //
// Namespace : http://Gnasher.Poppis.org/
// soapAction: http://Gnasher.Poppis.org/%operationName%
// transport : http://schemas.xmlsoap.org/soap/http
// style : document
// binding : serviceSoap12
// service : service
// port : serviceSoap12
// URL : https://www.eyenetreg.se/gnasher.wspoppis/gnasher.wspoppis.asmx
// ************************************************************************ //
serviceSoap = interface(IInvokable)
['{FCC6D8CB-730F-EBD0-3AE1-6C47631A8069}']
function GetVersion(const parameters: GetVersion): GetVersionResponse; stdcall;
function HelloWorld(const parameters: HelloWorld): HelloWorldResponse; stdcall;
// Cannot unwrap:
// - More than one strictly out element was found
function GetPerson(const parameters: GetPerson): GetPersonResponse; stdcall;
end;
function GetserviceSoap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): serviceSoap;
ASKER
Hello,
Yep that worked... so can you explain what the "nil" is for? and why is it not possible to call
ShowMessage( GetserviceSoap.GetVersion( ) );
Yep that worked... so can you explain what the "nil" is for? and why is it not possible to call
ShowMessage( GetserviceSoap.GetVersion(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK.
Then how would I call GetPerson which requires the parameters PID and otherArchives. It also returns a complex result in the form of GetPersonResponse.
Then how would I call GetPerson which requires the parameters PID and otherArchives. It also returns a complex result in the form of GetPersonResponse.
ASKER
I worked out the rest myself...
procedure TForm1.Button1Click(Sender
begin
ShowMessage(GetserviceSoap
end;