FSN#28031 PutOrders: Response van xml wordt alleen gecontroleerd als extensie cxml is.

svn path=/Website/trunk/; revision=25737
This commit is contained in:
Erik Groener
2015-07-28 11:16:41 +00:00
parent 74d6c70aa7
commit 78e93dfc2c
3 changed files with 55 additions and 30 deletions

View File

@@ -100,11 +100,16 @@ function connectHTTP( p_connect
var HTTPresult = submitHTTP( p_connect
, p_textstream
, p_bedrijfadres);
if (HTTPresult >= 200 && HTTPresult <= 299)
{
resultcode = 0;
}
Log2File(2, "HTTPresult: " + HTTPresult);
resultcode = 0;
if (p_bedrijfadres.extension == "cxml" || p_bedrijfadres.extension == "xml")
{
var XMLresult = new ActiveXObject("Msxml2.DOMDocument.6.0");
var xmlDoc = SafeLoadTextXML(HTTPresult);
TestAndRaiseAnXMLError("Error in xXML http response", xmlDoc);
}
}
else if (p_bedrijfadres.ordermode & 1)
{
@@ -119,7 +124,7 @@ function connectHTTP( p_connect
// SOAPresult bevat nu doorgaans een cXML response, anders was er wel een error geraised
//
// Van cxml gaan we nog weer controleren of het verzendresultaat goed is
if (p_bedrijfadres.extension == "cxml")
if (p_bedrijfadres.extension == "cxml" || p_bedrijfadres.extension == "xml")
{
var XMLresult = new ActiveXObject("Msxml2.DOMDocument.6.0");
var xmlDoc = SafeLoadTextXML(SOAPresult);
@@ -127,11 +132,11 @@ function connectHTTP( p_connect
TestAndRaiseAnXMLError("Error in xXML soap response", xmlDoc);
xmlDoc.transformNodeToObject(p_xsldoc, XMLresult);
Log2File(3, "cXML response: " + XMLresult.xml);
TestAndRaiseAnXMLError("Analyseren cXML response", XMLresult);
Log2File(3, "(c)XML response: " + XMLresult.xml);
TestAndRaiseAnXMLError("Analyseren (c)XML response", XMLresult);
if (XMLresult.text != "")
{
Log2File(1, "cXML resultaat error: " + XMLresult.xml);
Log2File(1, "(c)XML resultaat error: " + XMLresult.xml);
resultcode = 1;
errText = XMLresult.text;
}
@@ -370,7 +375,7 @@ function SendOrder( p_connect
}
streamResult.Open();
if (p_bedrijfadres.extension == "xml")
if (p_bedrijfadres.extension == "xml" || p_bedrijfadres.extension == "cxml")
{
result = XML2HTML( p_xmlData
, p_xslPath

View File

@@ -17,50 +17,66 @@ function submitHTTP( p_connect
//
Log2File(2, "*> submitHTTP");
var httpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
var XMLhttp = new ActiveXObject("Msxml2.ServerXMLHTTP.6.0");
// contanten in msxml2
var SXH_PROXY_SET_PROXY = 2;
var SXH_OPTION_SELECT_CLIENT_SSL_CERT = 3;
//
// Verstuur de HTTP aanvraag
if (S("puo_useproxy"))
{
var HTTPREQUEST_PROXYSETTING_PROXY = 2;
var proxy_ip = S("puo_proxyserveripaddress");
Log2File(1, "Opening proxy " + proxy_ip);
httpReq.setProxy(HTTPREQUEST_PROXYSETTING_PROXY, proxy_ip);
XMLhttp.setProxy(SXH_PROXY_SET_PROXY, proxy_ip);
}
var endpoint = p_connect.CurrentAddress;
if (p_bedrijfadres.certificateName != "")
{
Log2File(1, "certificateName= " + p_bedrijfadres.certificateName);
httpReq.SetClientCertificate(p_bedrijfadres.certificateName);
var arrNames = p_bedrijfadres.certificateName.split(":"); // Certificaatnaam / Usernaam / wachtwoord gescheiden door ':'
if (arrNames.length == 3) // Nog even laten staan voor backwards compatible
{ // Veel beter is echter om p_bedrijfadres.username/password te gebruiken
p_bedrijfadres.username = arrNames[1];
p_bedrijfadres.password = arrNames[2];
XMLhttp.SetOption(SXH_OPTION_SELECT_CLIENT_SSL_CERT, arrNames[0]);
}
else // Certificaat naam
{
XMLhttp.SetOption(SXH_OPTION_SELECT_CLIENT_SSL_CERT, p_bedrijfadres.certificateName);
}
}
XMLhttp.Open("POST", endpoint, false, p_bedrijfadres.username, p_bedrijfadres.password);
Log2File(1, "connect.CurrentAddress: " + endpoint);
httpReq.Open("POST", p_connect.CurrentAddress, false);
Log2File(1, "connect.CurrentAddress: " + p_connect.CurrentAddress);
// onderstaande is verouderd nu we met winhttpreq werken
// De volgende regels zijn alleen nodig als het certificaat (nog) niet vertrouwd wordt.
// Op te lossen door cacert.der van csnet te installeren
// secu = xmlHTTP.getOption(SXH_OPTION_IGNORE_SERVER_SSL_CERT_ERROR_FLAGS)
// secu = XMLhttp.getOption(SXH_OPTION_IGNORE_SERVER_SSL_CERT_ERROR_FLAGS)
// secu = secu Or SXH_SERVER_CERT_IGNORE_UNKNOWN_CA
// Call xmlHTTP.setOption(SXH_OPTION_IGNORE_SERVER_SSL_CERT_ERROR_FLAGS, secu)
httpReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
// Call XMLhttp.setOption(SXH_OPTION_IGNORE_SERVER_SSL_CERT_ERROR_FLAGS, secu)
XMLhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
if (p_bedrijfadres.username != "")
{
var base64 = new Base64Cls();
httpReq.setRequestHeader("Authorization", "Basic " + base64.encode(p_bedrijfadres.username + ":" + p_bedrijfadres.username.password));
XMLhttp.setRequestHeader("Authorization", "Basic " + base64.encode(p_bedrijfadres.username + ":" + p_bedrijfadres.username.password));
}
httpReq.send(p_textstream);
Log2File(1, "httpReq.Status: " + httpReq.Status);
if (httpReq.Status < 200 || httpReq.Status > 299)
XMLhttp.send(p_textstream);
Log2File(1, "XMLhttp.status: " + XMLhttp.status);
if (XMLhttp.status < 200 || XMLhttp.status > 299)
{
Log2File(1, "httpReq.text: " + httpReq.statusText);
Log2File(1, "httpReq.responseText: " + (httpReq.responseText||"<leeg>"));
RaiseAnError(httpReq.Status, "httpReq error " + httpReq.Status + ": (" + httpReq.statusText + ")")
Log2File(1, "HTTP response: " + (XMLhttp.responseText||"<leeg>"));
Log2File(1, "response Status: " + XMLhttp.status + ": " + XMLhttp.statusText);
Log2File(3, "response Headers: " + XMLhttp.getAllResponseHeaders);
RaiseAnError(XMLhttp.status, "XMLhttp error " + XMLhttp.status + ": (" + XMLhttp.statusText + ")")
}
else
{
Log2File(3, "HTTP response = " + httpReq.responseText);
Log2File(3, "HTTP response = " + XMLhttp.responseText);
}
Log2File(2, "*< submitHTTP");
return httpReq.Status;
return XMLhttp.responseText;
}

View File

@@ -21,7 +21,9 @@ function submitDOMXSLSOAP( p_connect
var XMLresult = new ActiveXObject("Msxml2.DOMDocument.6.0");
var XMLhttp = new ActiveXObject("Msxml2.ServerXMLHTTP.6.0");
var Base64 = new Base64Cls();
var SXH_PROXY_SET_PROXY = 2; // contante in msxml2
// contanten in msxml2
var SXH_PROXY_SET_PROXY = 2;
var SXH_OPTION_SELECT_CLIENT_SSL_CERT = 3;
//
// Omvat onze payload met de SOAPEnvelope uit de p_xsldoc stylesheet
// p_bedrijfadres.ordermode
@@ -68,7 +70,7 @@ function submitDOMXSLSOAP( p_connect
var endpoint = p_connect.CurrentAddress;
if (p_bedrijfadres.certificateName != "")
{
var SXH_OPTION_SELECT_CLIENT_SSL_CERT = 3;
Log2File(1, "certificateName= " + p_bedrijfadres.certificateName);
var arrNames = p_bedrijfadres.certificateName.split(":"); // Certificaatnaam / Usernaam / wachtwoord gescheiden door ':'
if (arrNames.length == 3) // Nog even laten staan voor backwards compatible
{ // Veel beter is echter om p_bedrijfadres.username/password te gebruiken
@@ -82,6 +84,7 @@ function submitDOMXSLSOAP( p_connect
}
}
XMLhttp.open("POST", endpoint, false, p_bedrijfadres.username, p_bedrijfadres.password); // async=false dus synchroon
Log2File(1, "connect.CurrentAddress: " + endpoint);
// De volgende regels zijn alleen nodig als het certificaat (nog) niet vertrouwd wordt.
// Op te lossen door cacert.der van csnet te installeren
@@ -91,6 +94,7 @@ function submitDOMXSLSOAP( p_connect
XMLhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
XMLhttp.send(XMLresult.xml);
// UWVA#19897: we rekenen de hele 2xx maar goed
Log2File(1, "XMLhttp.status: " + XMLhttp.status);
if (XMLhttp.status < 200 || XMLhttp.status > 299)
{
Log2File(2, "SOAP response = " + XMLhttp.responseText); // Level 2 omdat het soms dagen doorloopt en te groot is