-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1495 from ZeusAutomacao/ra/feat-nova-estrutura-base
fix: nova estrutura base de comunicação, mantendo o default
- Loading branch information
Showing
3 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Security.Cryptography.X509Certificates; | ||
using System.Threading.Tasks; | ||
using System.Xml; | ||
using CTe.CTeOSDocumento.Common; | ||
|
||
namespace DFe.Wsdl.Common | ||
{ | ||
public interface IRequestSefaz | ||
{ | ||
XmlDocument SerealizeDocument<T>(T soapEnvelope); | ||
|
||
Task<string> SendRequestAsync(XmlDocument xmlEnvelop, X509Certificate2 certificadoDigital, string url, | ||
int timeOut, TipoEvento? tipoEvento = null, string actionUrn = ""); | ||
|
||
string SendRequest(XmlDocument xmlEnvelop, X509Certificate2 certificadoDigital, string url, int timeOut, | ||
TipoEvento? tipoEvento = null, string actionUrn = ""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.IO; | ||
using System.Net; | ||
using System.Security.Cryptography.X509Certificates; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Xml; | ||
using System.Xml.Serialization; | ||
using CTe.CTeOSDocumento.Common; | ||
using CTe.CTeOSDocumento.Soap; | ||
using DFe.Http.Ext; | ||
|
||
namespace DFe.Wsdl.Common | ||
{ | ||
public class RequestSefazDefault : IRequestSefaz | ||
{ | ||
/// <summary> | ||
/// Serializa a estrutura do envelope contida no objeto para um XmlDocument. | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <param name="soapEnvelope"></param> | ||
/// <returns></returns> | ||
public XmlDocument SerealizeDocument<T>(T soapEnvelope) | ||
{ | ||
return ConfiguracaoServicoWSDL.RequestSefaz.SerealizeDocument(soapEnvelope); | ||
} | ||
|
||
/// <summary> | ||
/// Cria e envia a requisição HttpClient, retornando a resposta obtida do WebService. | ||
/// </summary> | ||
/// <param name="xmlEnvelop"></param> | ||
/// <param name="certificadoDigital"></param> | ||
/// <param name="url"></param> | ||
/// <param name="timeOut"></param> | ||
/// <param name="tipoEvento"></param> | ||
/// <returns></returns> | ||
public async Task<string> SendRequestAsync(XmlDocument xmlEnvelop, X509Certificate2 certificadoDigital, string url, int timeOut, TipoEvento? tipoEvento = null, string actionUrn = "") | ||
{ | ||
return await ConfiguracaoServicoWSDL.RequestSefaz.SendRequestAsync(xmlEnvelop, certificadoDigital, url, timeOut, | ||
tipoEvento, actionUrn); | ||
} | ||
|
||
public string SendRequest(XmlDocument xmlEnvelop, X509Certificate2 certificadoDigital, string url, int timeOut, TipoEvento? tipoEvento = null, string actionUrn = "") | ||
{ | ||
return ConfiguracaoServicoWSDL.RequestSefaz.SendRequest(xmlEnvelop, certificadoDigital, url, timeOut, | ||
tipoEvento, actionUrn); | ||
} | ||
} | ||
} |