COMO SE PUEDE CREAR UN OBJETO

COMO SE PUEDE CREAR UN OBJETO

Postby elmoiquique » Thu Jun 12, 2014 7: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 11.07
elmoiquique
 
Posts: 297
Joined: Wed May 16, 2007 9:40 pm
Location: Iquique Chile

Re: COMO SE PUEDE CREAR UN OBJETO

Postby Antonio Linares » Fri Jun 13, 2014 4:22 pm

Te refieres a un objeto en C++ ?

ó es un objeto OLE ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: COMO SE PUEDE CREAR UN OBJETO

Postby elmoiquique » Fri Jun 13, 2014 8: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 11.07
elmoiquique
 
Posts: 297
Joined: Wed May 16, 2007 9:40 pm
Location: Iquique Chile

Re: COMO SE PUEDE CREAR UN OBJETO

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: COMO SE PUEDE CREAR UN OBJETO

Postby elmoiquique » Sat Jun 14, 2014 6: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 11.07
elmoiquique
 
Posts: 297
Joined: Wed May 16, 2007 9:40 pm
Location: Iquique Chile

Re: COMO SE PUEDE CREAR UN OBJETO

Postby Antonio Linares » Sat Jun 14, 2014 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: COMO SE PUEDE CREAR UN OBJETO

Postby elmoiquique » 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("Token",cResponse)
cresponse:=substr(cresponse,buscar1)
buscarA:=AT("gt;",cResponse)
buscarB:=AT("&lt",cResponse)
len_ab:=buscarB-buscarA
ts_token:=substr(cresponse,buscarA+3,len_ab-3)

cRetorno=oemtoansi("Comunicaci¢n Establecida Con Servidor")
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
Last edited by elmoiquique on Sat Jun 14, 2014 11:32 pm, edited 3 times in total.
Fivewin 11.07
elmoiquique
 
Posts: 297
Joined: Wed May 16, 2007 9:40 pm
Location: Iquique Chile

Re: COMO SE PUEDE CREAR UN OBJETO

Postby elmoiquique » 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
Last edited by elmoiquique on Sat Jun 14, 2014 11:34 pm, edited 1 time in total.
Fivewin 11.07
elmoiquique
 
Posts: 297
Joined: Wed May 16, 2007 9:40 pm
Location: Iquique Chile

Re: COMO SE PUEDE CREAR UN OBJETO

Postby elmoiquique » 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 11.07
elmoiquique
 
Posts: 297
Joined: Wed May 16, 2007 9:40 pm
Location: Iquique Chile

Re: COMO SE PUEDE CREAR UN OBJETO

Postby Antonio Linares » Sun Jun 15, 2014 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: COMO SE PUEDE CREAR UN OBJETO

Postby elmoiquique » Sun Jun 15, 2014 2: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 11.07
elmoiquique
 
Posts: 297
Joined: Wed May 16, 2007 9:40 pm
Location: Iquique Chile

Re: COMO SE PUEDE CREAR UN OBJETO

Postby elmoiquique » Sun Jun 15, 2014 2:54 pm

Fivewin 11.07
elmoiquique
 
Posts: 297
Joined: Wed May 16, 2007 9:40 pm
Location: Iquique Chile

Re: COMO SE PUEDE CREAR UN OBJETO

Postby elmoiquique » Sun Jun 15, 2014 3:32 pm

Hola Antonio,

Te envie la libreria por Email.... ya me encuentro sin ideas
Fivewin 11.07
elmoiquique
 
Posts: 297
Joined: Wed May 16, 2007 9:40 pm
Location: Iquique Chile

Re: COMO SE PUEDE CREAR UN OBJETO

Postby Antonio Linares » Sun Jun 15, 2014 4: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: COMO SE PUEDE CREAR UN OBJETO

Postby Antonio Linares » Sun Jun 15, 2014 4: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 87 guests