Advertisement
Guest User

Untitled

a guest
Apr 20th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. unit Unit3;
  2.  
  3. interface
  4.  
  5. uses
  6. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, WSClientes, StdCtrls,
  7. InvokeRegistry, SOAPHTTPClient, opCOnvertOptions, XMLIntf, XSBuiltIns,
  8. Soap.Rio;
  9.  
  10. type
  11. TForm3 = class(TForm)
  12. Memo1: TMemo;
  13. Button1: TButton;
  14. procedure Button1Click(Sender: TObject);
  15. procedure FormCreate(Sender: TObject);
  16.  
  17. private
  18. { Private declarations }
  19. public
  20. { Public declarations }
  21. end;
  22.  
  23. var
  24. Form3: TForm3;
  25.  
  26. implementation
  27.  
  28. {$R *.dfm}
  29.  
  30. { TSOAPCredentials }
  31.  
  32.  
  33. procedure TForm3.Button1Click(Sender: TObject);
  34.  
  35. var
  36. ws : WSClientes;
  37.  
  38. Rio : THTTPRIO;
  39.  
  40.  
  41. begin
  42. Rio := THttpRIO.Create(nil);
  43. ws := WSClientes (false, '', Rio);
  44.  
  45. ws :=WSClientes.MlBase2.Create;
  46. ws := WSClientes.GetIWSClientes();
  47. Rio.HTTPWebNode.UserName := 'dominio/user0121';
  48. Rio.HTTPWebNode.UserName := 'password';
  49. Rio.SOAPHeaders.ToString := 'L9+zby7w1V5OZTVGUPLZ1x8rJYzCEHAnxovPUuyadZFdbv21elZ1qsvy';
  50. Rio.SOAPHeaders.Send(Rio);
  51.  
  52. end;
  53.  
  54. class function TCRMWebServices.GetFileTransferService(AUsername, APassword: string; ASendEvent: TPostingDataEvent): FileTransferServiceSoap;
  55. var
  56. soapHeader: UserAuthentication;
  57. httpRio: THTTPRIO;
  58. begin
  59. soapHeader := UserAuthentication.Create;
  60. soapHeader.Username := AUsername;
  61. soapHeader.Password := APassword;
  62. httpRio := GetHTTPRIO('Services/FileTransferService.asmx', soapHeader);
  63. if Assigned(ASendEvent) then
  64. httpRio.HTTPWebNode.OnPostingData := ASendEvent;
  65. result := httpRio as FileTransferServiceSoap;
  66. end;
  67.  
  68. class function TCRMWebServices.GetHTTPRIO(AServicePath: string; ASOAPHeader: UserAuthentication): THTTPRIO;
  69. begin
  70. if Trim(AServicePath) = '' then
  71. AServicePath := 'WebService.asmx';
  72. result := THTTPRIO.Create(nil);
  73. result.URL := 'http://' + TCRMWebConfig.GetWebHostname + '/' + AServicePath;
  74. if ASOAPHeader <> nil then
  75. result.SOAPHeaders.Send(ASOAPHeader as TSOAPHeader);
  76. end;
  77.  
  78. result.SOAPHeaders.Send(ASOAPHeader as TSOAPHeader);
  79.  
  80. var
  81. service: FileTransferServiceSoap;
  82. begin
  83. ...
  84. service := TCRMWebService.GetFileTransferService(username, password, evento);
  85. service.SendFile(file);
  86. end;
  87.  
  88. var
  89. ws: WSClientes;
  90.  
  91. ws := WSClientes(false, '', Rio);
  92.  
  93. clientes := ws.ObterClientes();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement