Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
The below coding works well in IE. I also need to work this code in safari.

JavaScript
function Transmit_SOAP()
{
if(window.ActiveXObject)
{//For IE Browsers. This coding works well in IE browsers
var tempNode=xmlSoapTemplate.selectSingleNode(pathString+"xmlDatasets");
tempNode.appendChild(xmlDataReturn.documentElement);
}

else
{//verify the code below.(Safari Support)
alert("Checking");
try{
var tempNode=xmlSoapTemplate.evaluate(pathString+"xmlDatasets", xmlSoapTemplate, null, XPathResult.ANY_TYPE,null);
}
catch (e)
{
alert(e);
}
tempNode.appendChild(xmlDataReturn.documentElement);
}
}


Kindly verify the safari code. The code execution breaks after showing the alert("Checking");

This is the error when using try catch
TypeError: Value undefined (result of expression xmlSoapTemplate.evaluate) is not object

The below code is xmlSoapTemplate
JavaScript
if(window.ActiveXObject)
{
//For IE Support.
//Begin by loading up the dataform via soap request
xmlSoapTemplate=new ActiveXObject("Microsoft.XMLDOM");
xmlSoapTemplate.onreadystatechange = function () {
if (xmlSoapTemplate.readyState == 4) Transmit_SOAP()
};
			
xmlSoapTemplate.load("../Dataforms/soap_1.xml");
}

// For Safari Support
 else
 {
 xmlSoapTemplate = new XMLHttpRequest();
 xmlSoapTemplate.open('GET','../Dataforms/soap_1.xml', true);
 xmlSoapTemplate.onreadystatechange = function() {
 if (xmlSoapTemplate.readyState == 4) {
  Transmit_SOAP()
   }
  }
  xmlSoapTemplate.send();
 }
Posted
Updated 21-Feb-13 2:00am
v4
Comments
Ed Nutting 21-Feb-13 7:30am    
What were you trying to do? Can we see the complete code? (Since there are a lot of variables without any indication of what content they contain...) Any exception messages? Have you tried wrapping it in a try-catch(exception) block and reading the exception message? Have you used the built-in Safari debugger? Have you Google'd what are trying to do to see if anyone else has solved whatever issue(s) you are having?

There are too many unknowns for this question to be answerable. Please use the "Improve question" link above to update your question.

Thanks,
Ed
Mohan1984 21-Feb-13 7:59am    
Improved my question. Kindly verify.
Ed Nutting 21-Feb-13 8:12am    
Much improved :) I now have at least some idea what your code is trying to do (and how :) ). Next step is to find out what it thinks is 'undefined'. Try opening the code in the Safari debugger and pause on the line that's giving you the error. Then check the values of all the inputs to the method (i.e. pathString, xmlSoapTemplate) - check to see if they are undefined. Also, search the web a bit and check that this is possible - you may need to convert the data that comes from the XMLHttpRequest into a proper XMLDocument (or XMLElement) which the request object is not. Essentially, I don't think the "evaluate" method exists on the XMLHttpRequest object. Search Google for how to convert XMLHttpRequest to XMLDocument then use the same code as you have but with the XMLDocument in place of xmlSoapTemplate for your parse code (not the request code - that can stay the same :) ).

Hope this helps,
Ed
Mohan1984 21-Feb-13 8:31am    
alert(pathString+"xmlDatasets");
/// In Safari and IE it shows-->soap:Envelope/soap:Body/Update_DatasetsWiz/xmlDatasets

1 solution

C#
void compatibility()
    {
        if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
        {
            Request.Browser.Adapters.Clear();
        }
    }

paste this code on page load event
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900