Files
MBS/WEBSERVICES/test/recepcion.4gl
T

45 lines
1.3 KiB
Plaintext

IMPORT com
IMPORT XML
DEFINE method,mensaje,url STRING
PUBLIC FUNCTION recepcion ( filexml string ) ATTRIBUTES( WSPost,
WSPath="/recepcion/api/ecf/",
WSDescription="Api para la recepcion de los e-NCF",
WSRetCode="200:ok")
DEFINE req com.HttpServiceRequest
DEFINE resp,fileafirmar_f,method STRING
DEFINE rcode INT
DEFINE doc xml.DomDocument
LET method = req.getMethod()
LET url = req.getUrl()
IF method = "GET" THEN
LET mensaje = "Bienvenido al API Server del servicio ",url CLIPPED
END IF
IF method = "POST" THEN
CALL read_request(req,"recepcion") RETURNING rcode,resp
IF rcode <> "200" THEN
CALL req.sendTextResponse(501,NULL,"No pudimos procesar el file")
ELSE
LET doc = xml.DomDocument.Create()
CALL doc.setFeature("format-pretty-print",TRUE)
CALL doc.load(fileafirmar_f)
CALL req.sendXmlResponse(200,NULL,doc)
# CALL req.sendTextResponse(200,NULL,resp)
END IF
END IF
END FUNCTION