by 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-Xharbour 24.09, Iquique, Chile