SOAP как разобрать ответ

Roman_80
Дата: 29.04.2011 13:05:35
Кто сталкивался? Помогите пожалуйста

procedure TForm1.btn7Click(Sender: TObject);
var
 ResponseStream1: TStringStream;
 PostStream     : TStringStream;
 XMLTEXT, sAttach:string;
begin
 ResponseStream:=TIdMultiPartFormDataStream.Create;
 ResponseStream1:=   TStringStream.Create('');
 PostStream :=   TStringStream.Create('');

 XMLTEXT:=
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://dsi.ws.rjd.ru/schemas"> '+#10+#13+
'   <soapenv:Header/> '+#10+#13+
'   <soapenv:Body> '+#10+#13+
'      <sch:GetActByIdRequest> '+#10+#13+
'         <sch:login>chuma</sch:login> '+#10+#13+
'         <sch:password>100026</sch:password> '+#10+#13+
'         <sch:actId>569189</sch:actId> '+#10+#13+
'      </sch:GetActByIdRequest> '+#10+#13+
'   </soapenv:Body> '+#10+#13+
'</soapenv:Envelope> ';


 try
   PostStream.Position:=0;
   PostStream.WriteString(XMLTEXT);
   idhtp1.post('http://172.16.0.24:8081/ACTROOT/',PostStream,  responsestream1);
   Mmo1.Lines.Add(idhtp1.ResponseText);
   Mmo1.Lines.Add(Utf8ToAnsi(ResponseStream1.DataString));
   
  finally
     ResponseStream1.Free;
     PostStream.Free;
  end;

end;

получаю в ответ

+
'------=_Part_10_2026519457.1304066497731'#$D#$A'Content-Type: text/xml; charset=utf-8'#$D#$A#$D#$A'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><sch:GetActByIdResponse xmlns:sch="http://dsi.ws.rjd.ru/schemas"><sch:actId>569189</sch:actId><sch:result>OK</sch:result><sch:warnings><sch:warning><sch:warningCode>NO_FGP_SIGN</sch:warningCode><sch:warningDsc>РђРєС‚ РЅРµ подписан ФГП Р’Рћ ЖДТ</sch:warningDsc></sch:warning></sch:warnings></sch:GetActByIdResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>'#$D#$A'------=_Part_10_2026519457.1304066497731'#$D#$A'Content-Type: application/octet-stream'#$D#$A'Content-ID: act.zip'#$D#$A'Content-Transfer-Encoding: binary'#$D#$A#$D#$A'PK'#3#4#$14#0#8#0#8#0'ЅЊ–>'#0#0#0#0#0#0#0#0#0#0#0#0#$B#0#0#0'report.docxнјUt$IІ-љbfff(13S‰'#$19'KММММ¬'#$12'іTbfffV‰™™JфЄgОЬййЫзы~јЩ№VF¤G˜ЇфМmжжжf!/'#$D#2'Љ'#$A#0#0' '#1'к‘)|5”'#$1A#$19'БА'#0'@'#1'('#0'Ђш»ХИЦPЮБЦОс‹ѕЎ'#$13'Ѕ›µ•·т¤Нј'#0'"_а'#0'7¦^|g»‹Пщ€3'#$18'hЎT'#$11'„"iUJ§3ЖаЩИ'#$19'щE%њ'#$1D'p'#$15#$1A#5'ј'#4'nј¦H‘b®wр'#3'Н5йD'#$15#$1E'ЕIћT’[ЧЛaFN–sЌ{Zt4'#$15#$1D'ишK€¤•'#$15'vТ°{џ[›~Чљ·ЌыЎЙу¶'#$F'в`‘=еЉАА+KdУ'#$1D#7'µуЂЏ†,8$YА*і>†-r;‡'#0'«$&ў'#$11'AД'#0#$B'!'#$14'†k"О'#$1C' Ўa`ХКdZ›ы‹вю7™™3Њu’Й&L'#$C'г'#1'C'#$B'!л'`џё`'#$1F'їm№'#$C'Iе№™^P­'#$16'K};КЬGy¤РЫтЋRЩІЦЋ'#$14'ю2„ЫTў/'#7#4'о$Хе{'#$16'рFЫf'#$E'о,yZ’'#$12'o>~§¦pМЊQu”E;є,и,'#2'С'#$1B'¤Я$W'#6'сдхY=™b'#$C'°ЫЁЗї>4Ґ«'#$11'Ђ'#$14'2^|]M‚ПkЎ`СЎrKu'#3'‰Ъy…tЭf'#$17' ih¬1еСЂ№і'#$D'¦3з’Iъ5#–D1'#$13'yе'#9'*QѕЌ}aМЈRБ§Є(m%ёfљ'#8'Eз’'#$1F#$15'r'#$1B'щ'#$B'і˜''#$19'г¶щ'#$D'*сЌґє'#$C'%н'#4'L=uQ{r'#9'4Щ8'#$E'ќКLfхѕiЊЭќ|ъ@Г№'#2#$1E'R№jџ,ЄЪ'#3'aОT'#$A'ЧП’ЈЖСп'#$13'Ш'#$1A'ѕ/zF‘S'#$A'FЉylьz«]iN'#$1C'Ю'#$1F#8'K~(у[PшБ·F'#$C':йaћ'#6'ZЮU…'#$D#$1A'–У{/!а'#6'xMХqъИ°'#$1B'ј'#$15'.BєlЊЏОЋ‘…G7'#$B'o‹‚иИ‚ьo'#$D#0'RЃ'#$B'G”R›5ХЫ{{'#9'Ьжy8yCzma®'#$10#$B'B!J#4®9їµ'#$1B'Ж$Ж'#9'эЩосiџк­3'#$F' ‹Щ'#$10'VҐФўu{n|тN'#0'•’g:°Ј.µ‘2ъ51d\“ін8)*ЧЎМVlХ™'#$B'.DBѓ™pAС6•z•шB'#7'N}'#$15'neк&рш#'#$B'т'#7'„ь?('#$B'ю›І'#0#0#$11'ЂЋ2ЗЭ'#7#8#0'˜'#1'юѓІђ@я¦¬ќЭ'#$1F'”%М'#7#5'ў

тут XML и фалй zip, как их достать?
a_titeev
Дата: 29.04.2011 14:39:51
Roman_80,

я же писал тебе - демки есть в 7-ке по SoapAttachment, притом как клиента, так и сервера...

у кого delphi 7 киньте кто нибудь демки что-ль сюда... в папке examples прям папка такая должна была быть SoapAttachment или что-то в этом роде...

запрос как-то не комильфо так формировать, имхо... ни к чему там MultiPartFormDataStream индивский вообще... его уж лучше по назначению использовать... а soap-метод можно вызвать, сделав обертку wsdl-импортом... удобнее и красивее... хотя для аттача может что-то переделать придется...
Roman_80
Дата: 29.04.2011 15:00:21
a_titeev,
На знаю почему, но нет у меня демок, пробывол скачать Д7, ставлю полную версию, но демок опять нет.
На сколько я понял, вы говорите про использование WSDL Import. Для другого проекта я так и делал, все получилось, хотя в том проекте не нужно было отправлять файлы (но не в файлах суть).

В этом проекте я начал именно с этого. Но выяснилось, что WSDL Import неправильно сформировал библиотеку. При вызове любой функции выдает ошибку. Я уже не знаю с чем это связано, но после этого я и стал пользоваться компонентами Indy.
Evgen2010
Дата: 29.04.2011 15:08:05
Roman_80
Дата: 29.04.2011 15:24:18
Пример посмотрел, HTTPRIO не работает с этим сервисом. Не знаю почему. Отправку файла и XML я уже реализовал через Indy. Теперь нужно как-то корректно достать из responsestream1 ответ (XML + Attachment)
a_titeev
Дата: 29.04.2011 15:25:36
Roman_80,

наверное неверно задал свойства... кинь wsdl...
Roman_80
Дата: 29.04.2011 15:30:05
WSDL

+
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : http://172.16.0.24:8081/ACTROOT/dsi.wsdl
// Encoding : UTF-8
// Version  : 1.0
// (25.04.2011 14:23:00 - 1.33.2.5)
// ************************************************************************ //

unit dsi;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

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 Borland 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"
  // !:long            - "http://www.w3.org/2001/XMLSchema"
  // !:warningCode     - "http://dsi.ws.rjd.ru/schemas"
  // !:errorCode       - "http://dsi.ws.rjd.ru/schemas"
  // !:boolean         - "http://www.w3.org/2001/XMLSchema"
  // !:dateTime        - "http://www.w3.org/2001/XMLSchema"


  { "http://dsi.ws.rjd.ru/schemas" }
  ImportDocResultType = (OK, ERROR, DENIED, WARNING);

  warnings   = array of Integer; //warningCode;            { "http://dsi.ws.rjd.ru/schemas" }
  errors     = array of Integer; //errorCode;              { "http://dsi.ws.rjd.ru/schemas" }

  // ************************************************************************ //
  // Namespace : http://dsi.ws.rjd.ru
  // soapAction: urn:#NewOperation
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : document
  // binding   : DsiBinding
  // service   : DsiService
  // port      : DsiPort
  // URL       : http://172.16.0.24:8081/ACTROOT/
  // ************************************************************************ //
  DsiPortType = interface(IInvokable)
  ['{A66AA810-29D0-1D59-3BE3-0BF037E20AA9}']
    function  importDoc(const login: WideString; const password: WideString; out actId: Int64; out warnings: warnings; out errors: errors): ImportDocResultType; stdcall;
    function  getActById(const login: WideString; const password: WideString; const actId: WideString; out actId1: Int64; out warnings: warnings; out errors: errors): ImportDocResultType; stdcall;
    function  findActs(const login: WideString;
                       const password: WideString;
                       const caActId: Int64;
                       const annuled: Boolean;
                       const dateAnnuledFrom:variant;
                       const dateAnnuledTo: variant;
                       const dateSignedByCaFrom: variant;
                       const dateSignedByCaTo: variant;
                       const signedByFgp: Boolean;
                       const dateSignedByFgpFrom: variant;
                       const dateSignedByFgpTo: variant;
                       out actId: Int64;
                       out warnings: warnings;
                       out errors: errors): ImportDocResultType; stdcall;
  end;

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


implementation

function GetDsiPortType(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): DsiPortType;
const
  defWSDL = 'http://172.16.0.24:8081/ACTROOT/dsi.wsdl';
  defURL  = 'http://172.16.0.24:8081/ACTROOT/';
  defSvc  = 'DsiService';
  defPrt  = 'DsiPort';
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 DsiPortType);
    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;


initialization
  InvRegistry.RegisterInterface(TypeInfo(DsiPortType), 'http://dsi.ws.rjd.ru', 'UTF-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(DsiPortType), 'urn:#NewOperation');
  InvRegistry.RegisterInvokeOptions(TypeInfo(DsiPortType), ioDocument);
  RemClassRegistry.RegisterXSInfo(TypeInfo(ImportDocResultType), 'http://dsi.ws.rjd.ru/schemas', 'ImportDocResultType');
  RemClassRegistry.RegisterXSInfo(TypeInfo(warnings), 'http://dsi.ws.rjd.ru/schemas', 'warnings');
  RemClassRegistry.RegisterXSInfo(TypeInfo(errors), 'http://dsi.ws.rjd.ru/schemas', 'errors');

end.
Roman_80
Дата: 29.04.2011 15:34:46
для компоненты HTTPRIO указываю WSDL, выбирается сервис и порт
Roman_80
Дата: 29.04.2011 15:37:12
А теперь тот же WSDL, только полученный из Delphi 2010

+
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : http://172.16.0.24:8081/ACTROOT/dsi.wsdl
//  >Import : http://172.16.0.24:8081/ACTROOT/dsi.wsdl>0
// Encoding : UTF-8
// Version  : 1.0
// (26.04.2011 9:31:06 - - $Rev: 24171 $)
// ************************************************************************ //

unit dsi;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

const
  IS_OPTN = $0001;
  IS_UNBD = $0002;
  IS_NLBL = $0004;


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]
  // !:long            - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:boolean         - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:dateTime        - "http://www.w3.org/2001/XMLSchema"[Gbl]

  ImportDocRequestType = class;                 { "http://dsi.ws.rjd.ru/schemas"[Lit][GblCplx] }
  warning              = class;                 { "http://dsi.ws.rjd.ru/schemas"[Cplx] }
  error                = class;                 { "http://dsi.ws.rjd.ru/schemas"[Cplx] }
  GetActByIdRequestType = class;                { "http://dsi.ws.rjd.ru/schemas"[Lit][GblCplx] }
  warning2             = class;                 { "http://dsi.ws.rjd.ru/schemas"[Cplx] }
  error2               = class;                 { "http://dsi.ws.rjd.ru/schemas"[Cplx] }
  ImportDocRequest     = class;                 { "http://dsi.ws.rjd.ru/schemas"[Lit][GblElm] }
  GetActByIdRequest    = class;                 { "http://dsi.ws.rjd.ru/schemas"[Lit][GblElm] }
  FindActsResponseType = class;                 { "http://dsi.ws.rjd.ru/schemas"[Lit][GblCplx] }
  FindActsResponse     = class;                 { "http://dsi.ws.rjd.ru/schemas"[Lit][GblElm] }
  FindActsRequestType  = class;                 { "http://dsi.ws.rjd.ru/schemas"[Lit][GblCplx] }
  FindActsRequest      = class;                 { "http://dsi.ws.rjd.ru/schemas"[Lit][GblElm] }
  ImportDocResponseType = class;                { "http://dsi.ws.rjd.ru/schemas"[Lit][GblCplx] }
  GetActByIdResponse   = class;                 { "http://dsi.ws.rjd.ru/schemas"[Lit][GblElm] }
  ImportDocResponse    = class;                 { "http://dsi.ws.rjd.ru/schemas"[Lit][GblElm] }

  {$SCOPEDENUMS ON}
  { "http://dsi.ws.rjd.ru/schemas"[GblSmpl] }
  ImportDocResultType = (OK, ERROR, DENIED, WARNING);

  {$SCOPEDENUMS OFF}



  // ************************************************************************ //
  // XML       : ImportDocRequestType, global, <complexType>
  // Namespace : http://dsi.ws.rjd.ru/schemas
  // Serializtn: [xoLiteralParam]
  // Info      : Wrapper
  // ************************************************************************ //
  ImportDocRequestType = class(TRemotable)
  private
    Flogin: string;
    Fpassword: string;
  public
    constructor Create; override;
  published
    property login:    string  read Flogin write Flogin;
    property password: string  read Fpassword write Fpassword;
  end;

  warnings   = array of warning;                { "http://dsi.ws.rjd.ru/schemas"[Cplx] }


  // ************************************************************************ //
  // XML       : warning, <complexType>
  // Namespace : http://dsi.ws.rjd.ru/schemas
  // ************************************************************************ //
  warning = class(TRemotable)
  private
    FwarningCode: string;
    FwarningDsc: string;
  published
    property warningCode: string  read FwarningCode write FwarningCode;
    property warningDsc:  string  read FwarningDsc write FwarningDsc;
  end;

  errors     = array of error;                  { "http://dsi.ws.rjd.ru/schemas"[Cplx] }


  // ************************************************************************ //
  // XML       : error, <complexType>
  // Namespace : http://dsi.ws.rjd.ru/schemas
  // ************************************************************************ //
  error = class(TRemotable)
  private
    FerrorCode: string;
    FerrorDsc: string;
  published
    property errorCode: string  read FerrorCode write FerrorCode;
    property errorDsc:  string  read FerrorDsc write FerrorDsc;
  end;



  // ************************************************************************ //
  // XML       : GetActByIdRequestType, global, <complexType>
  // Namespace : http://dsi.ws.rjd.ru/schemas
  // Serializtn: [xoLiteralParam]
  // Info      : Wrapper
  // ************************************************************************ //
  GetActByIdRequestType = class(TRemotable)
  private
    Flogin: string;
    Fpassword: string;
    FactId: string;
  public
    constructor Create; override;
  published
    property login:    string  read Flogin write Flogin;
    property password: string  read Fpassword write Fpassword;
    property actId:    string  read FactId write FactId;
  end;

  warnings2  = array of warning2;               { "http://dsi.ws.rjd.ru/schemas"[Cplx] }


  // ************************************************************************ //
  // XML       : warning, <complexType>
  // Namespace : http://dsi.ws.rjd.ru/schemas
  // ************************************************************************ //
  warning2 = class(TRemotable)
  private
    FwarningCode: string;
    FwarningDsc: string;
  published
    property warningCode: string  read FwarningCode write FwarningCode;
    property warningDsc:  string  read FwarningDsc write FwarningDsc;
  end;

  errors2    = array of error2;                 { "http://dsi.ws.rjd.ru/schemas"[Cplx] }


  // ************************************************************************ //
  // XML       : error, <complexType>
  // Namespace : http://dsi.ws.rjd.ru/schemas
  // ************************************************************************ //
  error2 = class(TRemotable)
  private
    FerrorCode: string;
    FerrorDsc: string;
  published
    property errorCode: string  read FerrorCode write FerrorCode;
    property errorDsc:  string  read FerrorDsc write FerrorDsc;
  end;



  // ************************************************************************ //
  // XML       : ImportDocRequest, global, <element>
  // Namespace : http://dsi.ws.rjd.ru/schemas
  // Info      : Wrapper
  // ************************************************************************ //
  ImportDocRequest = class(ImportDocRequestType)
  private
  published
  end;



  // ************************************************************************ //
  // XML       : GetActByIdRequest, global, <element>
  // Namespace : http://dsi.ws.rjd.ru/schemas
  // Info      : Wrapper
  // ************************************************************************ //
  GetActByIdRequest = class(GetActByIdRequestType)
  private
  published
  end;

  Array_Of_long = array of Int64;               { "http://www.w3.org/2001/XMLSchema"[GblUbnd] }


  // ************************************************************************ //
  // XML       : FindActsResponseType, global, <complexType>
  // Namespace : http://dsi.ws.rjd.ru/schemas
  // Serializtn: [xoLiteralParam]
  // Info      : Wrapper
  // ************************************************************************ //
  FindActsResponseType = class(TRemotable)
  private
    FactId: Array_Of_long;
    FactId_Specified: boolean;
    Fresult: ImportDocResultType;
    Fwarnings: warnings2;
    Fwarnings_Specified: boolean;
    Ferrors: errors2;
    Ferrors_Specified: boolean;
    procedure SetactId(Index: Integer; const AArray_Of_long: Array_Of_long);
    function  actId_Specified(Index: Integer): boolean;
    procedure Setwarnings(Index: Integer; const Awarnings2: warnings2);
    function  warnings_Specified(Index: Integer): boolean;
    procedure Seterrors(Index: Integer; const Aerrors2: errors2);
    function  errors_Specified(Index: Integer): boolean;
  public
    constructor Create; override;
    destructor Destroy; override;
  published
    property actId:    Array_Of_long        Index (IS_OPTN or IS_UNBD) read FactId write SetactId stored actId_Specified;
    property result:   ImportDocResultType  read Fresult write Fresult;
    property warnings: warnings2            Index (IS_OPTN) read Fwarnings write Setwarnings stored warnings_Specified;
    property errors:   errors2              Index (IS_OPTN) read Ferrors write Seterrors stored errors_Specified;
  end;



  // ************************************************************************ //
  // XML       : FindActsResponse, global, <element>
  // Namespace : http://dsi.ws.rjd.ru/schemas
  // Info      : Wrapper
  // ************************************************************************ //
  FindActsResponse = class(FindActsResponseType)
  private
  published
  end;



  // ************************************************************************ //
  // XML       : FindActsRequestType, global, <complexType>
  // Namespace : http://dsi.ws.rjd.ru/schemas
  // Serializtn: [xoLiteralParam]
  // Info      : Wrapper
  // ************************************************************************ //
  FindActsRequestType = class(TRemotable)
  private
    Flogin: string;
    Fpassword: string;
    FcaActId: Array_Of_long;
    FcaActId_Specified: boolean;
    Fannuled: Boolean;
    Fannuled_Specified: boolean;
    FdateAnnuledFrom: TXSDateTime;
    FdateAnnuledFrom_Specified: boolean;
    FdateAnnuledTo: TXSDateTime;
    FdateAnnuledTo_Specified: boolean;
    FdateSignedByCaFrom: TXSDateTime;
    FdateSignedByCaFrom_Specified: boolean;
    FdateSignedByCaTo: TXSDateTime;
    FdateSignedByCaTo_Specified: boolean;
    FsignedByFgp: Boolean;
    FsignedByFgp_Specified: boolean;
    FdateSignedByFgpFrom: TXSDateTime;
    FdateSignedByFgpFrom_Specified: boolean;
    FdateSignedByFgpTo: TXSDateTime;
    FdateSignedByFgpTo_Specified: boolean;
    procedure SetcaActId(Index: Integer; const AArray_Of_long: Array_Of_long);
    function  caActId_Specified(Index: Integer): boolean;
    procedure Setannuled(Index: Integer; const ABoolean: Boolean);
    function  annuled_Specified(Index: Integer): boolean;
    procedure SetdateAnnuledFrom(Index: Integer; const ATXSDateTime: TXSDateTime);
    function  dateAnnuledFrom_Specified(Index: Integer): boolean;
    procedure SetdateAnnuledTo(Index: Integer; const ATXSDateTime: TXSDateTime);
    function  dateAnnuledTo_Specified(Index: Integer): boolean;
    procedure SetdateSignedByCaFrom(Index: Integer; const ATXSDateTime: TXSDateTime);
    function  dateSignedByCaFrom_Specified(Index: Integer): boolean;
    procedure SetdateSignedByCaTo(Index: Integer; const ATXSDateTime: TXSDateTime);
    function  dateSignedByCaTo_Specified(Index: Integer): boolean;
    procedure SetsignedByFgp(Index: Integer; const ABoolean: Boolean);
    function  signedByFgp_Specified(Index: Integer): boolean;
    procedure SetdateSignedByFgpFrom(Index: Integer; const ATXSDateTime: TXSDateTime);
    function  dateSignedByFgpFrom_Specified(Index: Integer): boolean;
    procedure SetdateSignedByFgpTo(Index: Integer; const ATXSDateTime: TXSDateTime);
    function  dateSignedByFgpTo_Specified(Index: Integer): boolean;
  public
    constructor Create; override;
    destructor Destroy; override;
  published
    property login:               string         read Flogin write Flogin;
    property password:            string         read Fpassword write Fpassword;
    property caActId:             Array_Of_long  Index (IS_OPTN or IS_UNBD) read FcaActId write SetcaActId stored caActId_Specified;
    property annuled:             Boolean        Index (IS_OPTN) read Fannuled write Setannuled stored annuled_Specified;
    property dateAnnuledFrom:     TXSDateTime    Index (IS_OPTN) read FdateAnnuledFrom write SetdateAnnuledFrom stored dateAnnuledFrom_Specified;
    property dateAnnuledTo:       TXSDateTime    Index (IS_OPTN) read FdateAnnuledTo write SetdateAnnuledTo stored dateAnnuledTo_Specified;
    property dateSignedByCaFrom:  TXSDateTime    Index (IS_OPTN) read FdateSignedByCaFrom write SetdateSignedByCaFrom stored dateSignedByCaFrom_Specified;
    property dateSignedByCaTo:    TXSDateTime    Index (IS_OPTN) read FdateSignedByCaTo write SetdateSignedByCaTo stored dateSignedByCaTo_Specified;
    property signedByFgp:         Boolean        Index (IS_OPTN) read FsignedByFgp write SetsignedByFgp stored signedByFgp_Specified;
    property dateSignedByFgpFrom: TXSDateTime    Index (IS_OPTN) read FdateSignedByFgpFrom write SetdateSignedByFgpFrom stored dateSignedByFgpFrom_Specified;
    property dateSignedByFgpTo:   TXSDateTime    Index (IS_OPTN) read FdateSignedByFgpTo write SetdateSignedByFgpTo stored dateSignedByFgpTo_Specified;
  end;



  // ************************************************************************ //
  // XML       : FindActsRequest, global, <element>
  // Namespace : http://dsi.ws.rjd.ru/schemas
  // Info      : Wrapper
  // ************************************************************************ //
  FindActsRequest = class(FindActsRequestType)
  private
  published
  end;



  // ************************************************************************ //
  // XML       : ImportDocResponseType, global, <complexType>
  // Namespace : http://dsi.ws.rjd.ru/schemas
  // Serializtn: [xoLiteralParam]
  // Info      : Wrapper
  // ************************************************************************ //
  ImportDocResponseType = class(TRemotable)
  private
    FactId: Array_Of_long;
    FactId_Specified: boolean;
    Fresult: ImportDocResultType;
    Fwarnings: warnings;
    Fwarnings_Specified: boolean;
    Ferrors: errors;
    Ferrors_Specified: boolean;
    procedure SetactId(Index: Integer; const AArray_Of_long: Array_Of_long);
    function  actId_Specified(Index: Integer): boolean;
    procedure Setwarnings(Index: Integer; const Awarnings: warnings);
    function  warnings_Specified(Index: Integer): boolean;
    procedure Seterrors(Index: Integer; const Aerrors: errors);
    function  errors_Specified(Index: Integer): boolean;
  public
    constructor Create; override;
    destructor Destroy; override;
  published
    property actId:    Array_Of_long        Index (IS_OPTN or IS_UNBD or IS_NLBL) read FactId write SetactId stored actId_Specified;
    property result:   ImportDocResultType  read Fresult write Fresult;
    property warnings: warnings             Index (IS_OPTN) read Fwarnings write Setwarnings stored warnings_Specified;
    property errors:   errors               Index (IS_OPTN) read Ferrors write Seterrors stored errors_Specified;
  end;



  // ************************************************************************ //
  // XML       : GetActByIdResponse, global, <element>
  // Namespace : http://dsi.ws.rjd.ru/schemas
  // Info      : Wrapper
  // ************************************************************************ //
  GetActByIdResponse = class(ImportDocResponseType)
  private
  published
  end;



  // ************************************************************************ //
  // XML       : ImportDocResponse, global, <element>
  // Namespace : http://dsi.ws.rjd.ru/schemas
  // Info      : Wrapper
  // ************************************************************************ //
  ImportDocResponse = class(ImportDocResponseType)
  private
  published
  end;


  // ************************************************************************ //
  // Namespace : http://dsi.ws.rjd.ru
  // soapAction: urn:#NewOperation
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : document
  // binding   : DsiBinding
  // service   : DsiService
  // port      : DsiPort
  // URL       : http://172.16.0.24:8081/ACTROOT/
  // ************************************************************************ //
  DsiPortType = interface(IInvokable)
  ['{A66AA810-29D0-1D59-3BE3-0BF037E20AA9}']

    // Cannot unwrap: 
    //     - Input element wrapper name does not match operation's name
    //     - More than one strictly out element was found
    function  importDoc(const parameter: ImportDocRequest): ImportDocResponse; stdcall;

    // Cannot unwrap: 
    //     - Input element wrapper name does not match operation's name
    //     - More than one strictly out element was found
    function  getActById(const parameter: GetActByIdRequest): GetActByIdResponse; stdcall;

    // Cannot unwrap: 
    //     - Input element wrapper name does not match operation's name
    //     - More than one strictly out element was found
    function  findActs(const parameter: FindActsRequest): FindActsResponse; stdcall;
  end;

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


implementation
  uses SysUtils;

function GetDsiPortType(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): DsiPortType;
const
  defWSDL = 'http://172.16.0.24:8081/ACTROOT/dsi.wsdl';
  defURL  = 'http://172.16.0.24:8081/ACTROOT/';
  defSvc  = 'DsiService';
  defPrt  = 'DsiPort';
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 DsiPortType);
    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;


constructor ImportDocRequestType.Create;
begin
  inherited Create;
  FSerializationOptions := [xoLiteralParam];
end;

constructor GetActByIdRequestType.Create;
begin
  inherited Create;
  FSerializationOptions := [xoLiteralParam];
end;

constructor FindActsResponseType.Create;
begin
  inherited Create;
  FSerializationOptions := [xoLiteralParam];
end;

destructor FindActsResponseType.Destroy;
var
  I: Integer;
begin
  for I := 0 to System.Length(Fwarnings)-1 do
    SysUtils.FreeAndNil(Fwarnings[I]);
  System.SetLength(Fwarnings, 0);
  for I := 0 to System.Length(Ferrors)-1 do
    SysUtils.FreeAndNil(Ferrors[I]);
  System.SetLength(Ferrors, 0);
  inherited Destroy;
end;

procedure FindActsResponseType.SetactId(Index: Integer; const AArray_Of_long: Array_Of_long);
begin
  FactId := AArray_Of_long;
  FactId_Specified := True;
end;

function FindActsResponseType.actId_Specified(Index: Integer): boolean;
begin
  Result := FactId_Specified;
end;

procedure FindActsResponseType.Setwarnings(Index: Integer; const Awarnings2: warnings2);
begin
  Fwarnings := Awarnings2;
  Fwarnings_Specified := True;
end;

function FindActsResponseType.warnings_Specified(Index: Integer): boolean;
begin
  Result := Fwarnings_Specified;
end;

procedure FindActsResponseType.Seterrors(Index: Integer; const Aerrors2: errors2);
begin
  Ferrors := Aerrors2;
  Ferrors_Specified := True;
end;

function FindActsResponseType.errors_Specified(Index: Integer): boolean;
begin
  Result := Ferrors_Specified;
end;

constructor FindActsRequestType.Create;
begin
  inherited Create;
  FSerializationOptions := [xoLiteralParam];
end;

destructor FindActsRequestType.Destroy;
begin
  SysUtils.FreeAndNil(FdateAnnuledFrom);
  SysUtils.FreeAndNil(FdateAnnuledTo);
  SysUtils.FreeAndNil(FdateSignedByCaFrom);
  SysUtils.FreeAndNil(FdateSignedByCaTo);
  SysUtils.FreeAndNil(FdateSignedByFgpFrom);
  SysUtils.FreeAndNil(FdateSignedByFgpTo);
  inherited Destroy;
end;

procedure FindActsRequestType.SetcaActId(Index: Integer; const AArray_Of_long: Array_Of_long);
begin
  FcaActId := AArray_Of_long;
  FcaActId_Specified := True;
end;

function FindActsRequestType.caActId_Specified(Index: Integer): boolean;
begin
  Result := FcaActId_Specified;
end;

procedure FindActsRequestType.Setannuled(Index: Integer; const ABoolean: Boolean);
begin
  Fannuled := ABoolean;
  Fannuled_Specified := True;
end;

function FindActsRequestType.annuled_Specified(Index: Integer): boolean;
begin
  Result := Fannuled_Specified;
end;

procedure FindActsRequestType.SetdateAnnuledFrom(Index: Integer; const ATXSDateTime: TXSDateTime);
begin
  FdateAnnuledFrom := ATXSDateTime;
  FdateAnnuledFrom_Specified := True;
end;

function FindActsRequestType.dateAnnuledFrom_Specified(Index: Integer): boolean;
begin
  Result := FdateAnnuledFrom_Specified;
end;

procedure FindActsRequestType.SetdateAnnuledTo(Index: Integer; const ATXSDateTime: TXSDateTime);
begin
  FdateAnnuledTo := ATXSDateTime;
  FdateAnnuledTo_Specified := True;
end;

function FindActsRequestType.dateAnnuledTo_Specified(Index: Integer): boolean;
begin
  Result := FdateAnnuledTo_Specified;
end;

procedure FindActsRequestType.SetdateSignedByCaFrom(Index: Integer; const ATXSDateTime: TXSDateTime);
begin
  FdateSignedByCaFrom := ATXSDateTime;
  FdateSignedByCaFrom_Specified := True;
end;

function FindActsRequestType.dateSignedByCaFrom_Specified(Index: Integer): boolean;
begin
  Result := FdateSignedByCaFrom_Specified;
end;

procedure FindActsRequestType.SetdateSignedByCaTo(Index: Integer; const ATXSDateTime: TXSDateTime);
begin
  FdateSignedByCaTo := ATXSDateTime;
  FdateSignedByCaTo_Specified := True;
end;

function FindActsRequestType.dateSignedByCaTo_Specified(Index: Integer): boolean;
begin
  Result := FdateSignedByCaTo_Specified;
end;

procedure FindActsRequestType.SetsignedByFgp(Index: Integer; const ABoolean: Boolean);
begin
  FsignedByFgp := ABoolean;
  FsignedByFgp_Specified := True;
end;

function FindActsRequestType.signedByFgp_Specified(Index: Integer): boolean;
begin
  Result := FsignedByFgp_Specified;
end;

procedure FindActsRequestType.SetdateSignedByFgpFrom(Index: Integer; const ATXSDateTime: TXSDateTime);
begin
  FdateSignedByFgpFrom := ATXSDateTime;
  FdateSignedByFgpFrom_Specified := True;
end;

function FindActsRequestType.dateSignedByFgpFrom_Specified(Index: Integer): boolean;
begin
  Result := FdateSignedByFgpFrom_Specified;
end;

procedure FindActsRequestType.SetdateSignedByFgpTo(Index: Integer; const ATXSDateTime: TXSDateTime);
begin
  FdateSignedByFgpTo := ATXSDateTime;
  FdateSignedByFgpTo_Specified := True;
end;

function FindActsRequestType.dateSignedByFgpTo_Specified(Index: Integer): boolean;
begin
  Result := FdateSignedByFgpTo_Specified;
end;

constructor ImportDocResponseType.Create;
begin
  inherited Create;
  FSerializationOptions := [xoLiteralParam];
end;

destructor ImportDocResponseType.Destroy;
var
  I: Integer;
begin
  for I := 0 to System.Length(Fwarnings)-1 do
    SysUtils.FreeAndNil(Fwarnings[I]);
  System.SetLength(Fwarnings, 0);
  for I := 0 to System.Length(Ferrors)-1 do
    SysUtils.FreeAndNil(Ferrors[I]);
  System.SetLength(Ferrors, 0);
  inherited Destroy;
end;

procedure ImportDocResponseType.SetactId(Index: Integer; const AArray_Of_long: Array_Of_long);
begin
  FactId := AArray_Of_long;
  FactId_Specified := True;
end;

function ImportDocResponseType.actId_Specified(Index: Integer): boolean;
begin
  Result := FactId_Specified;
end;

procedure ImportDocResponseType.Setwarnings(Index: Integer; const Awarnings: warnings);
begin
  Fwarnings := Awarnings;
  Fwarnings_Specified := True;
end;

function ImportDocResponseType.warnings_Specified(Index: Integer): boolean;
begin
  Result := Fwarnings_Specified;
end;

procedure ImportDocResponseType.Seterrors(Index: Integer; const Aerrors: errors);
begin
  Ferrors := Aerrors;
  Ferrors_Specified := True;
end;

function ImportDocResponseType.errors_Specified(Index: Integer): boolean;
begin
  Result := Ferrors_Specified;
end;

initialization
  InvRegistry.RegisterInterface(TypeInfo(DsiPortType), 'http://dsi.ws.rjd.ru', 'UTF-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(DsiPortType), 'urn:#NewOperation');
  InvRegistry.RegisterInvokeOptions(TypeInfo(DsiPortType), ioDocument);
  InvRegistry.RegisterInvokeOptions(TypeInfo(DsiPortType), ioLiteral);
  InvRegistry.RegisterExternalParamName(TypeInfo(DsiPortType), 'importDoc', 'parameter1', 'parameter');
  InvRegistry.RegisterExternalParamName(TypeInfo(DsiPortType), 'getActById', 'parameter1', 'parameter');
  InvRegistry.RegisterExternalParamName(TypeInfo(DsiPortType), 'findActs', 'parameter1', 'parameter');
  RemClassRegistry.RegisterXSClass(ImportDocRequestType, 'http://dsi.ws.rjd.ru/schemas', 'ImportDocRequestType');
  RemClassRegistry.RegisterSerializeOptions(ImportDocRequestType, [xoLiteralParam]);
  RemClassRegistry.RegisterXSInfo(TypeInfo(ImportDocResultType), 'http://dsi.ws.rjd.ru/schemas', 'ImportDocResultType');
  RemClassRegistry.RegisterXSInfo(TypeInfo(warnings), 'http://dsi.ws.rjd.ru/schemas', 'warnings');
  RemClassRegistry.RegisterXSClass(warning, 'http://dsi.ws.rjd.ru/schemas', 'warning');
  RemClassRegistry.RegisterXSInfo(TypeInfo(errors), 'http://dsi.ws.rjd.ru/schemas', 'errors');
  RemClassRegistry.RegisterXSClass(error, 'http://dsi.ws.rjd.ru/schemas', 'error');
  RemClassRegistry.RegisterXSClass(GetActByIdRequestType, 'http://dsi.ws.rjd.ru/schemas', 'GetActByIdRequestType');
  RemClassRegistry.RegisterSerializeOptions(GetActByIdRequestType, [xoLiteralParam]);
  RemClassRegistry.RegisterXSInfo(TypeInfo(warnings2), 'http://dsi.ws.rjd.ru/schemas', 'warnings2', 'warnings');
  RemClassRegistry.RegisterXSClass(warning2, 'http://dsi.ws.rjd.ru/schemas', 'warning2', 'warning');
  RemClassRegistry.RegisterXSInfo(TypeInfo(errors2), 'http://dsi.ws.rjd.ru/schemas', 'errors2', 'errors');
  RemClassRegistry.RegisterXSClass(error2, 'http://dsi.ws.rjd.ru/schemas', 'error2', 'error');
  RemClassRegistry.RegisterXSClass(ImportDocRequest, 'http://dsi.ws.rjd.ru/schemas', 'ImportDocRequest');
  RemClassRegistry.RegisterXSClass(GetActByIdRequest, 'http://dsi.ws.rjd.ru/schemas', 'GetActByIdRequest');
  RemClassRegistry.RegisterXSInfo(TypeInfo(Array_Of_long), 'http://www.w3.org/2001/XMLSchema', 'Array_Of_long');
  RemClassRegistry.RegisterXSClass(FindActsResponseType, 'http://dsi.ws.rjd.ru/schemas', 'FindActsResponseType');
  RemClassRegistry.RegisterSerializeOptions(FindActsResponseType, [xoLiteralParam]);
  RemClassRegistry.RegisterXSClass(FindActsResponse, 'http://dsi.ws.rjd.ru/schemas', 'FindActsResponse');
  RemClassRegistry.RegisterXSClass(FindActsRequestType, 'http://dsi.ws.rjd.ru/schemas', 'FindActsRequestType');
  RemClassRegistry.RegisterSerializeOptions(FindActsRequestType, [xoLiteralParam]);
  RemClassRegistry.RegisterXSClass(FindActsRequest, 'http://dsi.ws.rjd.ru/schemas', 'FindActsRequest');
  RemClassRegistry.RegisterXSClass(ImportDocResponseType, 'http://dsi.ws.rjd.ru/schemas', 'ImportDocResponseType');
  RemClassRegistry.RegisterSerializeOptions(ImportDocResponseType, [xoLiteralParam]);
  RemClassRegistry.RegisterXSClass(GetActByIdResponse, 'http://dsi.ws.rjd.ru/schemas', 'GetActByIdResponse');
  RemClassRegistry.RegisterXSClass(ImportDocResponse, 'http://dsi.ws.rjd.ru/schemas', 'ImportDocResponse');

end.
Roman_80
Дата: 29.04.2011 15:43:10
Пробовал в Delphi 2010 через компоненту HTTPRio

procedure TForm1.Button3Click(Sender: TObject);
var x:DsiPortType;
pimportDocReq:ImportDocRequest;
ImportDocRes:ImportDocResponse;
begin
x := htpr1 as DsiPortType;
pimportDocReq.login := 'pass1';
pimportDocReq.password := '100026';
ImportDocRes := x.importDoc(pimportDocReq);
end;

Выдает ошибку "SOAP classes must derive TRemotable"