|
|
Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
I am custom submitting a form to a webservice but it is giving following error.... "-2146697208. The Download of the specified resource has failed"
can anybody please explain the reason and provide solution. Any help will be appreciated. Thanks
function SoapPost(objXmlHttp, strUrl) { var root var objXmlSoapDoc = new ActiveXObject("MSXML2.DOMDocument.5.0") objXmlSoapDoc.async = false;
// create the SOAP envelope var objCurrentNode; var objNewNode = objXmlSoapDoc.createElement("soap:Envelope") objNewNode.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance") objNewNode.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema") objNewNode.setAttribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/") objXmlSoapDoc.appendChild(objNewNode) objCurrentNode = objNewNode; // objCurrentNode points to "soap:Envelope" element
objNewNode = objXmlSoapDoc.createElement("soap:Body") objCurrentNode.appendChild(objNewNode) objCurrentNode = objNewNode; // objCurrentNode points to "soap:Body" element
objNewNode = objXmlSoapDoc.createElement("EDI_TranslateFile") objNewNode.setAttribute("xmlns", "http://localhost/ediapiwebservice") objCurrentNode.appendChild(objNewNode) objCurrentNode = objNewNode; // objCurrentNode points to "SubmitInfoPathDocument" element objNewNode = objXmlSoapDoc.createElement("strFileName") objCurrentNode.appendChild(objNewNode) objNewNode.text= "problem.xml" /*objCurrentNode = objNewNode; // objCurrentNode points to "objXmlDoc" element
// wrap the whole InfoPath document in an additional root element // this is required to bypass the SOAP 1.1 processing-instructions limitation objNewNode = objXmlSoapDoc.createElement("root") objCurrentNode.appendChild(objNewNode) objCurrentNode = objNewNode; // objCurrentNode points to "root" element
// add InfoPath processing-instructions as children of the <root> element var colPiNodes = XDocument.DOM.selectNodes("//processing-instruction()") for (var i=0; i<colPiNodes.length; i++) objCurrentNode.appendChild(colPiNodes.item(i).cloneNode(true))
// copy InfoPath document from DataDOM to <objXmlDoc> element // objXmlSoapDoc.save("c:\problem.xml") objNewNode = XDocument.DOM.documentElement.cloneNode(true) objCurrentNode.appendChild(objNewNode)
// debug: XDocument.UI.Alert("XMLHTTP about to send:\n\n" + objXmlSoapDoc.xml) */ // post xml document to strUrl objXmlHttp.open("POST", strUrl, false) objXmlHttp.setRequestHeader("POST","/ediapiwebservice/ediapiweb.asmx HTTP/1.1") objXmlHttp.setRequestHeader("Host","localhost") objXmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8") objXmlHttp.setRequestHeader("Content-Length", String(objXmlSoapDoc.xml /* sContent */).length) objXmlHttp.setRequestHeader("SOAPAction", "http://localhost/ediapiwebservice/ediapiweb.asmx?op=EDI_TranslateFile") try { objXmlHttp.send(objXmlSoapDoc.xml) } catch(ex) { XDocument.UI.Alert("Could not post (SOAP) document to " + strUrl + "\r\n" + ex.number + " - " + ex.description) return false; }
// check server HTTP response if (objXmlHttp.Status != 200) { HandleServerError(objXmlHttp, strUrl) return false; } else { // debug: XDocument.UI.Alert("200 OK returned:\r\n\r\n" + objXmlHttp.responseText) }
// even if HTTP response is 200, server might have rejected document because <blnSubmitSuccess> tag contained false, // so check value of <fDocumentAccepted> in XML returned objNode = objXmlHttp.responseXML.selectSingleNode("//*[local-name(.) = 'SubmitInfoPathDocumentResult']") if (objNode == null) { // <SubmitInfoPathDocumentResult> tag found in server response: the document was not accepted HandleServerError(objXmlHttp, strUrl) return false; }
var blnSubmitSuccess = String(objNode.selectSingleNode("*[local-name(.) = 'ServerResponse']/*[local-name(.) = 'blnDocumentAccepted']").text).toLowerCase() if (blnSubmitSuccess != "true") { // the document was not accepted, add modeless error to error board AddErrorToDocument(objNode) return false; }
return true; }
|
|
|