I imported the WebService
http://sngpc.anvisa.gov.br/webservice/sngpc.asmxFor the method EnviaArquivoSNGPC he created the class:
EnviaArquivoSNGPC_Type = class(TBaseComplexRemotable)
private
FEmail : String;
FSenha : String;
FArq : TBase64StringRemotable;
FHashIdentificacao : String;
private
function wstHas_Email() : Boolean;
function wstHas_Senha() : Boolean;
function wstHas_Arq() : Boolean;
function wstHas_HashIdentificacao() : Boolean;
public
constructor Create();override;
procedure FreeObjectProperties();override;
published
property Email : String read FEmail write FEmail stored wstHas_Email;
property Senha : String read FSenha write FSenha stored wstHas_Senha;
property Arq : TBase64StringRemotable read FArq write FArq stored wstHas_Arq;
property HashIdentificacao : String read FHashIdentificacao write FHashIdentificacao stored wstHas_HashIdentificacao;
end;
I can't use the parameter Arq: TBase64StringRemotable
For what I researched I need to register it with
RegisterAttributeProperty()
Follow the code:
var ClasseSNGPC : sngpcSoap;
Arquivo : EnviaArquivoSNGPC_Type;
.
.
.
begin
SYNAPSE_RegisterHTTP_Transport( );
ClasseSNGPC := wst_CreateInstance_sngpcSoap( );
Arquivo := EnviaArquivoSNGPC_Type.Create();
Arquivo.Email := eMail;
Arquivo.Senha := Senha;
Arquivo.Arq.EncodedString := StringBase64;
Arquivo.HashIdentificacao := Hash;
try
ClasseSNGPC.EnviaArquivoSNGPC( Arquivo );
except
on e: Exception do
ShowMessage( E.Message );
end;
Error:
Service exception :
Code = "soap:Server"
Message = "System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: buffer
at System.Security.Cryptography.HashAlgorithm.ComputeHash(Byte[] buffer)
at sngpc.sngpc.GetMD5HashFromByte(Byte[] file) in C:\inetpub\wwwroot\sngpc\webservice\sngpc.asmx.cs:line 479
at sngpc.sngpc.EnviaArquivoSNGPC(String Email, String Senha, Byte[] Arq, String HashIdentificacao) in C:\inetpub\wwwroot\sngpc\webservice\sngpc.asmx.cs:line 902
--- End of inner exception stack trace ---"
[Edited to add code tags - please see
How to use the Forums.]