67 lines
2.2 KiB
Plaintext
67 lines
2.2 KiB
Plaintext
<%@ language = "JavaScript" %>
|
|
<% Server.ScriptTimeout=6000; %>
|
|
<% /*
|
|
$Revision$
|
|
$Id$
|
|
|
|
File: api_gen_import.asp
|
|
Description: API voor het importeren van data uit xmlbestanden.
|
|
Werking werkt naar analogie van gen_import.
|
|
Parameters: Upload van een xml
|
|
Status:
|
|
Context:
|
|
Notes: Technisch is xml niet per se noodzakelijk, CSV kunnen we ook aan
|
|
*/
|
|
DOCTYPE_Disable = 1;
|
|
THIS_FILE = "appl/api/api_gen_import.asp";
|
|
%>
|
|
<!-- #include file="../../appl/Shared/common.inc" -->
|
|
<!-- #include file="../../appl/api/api.inc" -->
|
|
<!-- #include file="../../appl/api/api_gen_import.inc" -->
|
|
<!-- #include file="../../appl/shared/FlexFiles.inc" -->
|
|
<!-- #include file="../Shared/xml_converter.inc" -->
|
|
<script language="javascript" src="../imp/imp_shared.js" runat="server"></script>
|
|
<%
|
|
// We sturen het antwoord in UTF-8.
|
|
Session.Codepage = 65001;
|
|
Response.Charset = 'utf-8';
|
|
|
|
var API = new API_func();
|
|
|
|
var bytes = Request.TotalBytes;
|
|
if (bytes <= 0) // Chunked encoding geeft -1
|
|
{
|
|
__DoLog("api_gen_import empty body posted", "#ffff00");
|
|
if (String(Request.Servervariables("HTTP_TRANSFER_ENCODING")) == "chunked")
|
|
{
|
|
__DoLog("De body is met chunked encoding gePOST, dat kan IIS niet aan (FCLT#76770)");
|
|
}
|
|
Response.Write("Error: no data posted for API import");
|
|
Response.End; // Grof maar anders AiAi, dat is nog erger
|
|
}
|
|
|
|
"Error 'Operation not Allowed' op de volgende regel betekent meestal dat de upload te groot is";
|
|
var result = api_gen_import(API, Request.BinaryRead(bytes));
|
|
xmlResp = result.xmldom;
|
|
|
|
if (API.apidata.errorhandling == 1 && user.errorhandling() == 1)
|
|
{
|
|
if (result.anyError) // een 'E' in imp_log
|
|
{
|
|
Response.Status = '400 Bad Request';
|
|
}
|
|
}
|
|
|
|
Response.ContentType = "text/xml";
|
|
if (API.apidata.stylesheet_out)
|
|
{
|
|
var params = {};
|
|
STR2Stream(xmlResp.xml, API.apidata.stylesheet_out, Response, params);
|
|
}
|
|
else
|
|
Response.Write(xmlResp.xml);
|
|
|
|
|
|
ASPPAGE_END();
|
|
%>
|