android – 无法读取null的属性’documentElement’

从Phonegap Android应用程序调用Web服务时,我收到此错误.

01-13 23:49:52.219: E/Web Console(529): Uncaught TypeError: Cannot read property ‘documentElement’ of null at file:///android_asset/www/soapclient.js:158

这是相关代码

var ns = (wsdl.documentElement.attributes["targetNamespace"] + "" == "undefined") ?
wsdl.documentElement.attributes.getNamedItem("targetNamespace").nodeValue :  
wsdl.documentElement.attributes["targetNamespace"].value;

解决方法

它可能是因为跨域请求,CORS
所以要么你必须把它包括在你的heades中

Accept: Access-Control-Allow-Origin

或者也使用

chrome.exe --disable-web-security

或者您也可以安装chrome扩展

Enable cors request extention in chrome

希望它会有所帮助.

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...