page 50110 pruebas
{
PageType = Card;
ApplicationArea = All;
UsageCategory = Administration;
Caption = 'Pruebas Tesoralia';
layout
{
area(Content)
{
group(GroupName)
{
field(Url; gUrl)
{
ApplicationArea = All;
Caption = 'URL';
}
field(user;gUser)
{
ApplicationArea = All;
Caption = 'User';
}
field(pass;gPass)
{
ApplicationArea = All;
Caption = 'Pass';
}
}
}
}
actions
{
area(Processing)
{
action(getToken03)
{
ApplicationArea = All;
trigger OnAction()
var
client: HttpClient;
content: HttpContent;
response: HttpResponseMessage;
headers: HttpHeaders;
request: HttpRequestMessage;
respuesta: Text;
begin
client.DefaultRequestHeaders.Add('SOAPAction', 'Login');
content.WriteFrom(composeBody());
content.GetHeaders(headers);
headers.Remove('Content-Type');
headers.Add('Content-Type', 'application/soap+xml; charset="utf-8"');
request.Method := 'POST';
request.SetRequestUri(gUrl);
request.Content := content;
if not client.Send(request, response) then
Error('Error en POST: %1', GetLastErrorText());
if not response.IsSuccessStatusCode then
Error('%1:%2', response.HttpStatusCode, response.ReasonPhrase);
response.Content.ReadAs(respuesta);
Message(respuesta);
end;
}
}
}
var
gRestClient: Codeunit "Rest Client";
gUrl: Text;
gUser: Text;
gPass: Text;
trigger OnOpenPage()
begin
gUrl := 'https://api.tesoralia.com/FinancialOnline/Financial.svc';
gUser := 'UserTest';
gPass := 'PasswordTest';
end;
local procedure composeBody(): Text
var
tb: TextBuilder;
begin
tb.AppendLine('<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope">');
tb.AppendLine(' <Body>');
tb.AppendLine(' <Login xmlns="http://Tesoralia/Services/Financial/1.0">');
tb.AppendLine(' <request>');
tb.AppendLine(' <Login>' + gUser + '</Login>');
tb.AppendLine(' <Password>' + gPass + '</Password>');
tb.AppendLine(' </request>');
tb.AppendLine(' </Login>');
tb.AppendLine(' </Body>');
tb.AppendLine('</Envelope>');
exit(tb.ToText());
end;
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,134 Super User 2024 Season 2
Martin Dráb 229,928 Most Valuable Professional
nmaenpaa 101,156