FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour COMO SE PUEDE CREAR UN OBJETO
Posts: 336
Joined: Wed May 16, 2007 09:40 PM
COMO SE PUEDE CREAR UN OBJETO
Posted: Thu Jun 12, 2014 07:23 PM

Hola

Necesito una ayuda.....

c_security_cSec = new cSecurity(ruta,pass)

necesito crear este mismo objeto en fivewin

c_security_csec :=createobjeto("cSecurity"):new(ruta,pass)

Pero no me funciona, lo he intentado de varias foma y siempre me da un error..

agradeceria ayuda

Fivewin-Xharbour 24.09, Iquique, Chile
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: COMO SE PUEDE CREAR UN OBJETO
Posted: Fri Jun 13, 2014 04:22 PM

Te refieres a un objeto en C++ ?

贸 es un objeto OLE ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 336
Joined: Wed May 16, 2007 09:40 PM
Re: COMO SE PUEDE CREAR UN OBJETO
Posted: Fri Jun 13, 2014 08:03 PM

Antonio... gracias por contestar

la funcion cSecurity(ruta,pass) esta dentro de una DLL creada en .NET, debo crear un objeto para seguir leyendo las demas funciones y finalmente enviar un xml...

include "Fivewin.ch"

include "Dll.Ch"

include "Objects.Ch"

include "Hbclass.ch"

FUNCTION md204()
LOCAL PathCert:="\mlmall\config\pos\zofri.pfx"
LOCAL PassCert:="Ah2Cfg723rQ"
LOCAL cDllname:="\MLMall\Config\POS\MkSg.InterfazPOS.Security.dll"
LOCAL ts_token:=""
LOCAL clObj
hlib := loadlibrary(cDllName)

INI oIni File "\MLMALL\config\config.ini"
GET ts_token SECTION "TOKEN SESION "+e_rut ENTRY "Token" OF oIni
if empty(ts_token)
msginfo('Debe Obtener un Token de Inicio para Autentificarse en Web Service','Token de Sesion')
endif

cSecurity_csec:=csecurity():new()
// cSecurity_csec:=c_security():new(pathCert,passCert)
// cSecurity_csec:=c_security(pathCert,passCert)
// ?osvr2
// cSecurity_csec.c_aplicar(ts_token)

RETURN NIL

DLL32 FUNCTION c_Security(rutacert AS STRING, pass AS STRING) AS STRING PASCAL;
FROM "cSecurity" LIB hLib

DLL32 FUNCTION c_Aplicar(ts_token AS STRING) AS BOOL PASCAL;
FROM "AplicarSeguridad" LIB hLib

Fivewin-Xharbour 24.09, Iquique, Chile
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: COMO SE PUEDE CREAR UN OBJETO
Posted: Fri Jun 13, 2014 10:50 PM
Sabes con certeza que esa DLL exporta esa funci贸n ? Tienes documentaci贸n de ella 贸 alg煤n ejemplo ?

En principio una DLL escrita en .NET no se puede usar desde una aplicaci贸n nativa en C (que es lo que se genera con Harbour+FWH), de ah铆 que me extra帽e que lo que deseas hacer sea posible.

La 煤nica forma que s茅 saltar desde una aplicaci贸n en C a una DLL en .NET es de la forma en que lo hago en FiveNet:
https://code.google.com/p/fivenet/
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 336
Joined: Wed May 16, 2007 09:40 PM
Re: COMO SE PUEDE CREAR UN OBJETO
Posted: Sat Jun 14, 2014 06:16 PM

Hola Antonio

Te explico, me entregaron un libreria(DLL) que esta desarrollada en .NET, esta libreria contiene varias clases, ademas de la libreria un certificado.pfx.

PASO 1
Solicitar un token via web service,,, esto ya esta ok

PASO 2
Clase cSecurity (DLL)
Debo instanciar esta clase e insertarle la direccion del certificado y la contrase帽a del certificado
cSecurity(rutacertif,passcertif)

PASO 3
Crear XML con datos

PASO 4
Clase Strxml(DLL)
Debo entregarle a esta clase el xml creado en paso 3
StrXml(xml)

PASO 5
Clase AplicarSeguridad(DLL)
Debo entrar el Token del Paso 1, para que le pueda aplicar seguridad al xml
AplicarSeguridad(string)

PASO 6
Con todo o anterior debo comunicarme con el webservice, enviando el siguiente xml, en donde en el tag <tem:XmlTrx> debe ir el xml creado en el paso 3, pero ya modificado y encriptado y como respuesta recivo un .T. o .F.

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">
<soap:Header/>
<soap:Body>
<tem:EnviarTransaccion>
<!--Optional:-->
<tem:XmlTrx>?</tem:XmlTrx>
</tem:EnviarTransaccion>
</soap:Body>
</soap:Envelope>

Espero puedas ayudarme llevo atrapado varios dias con este tema y si necesitas el DLL, me indicas donde subirlo y agradecido por tu tiempo, igualmente sigo trabajando y a ver si encuentro la solucion..

saludos

Fivewin-Xharbour 24.09, Iquique, Chile
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: COMO SE PUEDE CREAR UN OBJETO
Posted: Sat Jun 14, 2014 06:46 PM

Puedes mostrarnos el c贸digo fuente de c贸mo has realizado el primer paso ?

Lo revisamos y a ver que se puede hacer en el 2 :-)

Y si proporcionas un ejemplo autocontenido para que podamos probarlo, mejor que mejor

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 336
Joined: Wed May 16, 2007 09:40 PM
Re: COMO SE PUEDE CREAR UN OBJETO
Posted: Sat Jun 14, 2014 11:13 PM

//CODIGO FUENTE PASO 1 ES UN SIMPLE PROGRAMA MD203 QUE CREA UN XML Y LO ENVIA A UN WS,, EL CUAL RETORNA UN ID Y UN TOKEN Y ACONTINUACION ESTA EL MD204 QUE ES DONDE TENGO EL PROBLEMA,,, POR LO QUE PUEDO APRECIAR SE DEBERIA INSTANCIAR UN OBJETO...

include "Fivewin.ch"

include "Xml.ch"

include "hbxml.ch"

include "dll.ch"

include "hbcurl.ch"

FUNCTION MD203() //Obtener Token Web Service
LOCAL oHttp,Doc,cxmLbody,oIni,oDlg2,oSay,oError,oInternet
LOCAL ts_token:="",ts_usuario:=space(50),ts_id:=space(50)
LOCAL ts_clave:=space(20),ts_exit:=.f.,tw_servidor:=''
LOCAL nrate:=nil

if !isinternet()
msgalert('Computador Sin Conexion a Internet','Verifique')
return .f.
endif

if .NOT.FILE("\MLMALL\config\config.ini")
msgalert('Archivo de Configuracion, No Existe...','Verifique')
return .f.
else
INI oIni File "\MLMALL\config\config.ini"
GET tw_servidor SECTION "WEBSERVICE" ENTRY "Servidor" OF oIni
GET ts_token SECTION "TOKEN SESION "+e_rut ENTRY "Token" OF oIni
GET ts_usuario SECTION "TOKEN SESION "+e_rut ENTRY "Usuario" OF oIni
GET ts_id SECTION "TOKEN SESION "+e_rut ENTRY "Id" OF oIni
endif
if empty(ts_token)
msginfo('Debe Obtener un Token de Inicio para Autentificarse en Web Service','Token de Sesion')
endif
if empty(ts_usuario)
ts_usuario:=space(50)
else
ls_largo:=len(ts_usuario)
if ls_largo<50
ts_usuario:=ts_usuario+space(50-ls_largo)
endif
endif
ts_servidor:=tw_servidor

DEFINE DIALOG oDlg2 RESOURCE "MOD203" TITLE oemtoansi("Autentificaci垄n e Inicio de Sesi垄n WEBSERVICE")

REDEFINE SAY oSay VAR ts_token ID 4002 OF odlg2 COLOR rgb(0,0,255) UPDATE
REDEFINE SAY oSay VAR ts_servidor ID 4004 OF odlg2 COLOR rgb(0,0,255) UPDATE
REDEFINE SAY oSay VAR ts_id ID 4006 OF odlg2 COLOR rgb(0,0,255) UPDATE
REDEFINE GET ts_usuario ID 4012 OF odlg2 UPDATE
REDEFINE GET ts_clave ID 4014 OF odlg2 UPDATE

REDEFINE BUTTON ID 4009 OF odlg2 ACTION(ts_exit:=.t.,oDlg2:end())
REDEFINE BUTTON ID 4010 OF odlg2 ACTION(oDlg2:end())

ACTIVATE DIALOG oDlg2 CENTERED

if ts_exit
cXmlBody := '' + ;
'<?xml version="1.0" encoding="UTF-8"?>' + ;
'<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">'+;
' <soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:Action>http://tempuri.org/IWcfCP/Autenticar</wsa:Action><wsa:To>https://zofri.mekanosige.cl:2414/WcfCP.svc</wsa:To></soap:Header>'+;
' <soap:Body>'+;
' <tem:Autenticar>'+;
' <tem:User>'+alltrim(ts_usuario)+'</tem:User>'+;
' <tem:Pass>'+alltrim(ts_clave)+'</tem:Pass>'+;
' </tem:Autenticar>'+;
' </soap:Body>'+;
'</soap:Envelope>'

//verifica si esta activo el servidor

doc = CreateObject( "MSXML2.DOMDocument" )
ohttp=CreateObject( "Microsoft.XMLHTTP")
ohttp:Open( "POST" , ts_servidor+' HTTP/1.1',.f. )
ohttp:SetRequestHeader( "Accept-Encoding","gzip,deflate")
ohttp:SetRequestHeader( "Content-Type" , "application/soap+xml;charset=UTF-8" )
ohttp:SetRequestHeader( "SOAPAction" , "http://tempuri.org/IWcfCP/Autenticar" )
ohttp:SetRequestHeader( "User-Agent" , "Jakarta Commons-HttpClient/3.1;Apache-HttpClient/4.1.1 (java 1.5)" )
ohttp:setrequestHeader( "Host", "https://zofri.mekanosige.cl:2414" )
ohttp:SetRequestHeader( "Connection" , "Keep-Alive" )
doc:LoadXML( cXmlBody )
TRY
ohttp:Send( doc:xml )
CATCH
cErrorMsg:='No Se Pudo Enviar Documento XML...'+CRLF+CRLF+;
'Sin Conexion a Internet o Servidor Con Problemas'
msginfo(cErrorMsg,"Intente Nuevamente")
return .t.
END

cresponse=ohttp:responseText

If .Not. Empty( Alltrim( cresponse ) )
buscar1:=AT("Id",cResponse)
if buscar1#0
cresponse:=substr(cresponse,buscar1)
buscarA:=AT(";",cResponse)
buscarB:=AT("&lt",cResponse)
len_ab:=buscarB-buscarA
ts_id:=substr(cresponse,buscarA+1,len_ab-1)

buscar1:=AT(&quot;Token&quot;,cResponse)
cresponse:=substr(cresponse,buscar1)
buscarA:=AT(&quot;gt;&quot;,cResponse)
buscarB:=AT(&quot;&amp;lt&quot;,cResponse)
len_ab:=buscarB-buscarA
ts_token:=substr(cresponse,buscarA+3,len_ab-3)

cRetorno=oemtoansi(&quot;Comunicaci垄n Establecida Con Servidor&quot;)

else
ts_token:=""
cRetorno = "### Hubo un Problema Con El Servidor, Mensaje No Pudo Ser Entregado ###"+CRLF+;
"### Nombre de Usuario Incorrecto ###"+CRLF+;
oemtoansi("### Contrase陇a Incorrecta ###")+CRLF+;
"### Servidor Fuera de Linea ###"
endif
if .not.empty(alltrim(ts_token))
INI oIni File "\MLMALL\config\config.ini"
SET SECTION "TOKEN SESION "+e_rut ENTRY "Token" OF oIni TO ts_token
SET SECTION "TOKEN SESION "+e_rut ENTRY "Id" OF oIni TO ts_id
SET SECTION "TOKEN SESION "+e_rut ENTRY "Usuario" OF oIni TO ts_usuario
SET SECTION "WEBSERVICE" ENTRY "Servidor" OF oIni TO tw_servidor
MD204()
endif
else
cRetorno = "### No Fue Posible Generar Proceso ###"
Endif
msginfo(cretorno,'Resultado del Proceso')
Release doc
Release ohttp
Release res
Release response
endif
Return .t.

FUNCTION md204()
LOCAL oHttp,Doc,cxmLbody2,oIni,oError,oInternet
LOCAL PathCert:="\mlmall\config\pos\zofri.pfx"
LOCAL PassCert:="Ah2Cfg723rQ"
LOCAL cDllname:="\MLMall\Config\POS\MkSg.InterfazPOS.Security.dll"
LOCAL ts_token:="",cXlmBody:="",tw_servidor:=""
LOCAL clObj
LOCAL ts_cliente:='1547',ts_local:='1032',ts_caja:='001',ts_tipo:='BO'
LOCAL ts_mod:='M',ts_folio:='12345'
LOCAL ts_tbruto:=15000,ts_tneto:=13000,ts_timp:=2000

hlib := loadlibrary(cDllName)
if abs(hlib)<=32
msgAlert ("Error Code: "+Ltrim(str(hlib))+" Loading "+ cDllName )
return .t.
endif

if .NOT.FILE("\MLMALL\config\config.ini")
msgalert('Archivo de Configuracion, No Existe...','Verifique')
return .f.
else
INI oIni File "\MLMALL\config\config.ini"
GET ts_token SECTION "TOKEN SESION "+e_rut ENTRY "Token" OF oIni
GET tw_servidor SECTION "WEBSERVICE" ENTRY "Servidor" OF oIni
endif
if empty(ts_token)
msginfo('Debe Obtener un Token de Inicio para Autentificarse en Web Service','Token de Sesion')
endif
// cSecurity_csec:=csecurity():new()
// clObj:=CreateObject("cSecurity")
// clObj:=Createobject(c_security(pathCert,passCert))
// oSvr:=Createobject("cSecurity")
// oSvr:create:new()
// cSecurity_csec:=c_security():new(pathCert,passCert)

//Entregar a la clase ruta y pass del certificado
cSecurity_csec:=c_security(pathCert,passCert)

//Crear XML con Datos
cXmlBody := '' + ;
'<Transaccion>'+;
' <CodCliente>'+alltrim(ts_cliente)+'</CodCliente>'+;
' <CodLocal>'+alltrim(ts_local)+'</CodLocal>'+;
' <CodCaja>'+alltrim(ts_caja)+'</CodCaja>'+;
' <FecTrx>'+dtoc(date())+' '+time()+'</FecTrx>'+;
' <TipDoc>'+alltrim(ts_tipo)+'</TipDoc>'+;
' <ModDoc>'+alltrim(ts_mod)+'</ModDoc>'+;
' <Folio>'+alltrim(ts_folio)+'</FecTrx>'+;
' <Totales>'+;
' <TotBruto>'+transform(ts_tbruto,'##########')+'</TipDoc>'+;
' <TotNeto>'+transform(ts_tneto,'##########')+'</TotNet>'+;
' <TotImp>'+transform(ts_timp,'##########')+'</TotImp>'+;
' </Totales>'+;
'</Transaccion>'

cSecurity_csec:=c_StrXml(cXmlBody)
cSecurity_csec:=c_Aplicar(ts_token)

//Crear XML para WebService

cXmlBody2:= '' + ;
'<?xml version="1.0" encoding="UTF-8"?>'+;
'<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">'+;
' <soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:Action>http://tempuri.org/IWcfCP/Autenticar</wsa:Action><wsa:To>https://zofri.mekanosige.cl:2414/WcfCP.svc</wsa:To></soap:Header>'+;
' <soap:Body>'+;
' <tem:EnviarTransaccion>'+;
' <tem:XmlTrx>'+cXmlBody+'</tem:XmlTrx>'+;
' </tem:EnviarTransaccion>'+;
' </soap:Body>'+;
'</soap:Envelope>'

// ' <tem:XmlTrx>'+c_strxml(cXmlBody)+'</tem:XmlTrx>'+;

ts_servidor:=tw_servidor
doc = CreateObject( "MSXML2.DOMDocument" )
ohttp=CreateObject( "Microsoft.XMLHTTP")
ohttp:Open( "POST" , ts_servidor+' HTTP/1.1',.f. )
ohttp:SetRequestHeader( "Accept-Encoding","gzip,deflate")
ohttp:SetRequestHeader( "Content-Type" , "application/soap+xml;charset=UTF-8" )
ohttp:SetRequestHeader( "SOAPAction" , "http://tempuri.org/IWcfCP/Autenticar" )
ohttp:SetRequestHeader( "User-Agent" , "Jakarta Commons-HttpClient/3.1;Apache-HttpClient/4.1.1 (java 1.5)" )
ohttp:setrequestHeader( "Host", "https://zofri.mekanosige.cl:2414" )
ohttp:SetRequestHeader( "Connection" , "Keep-Alive" )
doc:LoadXML( cXmlBody2)
TRY
ohttp:Send( doc:xml )
CATCH
cErrorMsg:='No Se Pudo Enviar Documento XML...'+CRLF+CRLF+;
'Sin Conexion a Internet o Servidor Con Problemas'
msginfo(cErrorMsg,"Intente Nuevamente")
return .t.
END
cresponse=ohttp:responseText
?cresponse
If cresponse
msginfo('Servicio Ejecutado Correctamente','Transaccion Exitosa')
else
msginfo('Servicio Con Problemas','Transaccion Erronea')
endif
Release doc
Release ohttp
Release res
Release response

RETURN NIL

DLL32 FUNCTION c_Security(rutacert AS STRING, pass AS STRING) AS STRING PASCAL;
FROM "cSecurity" LIB hLib

DLL32 FUNCTION c_Aplicar(token AS STRING) AS BOOL PASCAL;
FROM "AplicarSeguridad" LIB hLib

DLL32 FUNCTION c_StrXml(sendxml AS STRING) AS BOOL PASCAL;
FROM "StrXml" LIB hLib

Fivewin-Xharbour 24.09, Iquique, Chile
Posts: 336
Joined: Wed May 16, 2007 09:40 PM
Re: COMO SE PUEDE CREAR UN OBJETO
Posted: Sat Jun 14, 2014 11:27 PM
Antonio

Te envio Ejemplos de Otros lenguajes que funcionan que es lo que tengo que hacer

PROCEDURE
EnviaTransMekano(sTipDoc,sModDoc,sFolio,xTotBruto,xTotNeto,xTotImp)
bufMensa is Buffer
bres is boolean
sMsgxml,sTrx,sRequete,sRes,doc is string

//Necesita la security DLL de Mekano cargada en la aplicacion y el
Certificado Raiz copiado en el PC cliente
clSec is object cSecurity(gsCertRaiz,gsPassCert)
XmlDocument(doc)
XMLAddChild(doc,"soap:Envelope","",True)
XMLAddAttribute(doc,"xmlns:soap","http://www.w3.org/2003/05/soap-envelope")
XMLAddAttribute(doc,"xmlns:tem","http://tempuri.org/")
XMLAddChild(doc,"soap:Header","",True)
XMLAddAttribute(doc,"xmlns:wsa","http://www.w3.org/2005/08/addressing")
XMLAddChild(doc,"wsa:Action","http://tempuri.org/IWcfCP/Autenticar")
XMLAddChild(doc,"wsa:To","https://zofri.mekanosige.cl:2414/WcfCP.svc")
XMLParent(doc)
XMLAddChild(doc,"soap:Body","",True)
XMLAddChild(doc,"tem:Autenticar","",True) //tns
XMLAddChild(doc, "User",gsCodUser)
XMLAddChild(doc, "Pass",gsPassUser)
sRequete=XMLBuildString(doc,XMLDocumentDefault,XMLEncodingUTF8)
//XMLDocumentDefault,XMLEncodingUTF8)
bres=HTTPRequest("https://zofri.mekanosige.cl:2414","pcsoft","",sRequete,"application/soap+xml")
IF NOT bres THEN
Error("Error en Autenticaci贸n con Servicio Web Mekano")
RESULT "Error"
END

bufMensa=HTMLToText(HTTPGetResult())
sRes=Middle(bufMensa,Position(bufMensa,"AutenticarResponse")+18)

XMLClose(doc)

XmlDocument("DocXml",sMsgxml)
XMLAddChild("DocXml","Transaccion","",True)
XMLAddChild("DocXml","CodCliente",gsCodCliente)
XMLAddChild("DocXml","CodLocal",gsNumLocal)
XMLAddChild("DocXml","CodCaja",gsCodCaja)
XMLAddChild("DocXml","FecTrx",DateToString(DateSys(),"DD-MM-AAAA")+"
"+TimeToString(TimeSys(),"HH:MM:SS"))
XMLAddChild("DocXml","TipDoc",sTipDoc)
XMLAddChild("DocXml","ModDoc",sModDoc)
XMLAddChild("DocXml","Folio",sFolio)
XMLAddChild("DocXml","Totales","",True)
XMLAddChild("DocXml","TotBruto",NoSpace(NumToString(xTotBruto,"14d")))
XMLAddChild("DocXml","TotNeto",NoSpace(NumToString(xTotNeto,"14d")))
XMLAddChild("DocXml","TotImp",NoSpace(NumToString(xTotImp,"14d")))
sTrx=XMLBuildString("DocXml")

clSec.set_StrXml(sTrx)
sToken is UNICODE string
sToken=sRes
bres=clSec.AplicarSeguridad(sToken)

XMLClose("DocXml")

XmlDocument(doc)
XMLAddChild(doc,"soap:Envelope","",True)
XMLAddAttribute(doc,"xmlns:soap","http://www.w3.org/2003/05/soap-envelope")
XMLAddAttribute(doc,"xmlns:tem","http://tempuri.org/")
XMLAddChild(doc,"soap:Header","",True)
XMLAddAttribute(doc,"xmlns:wsa","http://www.w3.org/2005/08/addressing")
XMLAddChild(doc,"wsa:Action","http://tempuri.org/IWcfCP/EnviarTransaccion")
XMLAddChild(doc,"wsa:To","https://zofri.mekanosige.cl:2414/WcfCP.svc")
XMLParent(doc)
XMLAddChild(doc,"soap:Body","",True)
XMLAddChild(doc,"tem:EnviarTransaccion","",True) //tns
XMLAddChild(doc, "XmlTrx",clSec.get_StrXml())
sRequete=XMLBuildString(doc,XMLDocumentDefault,XMLEncodingUTF8)
//XMLDocumentDefault,XMLEncodingUTF8)
bres=HTTPRequest("https://zofri.mekanosige.cl:2414","pcsoft","",sRequete,"application/soap+xml")
IF NOT bres THEN
Error("Error en Envio Transacci贸n a Servicio Web Mekano")
RESULT "Error"
END
bufMensa=HTMLToText(HTTPGetResult())
//Todavia no se como procesar este mensaje.... ni los posibles resultados
sRes=Middle(bufMensa,Position(bufMensa,"Response")+8)
XMLClose(doc)
XMLClose(bufMensa)

IF sRes="true" THEN
Info("Transacci贸n procesada correctamente")
RESULT "Ok"
ELSE
Error("Transacci贸n rechazada!!!")
RESULT "Error"
END
Fivewin-Xharbour 24.09, Iquique, Chile
Posts: 336
Joined: Wed May 16, 2007 09:40 PM
Re: COMO SE PUEDE CREAR UN OBJETO
Posted: Sat Jun 14, 2014 11:28 PM
segundo ejemplo otro lenguaje y funciona

// web services
wspost.WcfCPClient client = new wspost.WcfCPClient();

string user = "Cliente5"; //;ConfigurationManager.AppSettings["UserCliente"]; //"Cliente5";
string clave = "3217"; //ConfigurationManager.AppSettings["PassCliente"]; //"3217";
string Token = client.Autenticar(user, clave);
if (Token == "")
{
MessageBox.Show("error al generar token");
return;
}

string ruta = ConfigurationManager.AppSettings[@"PathCert"]; //@"C:\interfaz\Config\zofri.pfx"; // cerificado instalada en pc
string clavecert = ConfigurationManager.AppSettings["PassCert"]; //"脪脣脪脡脳脵 艙啪隆";

cSecurity _cSec = new cSecurity(ruta, clavecert);
frm_menu.P_xml = @"c:\\archivoxml\\xml\\" + frm_menu.P_codemp + "\\" + tdoc + "-" + lblfol.Text + ".xml"; //asigno xml creado

//frm_menu.P_xml = @"C:\archivoxml\xml\"+frm_menu.P_codemp+"\"+ trans.xml";
StreamReader sr2 = new StreamReader(frm_menu.P_xml);

string arcxml1 = sr2.ReadToEnd();
string msg = arcxml1;
_cSec.StrXml = arcxml1;
if (_cSec.AplicarSeguridad(Token.Trim())) {
if (client.EnviarTransaccion(_cSec.StrXml)) {
MessageBox.Show("XML enviado correctamente");
}
else
{
MessageBox.Show("Error al enviar XML");
}


}
else
{
MessageBox.Show(_cSec.MsgEvent);
}
Fivewin-Xharbour 24.09, Iquique, Chile
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: COMO SE PUEDE CREAR UN OBJETO
Posted: Sun Jun 15, 2014 07:38 AM

En mi opini贸n deber铆a crearse usando CreateObject()

De todas formas, por que no contactais con el soporte t茅cnico de sus desarrolladores y le pedis ayuda y/o un ejemplo en C ?

Un ejemplo en C 贸 en C++ deber铆a servirnos para saber adaptarlo a Harbour.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 336
Joined: Wed May 16, 2007 09:40 PM
Re: COMO SE PUEDE CREAR UN OBJETO
Posted: Sun Jun 15, 2014 02:53 PM

Antonio.. Bueno voy a empezar de cero y empeze con esto pero me da error ademsa te envio una imagen de la DLL

include "Fivewin.ch"

include "Dll.Ch"

include "Objects.Ch"

include "Hbclass.ch"

FUNCTION md204()
LOCAL clObj,hLib
LOCAL PathCert:="\mlmall\config\pos\zofri.pfx"
LOCAL PassCert:="Ah2Cfg723rQ"
LOCAL cDllname:="\MLMall\Config\POS\MkSg.InterfazPOS.Security.dll"

hLib := loadlibrary(cDllName)

clObj:=CreateObject("cSecurity") // aca el error
clObj:cSecurity(PathCert,PassCert)

FreeLibrary(hLib)
return .t.

ERROR
Application
===========
Path and name: C:\SISTEMA\MODULO\Modulo.exe (32 bits)
Size: 7,748,608 bytes
Time from start: 0 hours 0 mins 8 secs
Error occurred at: 15/06/2014, 10:46:15
Error description: Error TOleAuto/65535 : TOLEAUTO:NEW
Args:
[ 1] = C cSecurity
[ 2] = U
[ 3] = U

Stack Calls

Called from: => THROW(0)
Called from: source\rtl\win32ole.prg => TOLEAUTO:NEW(346)
Called from: source\rtl\win32ole.prg => CREATEOBJECT(78)
Called from: MM204.PRG => MD204(14)
Called from: MODULO.PRG => (b)BUILDMENU(219)
Called from: .\source\classes\MENU.PRG => TMENU:COMMAND(484)
Called from: .\source\classes\WINDOW.PRG => TWINDOW:COMMAND(1048)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(3443)
Called from: => WINRUN(0)
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE(995)
Called from: MODULO.PRG => MAIN(136)

Fivewin-Xharbour 24.09, Iquique, Chile
Posts: 336
Joined: Wed May 16, 2007 09:40 PM
Re: COMO SE PUEDE CREAR UN OBJETO
Posted: Sun Jun 15, 2014 02:54 PM
Fivewin-Xharbour 24.09, Iquique, Chile
Posts: 336
Joined: Wed May 16, 2007 09:40 PM
Re: COMO SE PUEDE CREAR UN OBJETO
Posted: Sun Jun 15, 2014 03:32 PM

Hola Antonio,

Te envie la libreria por Email.... ya me encuentro sin ideas

Fivewin-Xharbour 24.09, Iquique, Chile
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: COMO SE PUEDE CREAR UN OBJETO
Posted: Sun Jun 15, 2014 04:12 PM

Elmo,

Por favor inspecciona tu DLL con esta utilidad que publiqu茅 aqui:

viewtopic.php?p=144733#p144733

y mu茅strame el resultado que genera, gracias

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: COMO SE PUEDE CREAR UN OBJETO
Posted: Sun Jun 15, 2014 04:14 PM
Me refiero al listado de toda la informaci贸n del objeto, como estos que se muestran aqui:

http://forums.fivetechsupport.com/viewtopic.php?p=144641#p144641
regards, saludos

Antonio Linares
www.fivetechsoft.com