Добро пожаловать в форум, Guest  >>   Войти | Регистрация | Поиск | Правила | В избранное | Подписаться
Все форумы / Delphi Новый топик    Ответить
 Delphi WSDL FIAS  [new]
Mediv
Member

Откуда:
Сообщений: 202
Всем привет.
На сайте налоговой есть сервис для получения информации о ФИАС.
После обновления сервиса моя программа перестала получать информацию.
Заново импортировал wsdl, но не помогло.

можно скачать описание сервиса - "https://fias.nalog.ru/Updates"
wsdl сервиса - "https://fias.nalog.ru/WebServices/Public/DownloadService.asmx"

Сформированный pas:

+
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : https://fias.nalog.ru/WebServices/Public/DownloadService.asmx
//  >Import : https://fias.nalog.ru/WebServices/Public/DownloadService.asmx>0
// Codegen  : [wfForceSOAP11+]
// (25.03.2020 11:19:04 - - $Rev: 93209 $)
// ************************************************************************ //

unit DownloadService;

interface

uses Soap.InvokeRegistry, Soap.SOAPHTTPClient, System.Types, Soap.XSBuiltIns;

const
  IS_OPTN = $0001;
  IS_UNBD = $0002;
  IS_NLBL = $0004;
  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.
  // ************************************************************************ //
  // !:long            - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:string          - "http://www.w3.org/2001/XMLSchema"[Gbl]

  DownloadFileInfo2    = class;                 { "https://fias.nalog.ru/WebServices/Public/DownloadService.asmx/"[GblCplx] }
  DownloadFileInfo     = class;                 { "https://fias.nalog.ru/WebServices/Public/DownloadService.asmx/"[GblElm] }

  ArrayOfDownloadFileInfo = array of DownloadFileInfo2;   { "https://fias.nalog.ru/WebServices/Public/DownloadService.asmx/"[GblCplx] }


  // ************************************************************************ //
  // XML       : DownloadFileInfo, global, <complexType>
  // Namespace : https://fias.nalog.ru/WebServices/Public/DownloadService.asmx/
  // ************************************************************************ //
  DownloadFileInfo2 = class(TRemotable)
  private
    FVersionId: Int64;
    FTextVersion: string;
    FTextVersion_Specified: boolean;
    FFiasCompleteDbfUrl: string;
    FFiasCompleteDbfUrl_Specified: boolean;
    FFiasCompleteXmlUrl: string;
    FFiasCompleteXmlUrl_Specified: boolean;
    FFiasDeltaDbfUrl: string;
    FFiasDeltaDbfUrl_Specified: boolean;
    FFiasDeltaXmlUrl: string;
    FFiasDeltaXmlUrl_Specified: boolean;
    FKladr4ArjUrl: string;
    FKladr4ArjUrl_Specified: boolean;
    FKladr47ZUrl: string;
    FKladr47ZUrl_Specified: boolean;
    procedure SetTextVersion(Index: Integer; const Astring: string);
    function  TextVersion_Specified(Index: Integer): boolean;
    procedure SetFiasCompleteDbfUrl(Index: Integer; const Astring: string);
    function  FiasCompleteDbfUrl_Specified(Index: Integer): boolean;
    procedure SetFiasCompleteXmlUrl(Index: Integer; const Astring: string);
    function  FiasCompleteXmlUrl_Specified(Index: Integer): boolean;
    procedure SetFiasDeltaDbfUrl(Index: Integer; const Astring: string);
    function  FiasDeltaDbfUrl_Specified(Index: Integer): boolean;
    procedure SetFiasDeltaXmlUrl(Index: Integer; const Astring: string);
    function  FiasDeltaXmlUrl_Specified(Index: Integer): boolean;
    procedure SetKladr4ArjUrl(Index: Integer; const Astring: string);
    function  Kladr4ArjUrl_Specified(Index: Integer): boolean;
    procedure SetKladr47ZUrl(Index: Integer; const Astring: string);
    function  Kladr47ZUrl_Specified(Index: Integer): boolean;
  published
    property VersionId:          Int64   read FVersionId write FVersionId;
    property TextVersion:        string  Index (IS_OPTN) read FTextVersion write SetTextVersion stored TextVersion_Specified;
    property FiasCompleteDbfUrl: string  Index (IS_OPTN) read FFiasCompleteDbfUrl write SetFiasCompleteDbfUrl stored FiasCompleteDbfUrl_Specified;
    property FiasCompleteXmlUrl: string  Index (IS_OPTN) read FFiasCompleteXmlUrl write SetFiasCompleteXmlUrl stored FiasCompleteXmlUrl_Specified;
    property FiasDeltaDbfUrl:    string  Index (IS_OPTN) read FFiasDeltaDbfUrl write SetFiasDeltaDbfUrl stored FiasDeltaDbfUrl_Specified;
    property FiasDeltaXmlUrl:    string  Index (IS_OPTN) read FFiasDeltaXmlUrl write SetFiasDeltaXmlUrl stored FiasDeltaXmlUrl_Specified;
    property Kladr4ArjUrl:       string  Index (IS_OPTN) read FKladr4ArjUrl write SetKladr4ArjUrl stored Kladr4ArjUrl_Specified;
    property Kladr47ZUrl:        string  Index (IS_OPTN) read FKladr47ZUrl write SetKladr47ZUrl stored Kladr47ZUrl_Specified;
  end;



  // ************************************************************************ //
  // XML       : DownloadFileInfo, global, <element>
  // Namespace : https://fias.nalog.ru/WebServices/Public/DownloadService.asmx/
  // ************************************************************************ //
  DownloadFileInfo = class(DownloadFileInfo2)
  private
  published
  end;


  // ************************************************************************ //
  // Namespace : https://fias.nalog.ru/WebServices/Public/DownloadService.asmx/
  // soapAction: https://fias.nalog.ru/WebServices/Public/DownloadService.asmx/%operationName%
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : document
  // use       : literal
  // binding   : BasicHttpBinding_IDownloadService
  // service   : IDownloadService
  // port      : BasicHttpBinding_IDownloadService
  // URL       : http://fias.nalog.ru/WebServices/Public/DownloadService.asmx
  // ************************************************************************ //
  IDownloadService = interface(IInvokable)
  ['{27E074B3-E3FF-E889-D5C3-0B968A60AE64}']
    function  GetAllDownloadFileInfo: ArrayOfDownloadFileInfo; stdcall;
    function  GetLastDownloadFileInfo: DownloadFileInfo2; stdcall;
  end;

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


implementation
  uses System.SysUtils;

function GetIDownloadService(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): IDownloadService;
const
  defWSDL = 'https://fias.nalog.ru/WebServices/Public/DownloadService.asmx';
  defURL  = 'http://fias.nalog.ru/WebServices/Public/DownloadService.asmx';
  defSvc  = 'IDownloadService';
  defPrt  = 'BasicHttpBinding_IDownloadService';
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 IDownloadService);
    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;


procedure DownloadFileInfo2.SetTextVersion(Index: Integer; const Astring: string);
begin
  FTextVersion := Astring;
  FTextVersion_Specified := True;
end;

function DownloadFileInfo2.TextVersion_Specified(Index: Integer): boolean;
begin
  Result := FTextVersion_Specified;
end;

procedure DownloadFileInfo2.SetFiasCompleteDbfUrl(Index: Integer; const Astring: string);
begin
  FFiasCompleteDbfUrl := Astring;
  FFiasCompleteDbfUrl_Specified := True;
end;

function DownloadFileInfo2.FiasCompleteDbfUrl_Specified(Index: Integer): boolean;
begin
  Result := FFiasCompleteDbfUrl_Specified;
end;

procedure DownloadFileInfo2.SetFiasCompleteXmlUrl(Index: Integer; const Astring: string);
begin
  FFiasCompleteXmlUrl := Astring;
  FFiasCompleteXmlUrl_Specified := True;
end;

function DownloadFileInfo2.FiasCompleteXmlUrl_Specified(Index: Integer): boolean;
begin
  Result := FFiasCompleteXmlUrl_Specified;
end;

procedure DownloadFileInfo2.SetFiasDeltaDbfUrl(Index: Integer; const Astring: string);
begin
  FFiasDeltaDbfUrl := Astring;
  FFiasDeltaDbfUrl_Specified := True;
end;

function DownloadFileInfo2.FiasDeltaDbfUrl_Specified(Index: Integer): boolean;
begin
  Result := FFiasDeltaDbfUrl_Specified;
end;

procedure DownloadFileInfo2.SetFiasDeltaXmlUrl(Index: Integer; const Astring: string);
begin
  FFiasDeltaXmlUrl := Astring;
  FFiasDeltaXmlUrl_Specified := True;
end;

function DownloadFileInfo2.FiasDeltaXmlUrl_Specified(Index: Integer): boolean;
begin
  Result := FFiasDeltaXmlUrl_Specified;
end;

procedure DownloadFileInfo2.SetKladr4ArjUrl(Index: Integer; const Astring: string);
begin
  FKladr4ArjUrl := Astring;
  FKladr4ArjUrl_Specified := True;
end;

function DownloadFileInfo2.Kladr4ArjUrl_Specified(Index: Integer): boolean;
begin
  Result := FKladr4ArjUrl_Specified;
end;

procedure DownloadFileInfo2.SetKladr47ZUrl(Index: Integer; const Astring: string);
begin
  FKladr47ZUrl := Astring;
  FKladr47ZUrl_Specified := True;
end;

function DownloadFileInfo2.Kladr47ZUrl_Specified(Index: Integer): boolean;
begin
  Result := FKladr47ZUrl_Specified;
end;

initialization
  { IDownloadService }
  InvRegistry.RegisterInterface(TypeInfo(IDownloadService), 'https://fias.nalog.ru/WebServices/Public/DownloadService.asmx/', '');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(IDownloadService), 'https://fias.nalog.ru/WebServices/Public/DownloadService.asmx/%operationName%');
  InvRegistry.RegisterInvokeOptions(TypeInfo(IDownloadService), ioDocument);
  { IDownloadService.GetAllDownloadFileInfo }
  InvRegistry.RegisterMethodInfo(TypeInfo(IDownloadService), 'GetAllDownloadFileInfo', '',
                                 '[ReturnName="GetAllDownloadFileInfoResult"]', IS_OPTN or IS_NLBL);
  InvRegistry.RegisterParamInfo(TypeInfo(IDownloadService), 'GetAllDownloadFileInfo', 'GetAllDownloadFileInfoResult', '',
                                '[ArrayItemName="DownloadFileInfo"]', IS_NLBL);
  { IDownloadService.GetLastDownloadFileInfo }
  InvRegistry.RegisterMethodInfo(TypeInfo(IDownloadService), 'GetLastDownloadFileInfo', '',
                                 '[ReturnName="GetLastDownloadFileInfoResult"]', IS_OPTN);
  RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDownloadFileInfo), 'https://fias.nalog.ru/WebServices/Public/DownloadService.asmx/', 'ArrayOfDownloadFileInfo');
  RemClassRegistry.RegisterXSClass(DownloadFileInfo2, 'https://fias.nalog.ru/WebServices/Public/DownloadService.asmx/', 'DownloadFileInfo2', 'DownloadFileInfo');
  RemClassRegistry.RegisterXSClass(DownloadFileInfo, 'https://fias.nalog.ru/WebServices/Public/DownloadService.asmx/', 'DownloadFileInfo');

end.


Пример вызова:

var
  soap: IDownloadService;
  VersionId: Int64;
begin
  soap := GetIDownloadService;
  VersionId := soap.GetLastDownloadFileInfo.VersionId;  //  <-- Ошибка!!!
end;

Ошибка:

---------------------------
Debugger Exception Notification
---------------------------
Project Project2.exe raised exception class ESOAPDomConvertError with message 'DocumentElement http://schemas.xmlsoap.org/soap/envelope/:Envelope expected, http://schemas.xmlsoap.org/wsdl/:definitions found'.
---------------------------
Break   Continue   Help   
---------------------------

Пример DownloadService.pas c сформированным api сервиса прикрепил.
Может кто поможет, как исправить?
Спасибо.

К сообщению приложен файл (DownloadService.pas - 10Kb) cкачать

Сообщение было отредактировано: 25 мар 20, 15:35
25 мар 20, 11:56    [22105594]     Ответить | Цитировать Сообщить модератору
 Re: Delphi WSDL FIAS  [new]
Kast2K
Member

Откуда: Санкт-Петербург
Сообщений: 499
Mediv,
Может поможет
https://answers.sap.com/questions/4780184/delphi-call-sap-web-service.html

Сообщение было отредактировано: 25 мар 20, 12:33
25 мар 20, 12:33    [22105634]     Ответить | Цитировать Сообщить модератору
 Re: Delphi WSDL FIAS  [new]
Mediv
Member

Откуда:
Сообщений: 202
Kast2K,

RIO.URL := defWSDL;


Спасибо, помогло.
25 мар 20, 13:07    [22105665]     Ответить | Цитировать Сообщить модератору
Все форумы / Delphi Ответить