Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit3;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, WSClientes, StdCtrls,
- InvokeRegistry, SOAPHTTPClient, opCOnvertOptions, XMLIntf, XSBuiltIns,
- Soap.Rio;
- type
- TForm3 = class(TForm)
- Memo1: TMemo;
- Button1: TButton;
- procedure Button1Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form3: TForm3;
- implementation
- {$R *.dfm}
- { TSOAPCredentials }
- procedure TForm3.Button1Click(Sender: TObject);
- var
- ws : WSClientes;
- Rio : THTTPRIO;
- begin
- Rio := THttpRIO.Create(nil);
- ws := WSClientes (false, '', Rio);
- ws :=WSClientes.MlBase2.Create;
- ws := WSClientes.GetIWSClientes();
- Rio.HTTPWebNode.UserName := 'dominio/user0121';
- Rio.HTTPWebNode.UserName := 'password';
- Rio.SOAPHeaders.ToString := 'L9+zby7w1V5OZTVGUPLZ1x8rJYzCEHAnxovPUuyadZFdbv21elZ1qsvy';
- Rio.SOAPHeaders.Send(Rio);
- end;
- class function TCRMWebServices.GetFileTransferService(AUsername, APassword: string; ASendEvent: TPostingDataEvent): FileTransferServiceSoap;
- var
- soapHeader: UserAuthentication;
- httpRio: THTTPRIO;
- begin
- soapHeader := UserAuthentication.Create;
- soapHeader.Username := AUsername;
- soapHeader.Password := APassword;
- httpRio := GetHTTPRIO('Services/FileTransferService.asmx', soapHeader);
- if Assigned(ASendEvent) then
- httpRio.HTTPWebNode.OnPostingData := ASendEvent;
- result := httpRio as FileTransferServiceSoap;
- end;
- class function TCRMWebServices.GetHTTPRIO(AServicePath: string; ASOAPHeader: UserAuthentication): THTTPRIO;
- begin
- if Trim(AServicePath) = '' then
- AServicePath := 'WebService.asmx';
- result := THTTPRIO.Create(nil);
- result.URL := 'http://' + TCRMWebConfig.GetWebHostname + '/' + AServicePath;
- if ASOAPHeader <> nil then
- result.SOAPHeaders.Send(ASOAPHeader as TSOAPHeader);
- end;
- result.SOAPHeaders.Send(ASOAPHeader as TSOAPHeader);
- var
- service: FileTransferServiceSoap;
- begin
- ...
- service := TCRMWebService.GetFileTransferService(username, password, evento);
- service.SendFile(file);
- end;
- var
- ws: WSClientes;
- ws := WSClientes(false, '', Rio);
- clientes := ws.ObterClientes();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement