Използване на уеб услуга - Delphi 6

Текущият ни проект е в Delphi 6. Това е първият ми опит да използвам уеб услуга в Delphi - основният ми опит в тази област е с C#. Както и да е, трябва да използвам уеб услуга от този проект. Сблъсках се с малък проблем при импортирането на wsdl (http://txportwst.txhubpr.com/txserver/1?wsdl) генерира две единици. Имаше няколко проблема с препратките към типове на единиците и зависимостите, които не позволяваха изграждането му веднага, но успях да ги коригирам.

От тестова форма добавих код за използване на услугата, но получавам грешка, която няма смисъл. Методът очаква да бъде изпратена променлива от типа (requestIVULoto), но грешката ще покаже друго. Превключих нещата към произволна услуга от xmethods.net и успях да накарам една много проста (reto. checkit.ch/Scripts/Lotto.dll/wsdl/IgetNumbers) да функционира, което ми казва, че съм на прав път, но след това друг (www. xmlme.com/WSDailyNet.asmx?WSDL), който беше малко по-сложен, не го направи и генерира същата грешка, която получавах от услугата, която трябва да използвам.

Успях да накарам услугата, която трябва да използвам, да функционира в C# с реф на услугата и 10 реда код, което е лесно, но прави Delphi още по-разочароващо. Обмислям .net class lib, изложен на com, ако това не работи. Предпочитам да направя това в Delphi, но се опасявам, че Delphi 6 е твърде стар.

Някакви идеи?

Като странична бележка, в C#..

IvuLoto.IvuSvc.ivuLotoData ild = new IvuLoto.IvuSvc.ivuLotoData();
ild = client.requestIVULoto(txn); // returns type ivuLotoData. 

Грешка

---------------------------
Debugger Exception Notification
---------------------------
Project TEST.exe raised exception class Exception with message 'The parameter is incorrect.'. Process stopped. Use Step or Run to continue.
---------------------------
OK   Help   
---------------------------

TestForm

...    
implementation

uses
  IVU, IVUSvc;
...
procedure TFormTest.Button1Click(Sender: TObject);
var
  ivu: requestIVULoto;
  txn: transaction;
  rio: THTTPRIO;
begin
  rio := THTTPRIO.Create(nil);

  rio.wsdlLocation := 'http://txportwst.txhubpr.com/txserver/1?wsdl';
  rio.Service := 'txServerService';
  rio.Port := 'txServerPort';

  txn := transaction.Create();
  txn.txDate := '08/14/2014 00:00:00';
  txn.merchantId := 'REMOVED';
  txn.terminalId := IntToStr(Workstation.WorkstationId);
  txn.terminalPassword := 'REMOVED';
  txn.txType := SALE; //IVU.txType
  txn.tenderType := CASH; //IVU.tenderType
  txn.subTotal := '100.00';
  txn.municipalTax := '1.00';
  txn.stateTax := '6.00';
  txn.total := '107.00';

  ivu := requestIVULoto.Create();
  ivu.transaction := txn;

  (rio as txServer).requestIVULoto(ivu);

  rio.Free;
  ivu.Free;
  txn.Free;
end;

Единици, генерирани от wsdl импортиране

Unit IVUSvc;

interface

uses Types, XSBuiltIns, IVU;
type

  TxServer = interface(IInvokable)
    ['{07415916-265C-448F-B69F-0AAF9CBDDC1C}']
    procedure requestIVULoto(var parameters: requestIVULoto);  stdcall;
    procedure requestTxInfo(var parameters: requestTxInfo);  stdcall;
  end;


implementation

uses InvokeRegistry;

initialization
  InvRegistry.RegisterInterface(TypeInfo(TxServer), '', 'UTF-8');

end.

и

Unit IVU;

interface

uses InvokeRegistry, Types, XSBuiltIns, XMLDoc;

type

  requestIVULoto = class;
  transaction = class;
  requestIVULotoResponse = class;
  ivuLotoData = class;
  requestTxInfo = class;
  txInfoRequest = class;
  requestTxInfoResponse = class;
  txInfoResponse = class;
  txInfo = class;



{ tenderType }

  tenderType =  (CASH, CREDIT, DEBIT, EBT, ATH, UNSPECIFIED_CARD, UNKNOWN);

{ txType }

  txType =  (SALE, REFUND);

{ txPosResponseStatus }

  txPosResponseStatus =  (SUCCESS, AUTHENTICATION_FAILED, MISSING_PARAMETERS, INVALID_PARAMETERS, SERVER_ERROR);

{ txInfoResponseStatus }

  txInfoResponseStatus =  txPosResponseStatus;//(SUCCESS, AUTHENTICATION_FAILED, MISSING_PARAMETERS, INVALID_PARAMETERS, SERVER_ERROR);

{ requestIVULoto }

  requestIVULoto = class(TRemotable)
  private
    Ftransaction: transaction;
  published
    property transaction: transaction read Ftransaction write Ftransaction;
  end;

{ transaction }

  transaction = class(TRemotable)
  private
    FmerchantId: WideString;
    FmunicipalTax: WideString;
    FstateTax: WideString;
    FsubTotal: WideString;
    FtenderType: tenderType;
    FterminalId: WideString;
    FterminalPassword: WideString;
    Ftotal: WideString;
    FtxDate: WideString;
    FtxType: txType;
  published
    property merchantId: WideString read FmerchantId write FmerchantId;
    property municipalTax: WideString read FmunicipalTax write FmunicipalTax;
    property stateTax: WideString read FstateTax write FstateTax;
    property subTotal: WideString read FsubTotal write FsubTotal;
    property tenderType: tenderType read FtenderType write FtenderType;
    property terminalId: WideString read FterminalId write FterminalId;
    property terminalPassword: WideString read FterminalPassword write FterminalPassword;
    property total: WideString read Ftotal write Ftotal;
    property txDate: WideString read FtxDate write FtxDate;
    property txType: txType read FtxType write FtxType;
  end;

{ requestIVULotoResponse }

  requestIVULotoResponse = class(TRemotable)
  private
    FIVULoto: ivuLotoData;
  published
    property IVULoto: ivuLotoData read FIVULoto write FIVULoto;
  end;

{ ivuLotoData }

  ivuLotoData = class(TRemotable)
  private
    FivuLoto: WideString;
    FcontrolNumber: WideString;
    FdrawNumber: WideString;
    FdrawDate: WideString;
    Fstatus: txPosResponseStatus;
    FerrorDetail: WideString;
  published
    property ivuLoto: WideString read FivuLoto write FivuLoto;
    property controlNumber: WideString read FcontrolNumber write FcontrolNumber;
    property drawNumber: WideString read FdrawNumber write FdrawNumber;
    property drawDate: WideString read FdrawDate write FdrawDate;
    property status: txPosResponseStatus read Fstatus write Fstatus;
    property errorDetail: WideString read FerrorDetail write FerrorDetail;
  end;

{ requestTxInfo }

  requestTxInfo = class(TRemotable)
  private
    Farg0: txInfoRequest;
  published
    property arg0: txInfoRequest read Farg0 write Farg0;
  end;

{ txInfoRequest }

  txInfoRequest = class(TRemotable)
  private
    FendDate: WideString;
    FmerchantId: WideString;
    FstartDate: WideString;
    FterminalId: WideString;
    FterminalPassword: WideString;
  published
    property endDate: WideString read FendDate write FendDate;
    property merchantId: WideString read FmerchantId write FmerchantId;
    property startDate: WideString read FstartDate write FstartDate;
    property terminalId: WideString read FterminalId write FterminalId;
    property terminalPassword: WideString read FterminalPassword write FterminalPassword;
  end;

{ requestTxInfoResponse }

  requestTxInfoResponse = class(TRemotable)
  private
    Freturn: txInfoResponse;
  published
    property return: txInfoResponse read Freturn write Freturn;
  end;

{ txInfo }

  txInfo = class(TRemotable)
  private
    FcontrolNumber: WideString;
    FdrawDate: WideString;
    FdrawNumber: WideString;
    FivuLottoNumber: WideString;
    FmunicipalTax: WideString;
    FstateTax: WideString;
    FsubTotal: WideString;
    FtenderType: tenderType;
    Ftotal: WideString;
    FtransactionDate: WideString;
    FtransactionType: txType;
  published
    property controlNumber: WideString read FcontrolNumber write FcontrolNumber;
    property drawDate: WideString read FdrawDate write FdrawDate;
    property drawNumber: WideString read FdrawNumber write FdrawNumber;
    property ivuLottoNumber: WideString read FivuLottoNumber write FivuLottoNumber;
    property municipalTax: WideString read FmunicipalTax write FmunicipalTax;
    property stateTax: WideString read FstateTax write FstateTax;
    property subTotal: WideString read FsubTotal write FsubTotal;
    property tenderType: tenderType read FtenderType write FtenderType;
    property total: WideString read Ftotal write Ftotal;
    property transactionDate: WideString read FtransactionDate write FtransactionDate;
    property transactionType: txType read FtransactionType write FtransactionType;
  end;

{ txInfoList }

  txInfoList = class(TXMLNodeCollection)
  end;

{ txInfoResponse }

  txInfoResponse = class(TRemotable)
  private
    FerrorDetail: WideString;
    FtxCount: Integer;
    Ftransactions: txInfoList;
    Fstatus: txInfoResponseStatus;
  published
    property errorDetail: WideString read FerrorDetail write FerrorDetail;
    property txCount: Integer read FtxCount write FtxCount;
    property transactions: txInfoList read Ftransactions write Ftransactions;
    property status: txInfoResponseStatus read Fstatus write Fstatus;
  end;

implementation

initialization
  RemClassRegistry.RegisterXSInfo(TypeInfo(tenderType),'http://txserver.sut.softekpr.com/1','tenderType','');
  RemClassRegistry.RegisterXSInfo(TypeInfo(txType),'http://txserver.sut.softekpr.com/1','txType','');
  RemClassRegistry.RegisterXSInfo(TypeInfo(txPosResponseStatus),'http://txserver.sut.softekpr.com/1','txPosResponseStatus','');
  RemClassRegistry.RegisterXSInfo(TypeInfo(txInfoResponseStatus),'http://txserver.sut.softekpr.com/1','txInfoResponseStatus','');
  RemClassRegistry.RegisterXSInfo(TypeInfo(requestIVULoto),'http://txserver.sut.softekpr.com/1','requestIVULoto','');
  RemClassRegistry.RegisterXSInfo(TypeInfo(requestIVULotoResponse),'http://txserver.sut.softekpr.com/1','requestIVULotoResponse','');
  RemClassRegistry.RegisterXSInfo(TypeInfo(requestTxInfo),'http://txserver.sut.softekpr.com/1','requestTxInfo','');
  RemClassRegistry.RegisterXSInfo(TypeInfo(requestTxInfoResponse),'http://txserver.sut.softekpr.com/1','requestTxInfoResponse','');
  RemClassRegistry.RegisterXSClass(requestIVULoto,'http://txserver.sut.softekpr.com/1','requestIVULoto','');
  RemClassRegistry.RegisterXSClass(transaction,'http://txserver.sut.softekpr.com/1','transaction','');
  RemClassRegistry.RegisterXSClass(requestIVULotoResponse,'http://txserver.sut.softekpr.com/1','requestIVULotoResponse','');
  RemClassRegistry.RegisterXSClass(ivuLotoData,'http://txserver.sut.softekpr.com/1','ivuLotoData','');
  RemClassRegistry.RegisterXSClass(requestTxInfo,'http://txserver.sut.softekpr.com/1','requestTxInfo','');
  RemClassRegistry.RegisterXSClass(txInfoRequest,'http://txserver.sut.softekpr.com/1','txInfoRequest','');
  RemClassRegistry.RegisterXSClass(requestTxInfoResponse,'http://txserver.sut.softekpr.com/1','requestTxInfoResponse','');
  RemClassRegistry.RegisterXSClass(txInfoResponse,'http://txserver.sut.softekpr.com/1','txInfoResponse','');
  RemClassRegistry.RegisterXSClass(txInfo,'http://txserver.sut.softekpr.com/1','txInfo','');

end.

person fourwhey    schedule 15.08.2014    source източник


Отговори (1)


Импортирах посочения от вас WSDL с помощта на Delphi XE3 и го накарах да работи без никакви модификации (ОК, признавам, промених името на модула).

Това е XML отговорът, който получих:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <ns2:requestIVULotoResponse xmlns:ns2="http://txserver.sut.softekpr.com/1">
      <IVULoto>
        <status>INVALID_PARAMETERS</status>
        <errorDetail>invalid merchantId</errorDetail>
      </IVULoto>
    </ns2:requestIVULotoResponse>
  </soap:Body>
</soap:Envelope>

Това е кодът, който използвах:

procedure TFormMain.Button1Click(Sender: TObject);
var
  req : transaction;
  rsp : ivuLotoData;
  rio : THTTPRIO;
begin
  rio := THTTPRIO.Create(Self);
  //Compile request
  req := transaction.Create();
  req.txDate := TXSDateTime.Create;// '08/14/2014 00:00:00';
  req.txDate.AsDateTime := now;
  req.txType := txtype.SALE;
  req.merchantId := 'REMOVED';
  req.terminalId := IntToStr(112233);
  req.terminalPassword := 'REMOVED';
  req.txType := txType.SALE; //IVU.txType
  req.tenderType := tenderType.CASH; //IVU.tenderType
  req.subTotal := TXSDecimal.Create;
  req.subTotal.DecimalString := '100.00';
  req.municipalTax := TXSDecimal.Create;
  req.municipalTax.DecimalString := '1.00';
  req.stateTax := TXSDecimal.Create;
  req.stateTax.DecimalString := '6.00';
  req.total := TXSDecimal.Create;
  req.total.DecimalString := '107.00';

  //Call WS Method requestIVULoto
  rsp := GetTxServer(false, '', RIO).requestIVULoto(req);

   req.Free;
  rsp.Free;
end;

Проучих вашите WSDL импортирания, но знам твърде малко за уеб услугите, за да предложа някакви модификации на вашия Delphi 6 код.

Ето импортирането на вашия WSDL от Delphi XE3. Премахнах по-голямата част от кода за внедряване, тъй като отговорът на Stack Overflow може да съдържа само 30 000 знака.:

// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : http://txportwst.txhubpr.com/txserver/1?wsdl
//  >Import : http://txportwst.txhubpr.com/txserver/1?wsdl>0
// Encoding : UTF-8
// Version  : 1.0
// (2014-08-16 08:43:38 - - $Rev: 52705 $)
// ************************************************************************ //

unit IVUSvc_wsdl;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

const
  IS_OPTN = $0001;
  IS_UNBD = $0002;
  IS_UNQL = $0008;


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.
  // ************************************************************************ //
  // !:decimal         - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:string          - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:int             - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:dateTime        - "http://www.w3.org/2001/XMLSchema"[Gbl]

  ivuLotoData          = class;                 { "http://txserver.sut.softekpr.com/1"[GblCplx] }
  txInfoResponse       = class;                 { "http://txserver.sut.softekpr.com/1"[GblCplx] }
  transaction          = class;                 { "http://txserver.sut.softekpr.com/1"[GblCplx] }
  txInfo               = class;                 { "http://txserver.sut.softekpr.com/1"[GblCplx] }
  txInfoRequest        = class;                 { "http://txserver.sut.softekpr.com/1"[GblCplx] }

  {$SCOPEDENUMS ON}
  { "http://txserver.sut.softekpr.com/1"[GblSmpl] }
  txInfoResponseStatus = (SUCCESS, AUTHENTICATION_FAILED, MISSING_PARAMETERS, INVALID_PARAMETERS, SERVER_ERROR);

  { "http://txserver.sut.softekpr.com/1"[GblSmpl] }
  txPosResponseStatus = (SUCCESS, AUTHENTICATION_FAILED, MISSING_PARAMETERS, INVALID_PARAMETERS, SERVER_ERROR);

  { "http://txserver.sut.softekpr.com/1"[GblSmpl] }
  txType = (SALE, REFUND);

  { "http://txserver.sut.softekpr.com/1"[GblSmpl] }
  tenderType = (CASH, CREDIT, DEBIT, EBT, ATH, UNSPECIFIED_CARD, UNKNOWN);

  {$SCOPEDENUMS OFF}

  Array_Of_txInfo = array of txInfo;            { "http://txserver.sut.softekpr.com/1"[GblUbnd] }


  // ************************************************************************ //
  // XML       : ivuLotoData, global, <complexType>
  // Namespace : http://txserver.sut.softekpr.com/1
  // ************************************************************************ //
  ivuLotoData = class(TRemotable)
  private
    FivuLoto: string;
    FivuLoto_Specified: boolean;
    FcontrolNumber: string;
    FcontrolNumber_Specified: boolean;
    FdrawNumber: string;
    FdrawNumber_Specified: boolean;
    FdrawDate: TXSDateTime;
    FdrawDate_Specified: boolean;
    Fstatus: txPosResponseStatus;
    Fstatus_Specified: boolean;
    FerrorDetail: string;
    FerrorDetail_Specified: boolean;
    procedure SetivuLoto(Index: Integer; const Astring: string);
    function  ivuLoto_Specified(Index: Integer): boolean;
    procedure SetcontrolNumber(Index: Integer; const Astring: string);
    function  controlNumber_Specified(Index: Integer): boolean;
    procedure SetdrawNumber(Index: Integer; const Astring: string);
    function  drawNumber_Specified(Index: Integer): boolean;
    procedure SetdrawDate(Index: Integer; const ATXSDateTime: TXSDateTime);
    function  drawDate_Specified(Index: Integer): boolean;
    procedure Setstatus(Index: Integer; const AtxPosResponseStatus: txPosResponseStatus);
    function  status_Specified(Index: Integer): boolean;
    procedure SeterrorDetail(Index: Integer; const Astring: string);
    function  errorDetail_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property ivuLoto:       string               Index (IS_OPTN or IS_UNQL) read FivuLoto write SetivuLoto stored ivuLoto_Specified;
    property controlNumber: string               Index (IS_OPTN or IS_UNQL) read FcontrolNumber write SetcontrolNumber stored controlNumber_Specified;
    property drawNumber:    string               Index (IS_OPTN or IS_UNQL) read FdrawNumber write SetdrawNumber stored drawNumber_Specified;
    property drawDate:      TXSDateTime          Index (IS_OPTN or IS_UNQL) read FdrawDate write SetdrawDate stored drawDate_Specified;
    property status:        txPosResponseStatus  Index (IS_OPTN or IS_UNQL) read Fstatus write Setstatus stored status_Specified;
    property errorDetail:   string               Index (IS_OPTN or IS_UNQL) read FerrorDetail write SeterrorDetail stored errorDetail_Specified;
  end;



  // ************************************************************************ //
  // XML       : txInfoResponse, global, <complexType>
  // Namespace : http://txserver.sut.softekpr.com/1
  // ************************************************************************ //
  txInfoResponse = class(TRemotable)
  private
    FerrorDetail: string;
    FerrorDetail_Specified: boolean;
    FtxCount: Integer;
    Ftransactions: Array_Of_txInfo;
    Ftransactions_Specified: boolean;
    Fstatus: txInfoResponseStatus;
    Fstatus_Specified: boolean;
    procedure SeterrorDetail(Index: Integer; const Astring: string);
    function  errorDetail_Specified(Index: Integer): boolean;
    procedure Settransactions(Index: Integer; const AArray_Of_txInfo: Array_Of_txInfo);
    function  transactions_Specified(Index: Integer): boolean;
    procedure Setstatus(Index: Integer; const AtxInfoResponseStatus: txInfoResponseStatus);
    function  status_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property errorDetail:  string                Index (IS_OPTN or IS_UNQL) read FerrorDetail write SeterrorDetail stored errorDetail_Specified;
    property txCount:      Integer               Index (IS_UNQL) read FtxCount write FtxCount;
    property transactions: Array_Of_txInfo       Index (IS_OPTN or IS_UNBD or IS_UNQL) read Ftransactions write Settransactions stored transactions_Specified;
    property status:       txInfoResponseStatus  Index (IS_OPTN or IS_UNQL) read Fstatus write Setstatus stored status_Specified;
  end;



  // ************************************************************************ //
  // XML       : transaction, global, <complexType>
  // Namespace : http://txserver.sut.softekpr.com/1
  // ************************************************************************ //
  transaction = class(TRemotable)
  private
    FmerchantId: string;
    FmerchantId_Specified: boolean;
    FmunicipalTax: TXSDecimal;
    FmunicipalTax_Specified: boolean;
    FstateTax: TXSDecimal;
    FstateTax_Specified: boolean;
    FsubTotal: TXSDecimal;
    FsubTotal_Specified: boolean;
    FtenderType: tenderType;
    FtenderType_Specified: boolean;
    FterminalId: string;
    FterminalId_Specified: boolean;
    FterminalPassword: string;
    FterminalPassword_Specified: boolean;
    Ftotal: TXSDecimal;
    Ftotal_Specified: boolean;
    FtxDate: TXSDateTime;
    FtxDate_Specified: boolean;
    FtxType: txType;
    FtxType_Specified: boolean;
    procedure SetmerchantId(Index: Integer; const Astring: string);
    function  merchantId_Specified(Index: Integer): boolean;
    procedure SetmunicipalTax(Index: Integer; const ATXSDecimal: TXSDecimal);
    function  municipalTax_Specified(Index: Integer): boolean;
    procedure SetstateTax(Index: Integer; const ATXSDecimal: TXSDecimal);
    function  stateTax_Specified(Index: Integer): boolean;
    procedure SetsubTotal(Index: Integer; const ATXSDecimal: TXSDecimal);
    function  subTotal_Specified(Index: Integer): boolean;
    procedure SettenderType(Index: Integer; const AtenderType: tenderType);
    function  tenderType_Specified(Index: Integer): boolean;
    procedure SetterminalId(Index: Integer; const Astring: string);
    function  terminalId_Specified(Index: Integer): boolean;
    procedure SetterminalPassword(Index: Integer; const Astring: string);
    function  terminalPassword_Specified(Index: Integer): boolean;
    procedure Settotal(Index: Integer; const ATXSDecimal: TXSDecimal);
    function  total_Specified(Index: Integer): boolean;
    procedure SettxDate(Index: Integer; const ATXSDateTime: TXSDateTime);
    function  txDate_Specified(Index: Integer): boolean;
    procedure SettxType(Index: Integer; const AtxType: txType);
    function  txType_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property merchantId:       string       Index (IS_OPTN or IS_UNQL) read FmerchantId write SetmerchantId stored merchantId_Specified;
    property municipalTax:     TXSDecimal   Index (IS_OPTN or IS_UNQL) read FmunicipalTax write SetmunicipalTax stored municipalTax_Specified;
    property stateTax:         TXSDecimal   Index (IS_OPTN or IS_UNQL) read FstateTax write SetstateTax stored stateTax_Specified;
    property subTotal:         TXSDecimal   Index (IS_OPTN or IS_UNQL) read FsubTotal write SetsubTotal stored subTotal_Specified;
    property tenderType:       tenderType   Index (IS_OPTN or IS_UNQL) read FtenderType write SettenderType stored tenderType_Specified;
    property terminalId:       string       Index (IS_OPTN or IS_UNQL) read FterminalId write SetterminalId stored terminalId_Specified;
    property terminalPassword: string       Index (IS_OPTN or IS_UNQL) read FterminalPassword write SetterminalPassword stored terminalPassword_Specified;
    property total:            TXSDecimal   Index (IS_OPTN or IS_UNQL) read Ftotal write Settotal stored total_Specified;
    property txDate:           TXSDateTime  Index (IS_OPTN or IS_UNQL) read FtxDate write SettxDate stored txDate_Specified;
    property txType:           txType       Index (IS_OPTN or IS_UNQL) read FtxType write SettxType stored txType_Specified;
  end;



  // ************************************************************************ //
  // XML       : txInfo, global, <complexType>
  // Namespace : http://txserver.sut.softekpr.com/1
  // ************************************************************************ //
  txInfo = class(TRemotable)
  private
    FcontrolNumber: string;
    FcontrolNumber_Specified: boolean;
    FdrawDate: TXSDateTime;
    FdrawDate_Specified: boolean;
    FdrawNumber: string;
    FdrawNumber_Specified: boolean;
    FivuLottoNumber: string;
    FivuLottoNumber_Specified: boolean;
    FmunicipalTax: TXSDecimal;
    FmunicipalTax_Specified: boolean;
    FstateTax: TXSDecimal;
    FstateTax_Specified: boolean;
    FsubTotal: TXSDecimal;
    FsubTotal_Specified: boolean;
    FtenderType: tenderType;
    FtenderType_Specified: boolean;
    Ftotal: TXSDecimal;
    Ftotal_Specified: boolean;
    FtransactionDate: TXSDateTime;
    FtransactionDate_Specified: boolean;
    FtransactionType: txType;
    FtransactionType_Specified: boolean;
    procedure SetcontrolNumber(Index: Integer; const Astring: string);
    function  controlNumber_Specified(Index: Integer): boolean;
    procedure SetdrawDate(Index: Integer; const ATXSDateTime: TXSDateTime);
    function  drawDate_Specified(Index: Integer): boolean;
    procedure SetdrawNumber(Index: Integer; const Astring: string);
    function  drawNumber_Specified(Index: Integer): boolean;
    procedure SetivuLottoNumber(Index: Integer; const Astring: string);
    function  ivuLottoNumber_Specified(Index: Integer): boolean;
    procedure SetmunicipalTax(Index: Integer; const ATXSDecimal: TXSDecimal);
    function  municipalTax_Specified(Index: Integer): boolean;
    procedure SetstateTax(Index: Integer; const ATXSDecimal: TXSDecimal);
    function  stateTax_Specified(Index: Integer): boolean;
    procedure SetsubTotal(Index: Integer; const ATXSDecimal: TXSDecimal);
    function  subTotal_Specified(Index: Integer): boolean;
    procedure SettenderType(Index: Integer; const AtenderType: tenderType);
    function  tenderType_Specified(Index: Integer): boolean;
    procedure Settotal(Index: Integer; const ATXSDecimal: TXSDecimal);
    function  total_Specified(Index: Integer): boolean;
    procedure SettransactionDate(Index: Integer; const ATXSDateTime: TXSDateTime);
    function  transactionDate_Specified(Index: Integer): boolean;
    procedure SettransactionType(Index: Integer; const AtxType: txType);
    function  transactionType_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property controlNumber:   string       Index (IS_OPTN or IS_UNQL) read FcontrolNumber write SetcontrolNumber stored controlNumber_Specified;
    property drawDate:        TXSDateTime  Index (IS_OPTN or IS_UNQL) read FdrawDate write SetdrawDate stored drawDate_Specified;
    property drawNumber:      string       Index (IS_OPTN or IS_UNQL) read FdrawNumber write SetdrawNumber stored drawNumber_Specified;
    property ivuLottoNumber:  string       Index (IS_OPTN or IS_UNQL) read FivuLottoNumber write SetivuLottoNumber stored ivuLottoNumber_Specified;
    property municipalTax:    TXSDecimal   Index (IS_OPTN or IS_UNQL) read FmunicipalTax write SetmunicipalTax stored municipalTax_Specified;
    property stateTax:        TXSDecimal   Index (IS_OPTN or IS_UNQL) read FstateTax write SetstateTax stored stateTax_Specified;
    property subTotal:        TXSDecimal   Index (IS_OPTN or IS_UNQL) read FsubTotal write SetsubTotal stored subTotal_Specified;
    property tenderType:      tenderType   Index (IS_OPTN or IS_UNQL) read FtenderType write SettenderType stored tenderType_Specified;
    property total:           TXSDecimal   Index (IS_OPTN or IS_UNQL) read Ftotal write Settotal stored total_Specified;
    property transactionDate: TXSDateTime  Index (IS_OPTN or IS_UNQL) read FtransactionDate write SettransactionDate stored transactionDate_Specified;
    property transactionType: txType       Index (IS_OPTN or IS_UNQL) read FtransactionType write SettransactionType stored transactionType_Specified;
  end;



  // ************************************************************************ //
  // XML       : txInfoRequest, global, <complexType>
  // Namespace : http://txserver.sut.softekpr.com/1
  // ************************************************************************ //
  txInfoRequest = class(TRemotable)
  private
    FendDate: TXSDateTime;
    FendDate_Specified: boolean;
    FmerchantId: string;
    FmerchantId_Specified: boolean;
    FstartDate: TXSDateTime;
    FstartDate_Specified: boolean;
    FterminalId: string;
    FterminalId_Specified: boolean;
    FterminalPassword: string;
    FterminalPassword_Specified: boolean;
    procedure SetendDate(Index: Integer; const ATXSDateTime: TXSDateTime);
    function  endDate_Specified(Index: Integer): boolean;
    procedure SetmerchantId(Index: Integer; const Astring: string);
    function  merchantId_Specified(Index: Integer): boolean;
    procedure SetstartDate(Index: Integer; const ATXSDateTime: TXSDateTime);
    function  startDate_Specified(Index: Integer): boolean;
    procedure SetterminalId(Index: Integer; const Astring: string);
    function  terminalId_Specified(Index: Integer): boolean;
    procedure SetterminalPassword(Index: Integer; const Astring: string);
    function  terminalPassword_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property endDate:          TXSDateTime  Index (IS_OPTN or IS_UNQL) read FendDate write SetendDate stored endDate_Specified;
    property merchantId:       string       Index (IS_OPTN or IS_UNQL) read FmerchantId write SetmerchantId stored merchantId_Specified;
    property startDate:        TXSDateTime  Index (IS_OPTN or IS_UNQL) read FstartDate write SetstartDate stored startDate_Specified;
    property terminalId:       string       Index (IS_OPTN or IS_UNQL) read FterminalId write SetterminalId stored terminalId_Specified;
    property terminalPassword: string       Index (IS_OPTN or IS_UNQL) read FterminalPassword write SetterminalPassword stored terminalPassword_Specified;
  end;


  // ************************************************************************ //
  // Namespace : http://txserver.sut.softekpr.com/1
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : document
  // use       : literal
  // binding   : TxServerServiceSoapBinding
  // service   : TxServerService
  // port      : TxServerPort
  // URL       : http://txportwst.txhubpr.com/txserver/1
  // ************************************************************************ //
  TxServer = interface(IInvokable)
  ['{FA236F41-8840-15A4-8F74-1E1583384A66}']
    function  requestIVULoto(const transaction: transaction): ivuLotoData; stdcall;
    function  requestTxInfo(const arg0: txInfoRequest): txInfoResponse; stdcall;
  end;

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


implementation
  uses SysUtils;

function GetTxServer(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): TxServer;
const
  defWSDL = 'http://txportwst.txhubpr.com/txserver/1?wsdl';
  defURL  = 'http://txportwst.txhubpr.com/txserver/1';
  defSvc  = 'TxServerService';
  defPrt  = 'TxServerPort';
var
  RIO: THTTPRIO;
begin
  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 TxServer);
    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;


//I removed implementation because Stack Overflow answer can only contain 30000 characters 

initialization
  { TxServer }
  InvRegistry.RegisterInterface(TypeInfo(TxServer), 'http://txserver.sut.softekpr.com/1', 'UTF-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(TxServer), '');
  InvRegistry.RegisterInvokeOptions(TypeInfo(TxServer), ioDocument);
  { TxServer.requestIVULoto }
  InvRegistry.RegisterMethodInfo(TypeInfo(TxServer), 'requestIVULoto', '',
                                 '[ReturnName="IVULoto"]', IS_OPTN or IS_UNQL);
  InvRegistry.RegisterParamInfo(TypeInfo(TxServer), 'requestIVULoto', 'transaction', '',
                                '', IS_UNQL);
  InvRegistry.RegisterParamInfo(TypeInfo(TxServer), 'requestIVULoto', 'IVULoto', '',
                                '', IS_UNQL);
  { TxServer.requestTxInfo }
  InvRegistry.RegisterMethodInfo(TypeInfo(TxServer), 'requestTxInfo', '',
                                 '[ReturnName="return"]', IS_OPTN or IS_UNQL);
  InvRegistry.RegisterParamInfo(TypeInfo(TxServer), 'requestTxInfo', 'arg0', '',
                                '', IS_UNQL);
  InvRegistry.RegisterParamInfo(TypeInfo(TxServer), 'requestTxInfo', 'return', '',
                                '', IS_UNQL);
  RemClassRegistry.RegisterXSInfo(TypeInfo(txInfoResponseStatus), 'http://txserver.sut.softekpr.com/1', 'txInfoResponseStatus');
  RemClassRegistry.RegisterXSInfo(TypeInfo(Array_Of_txInfo), 'http://txserver.sut.softekpr.com/1', 'Array_Of_txInfo');
  RemClassRegistry.RegisterXSInfo(TypeInfo(txPosResponseStatus), 'http://txserver.sut.softekpr.com/1', 'txPosResponseStatus');
  RemClassRegistry.RegisterXSInfo(TypeInfo(txType), 'http://txserver.sut.softekpr.com/1', 'txType');
  RemClassRegistry.RegisterXSClass(ivuLotoData, 'http://txserver.sut.softekpr.com/1', 'ivuLotoData');
  RemClassRegistry.RegisterXSClass(txInfoResponse, 'http://txserver.sut.softekpr.com/1', 'txInfoResponse');
  RemClassRegistry.RegisterXSInfo(TypeInfo(tenderType), 'http://txserver.sut.softekpr.com/1', 'tenderType');
  RemClassRegistry.RegisterXSClass(transaction, 'http://txserver.sut.softekpr.com/1', 'transaction');
  RemClassRegistry.RegisterXSClass(txInfo, 'http://txserver.sut.softekpr.com/1', 'txInfo');
  RemClassRegistry.RegisterXSClass(txInfoRequest, 'http://txserver.sut.softekpr.com/1', 'txInfoRequest');

end.
person Lars    schedule 16.08.2014
comment
Благодаря ви, че опитахте. Страхът ми, че проблемът е D6, се оправда. ???? Предполагам, че трябва да надстроя проекта в даден момент. Толкова много отхвърлени контроли обаче. Com или shellexec идвам. - person fourwhey; 18.08.2014