9
I’m using Delphi to read a web service from an insurance company.
It happens to come in XML format in SOAP.
I import the WSDL I can get the methods.
But to connect to the Web Service I have to send a token that I don’t know how to do in the documentation has an example with wfc Strom and works. I have to create a string type msgheader where I send the token.
Then in the parameters of the query, I send only the company’s bi and id and return data, before I have to go to the config and put the user,pass and domain to connect to the web service because it is in IIS.
Code Delphi that is not working
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;
Why did you do that one amendment to the question?
– Jéf Bueno
@jbueno only to highlight the part that is really necessary
– JamesTK
yes.I hate Delphi
– usersantos
wsclientes is the generated object, now authentication is missing
– usersantos
where do I pass the token?
– usersantos
@user2964140 does not have a class inherited from Tsoapheader?
– JamesTK
I am not a layman in web services
– usersantos
ok.. I’m sorry for anything.. I unfortunately can’t help without more information.
– JamesTK
how do I fetch the statement tsoapheader. i in the HTTPRIO object already have the user and password placed in the object properties
– usersantos
@user2964140, if I’m not mistaken, this user and password placed in the HTTPRIO component are for proxy.. When you use the Delphi tool to parse a wsdl, and there is use of Soapheaders in services, Unit generated by Delphi will have a class inherited from Tsoapheader. In my case,
UserAuthentication
is an inherited class ofTSOAPHeader
, guyUserAuthentication = class(TSOAPHeader);
– JamesTK
OK then I don’t put in on the properties of the HHTPRIO..
– usersantos