43 lines
1.3 KiB
Plaintext
43 lines
1.3 KiB
Plaintext
IMPORT com
|
|
IMPORT XML
|
|
IMPORT os
|
|
|
|
FUNCTION recepcion(req,url)
|
|
DEFINE req com.HttpServiceRequest,
|
|
resp com.HttpResponse,
|
|
url,mensaje,contenido,rnc_e,rnc_c,e_ncf,tipoecf,filexml,filefirmado,cmd,tmpfile,recibido STRING,
|
|
doc xml.DomDocument
|
|
|
|
|
|
TRY
|
|
LET doc = xml.DomDocument.Create()
|
|
CALL doc.setFeature("whitespace-in-element-content",FALSE)
|
|
LET cmd = req.readFileRequest()
|
|
|
|
CALL doc.load(cmd)
|
|
|
|
# LET filexml = recibido
|
|
|
|
|
|
LET tmpfile = "./tmp/",os.Path.baseName(cmd),".",os.Path.extension(cmd)
|
|
|
|
CALL doc.save(tmpfile)
|
|
CALL getxmldata(tmpfile) RETURNING rnc_e,rnc_c,e_ncf,tipoecf
|
|
CALL doc.load(tmpfile)
|
|
|
|
LET filexml = "./recibidos/recepcion/originales/",rnc_e CLIPPED,e_ncf CLIPPED,".",os.Path.extension(cmd)
|
|
|
|
CALL doc.save(filexml)
|
|
CALL formaracuse(rnc_c,rnc_e,e_ncf) RETURNING filexml
|
|
CALL firmadocumento(filexml) RETURNING filefirmado
|
|
CALL doc.load(filefirmado)
|
|
LET mensaje = doc.saveToString()
|
|
|
|
DISPLAY "MENSAJE: ",mensaje
|
|
RETURN 200,mensaje
|
|
|
|
CATCH
|
|
RETURN 401,"Falla en el proceso del file"
|
|
END TRY
|
|
|
|
END FUNCTION |