Tenho uma função em c# síncrona e funciona bem e com a mudança da reinf vai passar a assíncrona e não tenho mais retorno porque passou a ser void
, não conheço webservice como faço pra ter o retorno do webservice ?
Ex:
Umm exemplo pra ver se você consegue me ajudar, esse era a função síncrona que funcionava bem até agora :
System.Xml.XmlNode xx;
xx = ConsultaReciboEvento4020(4020,xx,xx,xx,xx);
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://sped.fazenda.gov.br/ConsultasReinf/ConsultaReciboEvento4020", RequestNamespace = "http://sped.fazenda.gov.br/", ResponseNamespace = "http://sped.fazenda.gov.br/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public System.Xml.XmlNode ConsultaReciboEvento4020(int tipoEvento, byte tpInsc, string nrInsc, string dtApur, string nrInscEstabelecimento)
{
object[] results = this.Invoke("ConsultaReciboEvento4020", new object[] {
tipoEvento,
tpInsc,
nrInsc,
dtApur,
nrInscEstabelecimento});
return ((System.Xml.XmlNode)(results[0]));
}
E agora como assíncrona ficou dessa forma :
public void ConsultaReciboEvento4020Async(int tipoEvento, byte tpInsc, string nrInsc, string dtApur, string nrInscEstabelecimento)
{
this.ConsultaReciboEvento4020Async(tipoEvento, tpInsc, nrInsc, dtApur, nrInscEstabelecimento, null);
}
/// <remarks/>
public void ConsultaReciboEvento4020Async(int tipoEvento, byte tpInsc, string nrInsc, string dtApur, string nrInscEstabelecimento, object userState)
{
if ((this.ConsultaReciboEvento4020OperationCompleted == null))
{
this.ConsultaReciboEvento4020OperationCompleted = new System.Threading.SendOrPostCallback(this.OnConsultaReciboEvento4020OperationCompleted);
}
this.InvokeAsync("ConsultaReciboEvento4020", new object[] {
tipoEvento,
tpInsc,
nrInsc,
dtApur,
nrInscEstabelecimento}, this.ConsultaReciboEvento4020OperationCompleted, userState);
}
private void OnConsultaReciboEvento4020OperationCompleted(object arg)
{
if ((this.ConsultaReciboEvento4020Completed != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.ConsultaReciboEvento4020Completed(this, new ConsultaReciboEvento4020CompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
E a chamada da função ficou dessa forma então não retorna nada.
ConsultaReciboEvento4020Async(4020,xx,xx,xx,xx,xx,xx)