Ejemplo de uso del handle PIX sin caché, en el que el handle mantiene su propia conexión HTTP y cada handle corresponde exactamente a una conexión.
using System;
namespace PIXHandleNoCache
{
class Program
{
private static String strAddr = "127.0.0.1";
private static String strUsrId = "master";
private static String strPwd = "12345678";
static void Main(string[] args)
{
String strKey = "key";
String strKeyCert = "key_cert";
String strPIXChain = "pix_chain";
String strUrl = "https://127.0.0.1:8000";
String[] pstrHeaderContents = { "Content-Type: application/xml; charset=utf-8" };
try
{
using (DinamoPixHttpSession session = new DinamoPixHttpSession(strAddr,
strUsrId,
strPwd,
strKey,
strKeyCert,
strPIXChain,
true,
true))
{
PIXHttpResponse response = session.Get(strUrl, pstrHeaderContents, 30000, 0);
Console.Out.WriteLine("GET inicial: HTTP " + response.HttpCode);
for (int i = 1; i <= 10; i++)
{
response = session.Get(strUrl, pstrHeaderContents, 30000, 0);
Console.Out.WriteLine("GET " + i + ": HTTP " + response.HttpCode +
", " + response.Body.Length + " bytes de corpo.");
}
response = session.Delete(strUrl, pstrHeaderContents, 30000, 0);
Console.Out.WriteLine("DELETE: HTTP " + response.HttpCode);
PIXHandleStats stats = session.GetStats();
Console.Out.WriteLine("Conexões TLS novas: " + stats.SslHookCount);
Console.Out.WriteLine("Assinaturas no HSM: " + stats.HsmSignCount);
}
PIXCacheStats cacheStats = DinamoPixHttpSession.GetCacheStats();
Console.Out.WriteLine("Conexões no cache: " + cacheStats.HandlesLive);
}
{
}
}
}
}
Classe de Excecao para erros do Dinamo.
Definição DinamoException.cs:10
override string Message
Definição DinamoException.cs:42
int ErrorCode
Definição DinamoException.cs:26
Namespace que denota um conjunto de funções para acesso ao HSM Dinamo e suas respectivas exceptions.
Definição DinamoClient.cs:12