Boa tarde a todos...

Estou tendo problemas para enviar arquivos XML para um WebService da 
Datasul. Com uma ferramenta exemplo desenvolvida em Java pelo pessoal da 
Datasul o arquivo é enviado perfeitamente. Já usando o componente 
HTTPRIO, ele retorna um erro de "mensagem não assinada". Quem tiver 
alguma idéia ou já tenha trabalhado com os WebServices da Datasul e 
puder ajudar, eu agradeceria muito.

Seguem abaixo o código da unit e do dfm responsáveis pelo envio do XML.

//Código da Unit
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, InvokeRegistry, StdCtrls, Rio, SOAPHTTPClient, SOAPDomConv,
  OPToSOAPDomConv, WSDLIntf, SOAPPasInv, SOAPHTTPPasInv, DB, DBClient,
  SOAPConn;

type
  TForm1 = class(TForm)
    HTTPRIO1: THTTPRIO;
    OpenDialog1: TOpenDialog;
    Button1: TButton;
    Edit1: TEdit;
    Button2: TButton;
    Label1: TLabel;
    OPToSoapDomConvert1: TOPToSoapDomConvert;
    procedure Button2Click(Sender: TObject);
    procedure percorreArquivoTexto ( nomeDoArquivo: String );
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Texto : TStringList;

implementation

uses
  ComObj, EaiWebService1;

{$R *.dfm}

procedure TForm1.Button2Click(Sender: TObject);
var
  Servico : EaiWebService;
begin
  if Edit1.Text <> '' then
  begin
    servico := httPrio1 as EaiWebService;
    Texto := TStringList.Create;
    Texto.Clear;
    percorreArquivoTexto(Edit1.Text);
    texto.Text := UTF8Encode(StringReplace(StringReplace(texto.Text, 
#13, '', [rfReplaceAll]), #10, '', [rfReplaceAll]));
    Label1.Caption := UTF8Decode(Servico.sendMessage(Texto.Text));
    ShowMessage(Label1.Caption);
  end;
end;


procedure TForm1.percorreArquivoTexto ( nomeDoArquivo: String );
var
  arq: TextFile;
  linha: String;
  i : integer;
begin
  AssignFile ( arq, nomeDoArquivo );
  Reset ( arq );
  ReadLn ( arq, linha );
  linha := StringReplace(StringReplace(linha, #13, '', [rfReplaceAll]), 
#10, '', [rfReplaceAll]);
  while not Eof ( arq ) do
    begin
    Texto.Add(trim(linha));
    ReadLn ( arq, linha );
    linha := StringReplace(StringReplace(linha, #13, '', 
[rfReplaceAll]), #10, '', [rfReplaceAll]);
  end;
  CloseFile ( arq );
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  OpenDialog1.Execute;
  Edit1.Text := OpenDialog1.FileName;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  caminho : string;
begin
  caminho := ExtractFilePath( Application.ExeName );
  caminho := caminho + 'EaiWebService.wsdl';
  HTTPRIO1.WSDLLocation := caminho;
end;

end.

//Código do dfm
object Form1: TForm1
  Left = 278
  Top = 200
  Width = 651
  Height = 483
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 16
    Top = 168
    Width = 103
    Height = 24
    Caption = 'RETORNO'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Button1: TButton
    Left = 48
    Top = 80
    Width = 129
    Height = 25
    Caption = 'carregar Arquivo XML'
    TabOrder = 0
    OnClick = Button1Click
  end
  object Edit1: TEdit
    Left = 48
    Top = 56
    Width = 417
    Height = 21
    TabOrder = 1
  end
  object Button2: TButton
    Left = 464
    Top = 120
    Width = 145
    Height = 25
    Caption = 'Enviar'
    TabOrder = 2
    OnClick = Button2Click
  end
  object HTTPRIO1: THTTPRIO
    WSDLLocation =
      'C:\Documents and Settings\Cliente\Desktop\TESTE WEBSERVICE\EaiWe' +
      'bService.wsdl'
    Service = 'EaiWebServiceService'
    Port = 'EaiWebService'
    HTTPWebNode.Agent = 'Borland SOAP 1.2'
    HTTPWebNode.UseUTF8InHeader = True
    HTTPWebNode.InvokeOptions = [soIgnoreInvalidCerts, 
soAutoCheckAccessPointViaUDDI]
    Converter = OPToSoapDomConvert1
    Left = 8
    Top = 8
  end
  object OpenDialog1: TOpenDialog
    Filter = 'XML|*.xml'
    Title = 'Selecione o arquivo XML'
    Left = 40
    Top = 8
  end
  object OPToSoapDomConvert1: TOPToSoapDomConvert
    Options = [soSendMultiRefObj, soTryAllSchema, soRootRefNodesToBody, 
soUTF8InHeader, soCacheMimeResponse, soUTF8EncodeXML]
    Encoding = 'utf-8'
    Left = 120
    Top = 8
  end
end

-- 
---------------------------------------------------
Att.:
Willian Jhonnes L. dos Santos
Analista/Desenvolvedor Object/Free Pascal
[EMAIL PROTECTED]
---------------------------------------------------
Seja livre. Use Linux.
Grupo de Usuários GNU/Linux de São José dos Pinhais
Linux user number 449753
---------------------------------------------------
Powered by Slackware Linux 12.0
Kernel 2.6.21.5-custom
---------------------------------------------------

Responder a