Note that there are some explanatory texts on larger screens.

plurals
  1. POPhonegap + Android status=0 returned from webservice
    text
    copied!<p>Phonegap Crew,</p> <p>I have an problem with accessing a webservice using android. I have no problem accessing it using iOS. The enclosed code uses a public webservice so you can try the code if you are so inclined.</p> <p>On iOS we get a xmlhttp.status == 200 and returned data. On Android we get a xmlhttp.status == 0.</p> <p>We are using cordova-1.8.1.jar</p> <p>We have the white list set in res/xml/cordova.xml like this: </p> <pre><code>&lt;access origin=".*"/&gt; </code></pre> <p>I am bring that up because I am suspicious that our white list is not working.</p> <p>here is the code:</p> <pre><code>function testweather(){ var xhr= new XMLHttpRequest(); xhr.onreadystatechange = function(){ alert(xhr.readyState); if(xhr.readyState == 4){ if(xhr.status == 200){ $( "#result" ).append( xhr.responseText ); } else{ alert("can't get response. a.status:"+xhr.status); } } } var url = "http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php"; xhr.open("POST", url,true); xhr.setRequestHeader("SOAPAction", "http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl#NDFDgenByDayLatLonList"); xhr.setRequestHeader("Content-Type", "text/xml;charset=UTF-8"); xhr.setRequestHeader("Content-Length", 1536); xhr.setRequestHeader("Access-Control-Allow-Origin", "*"); xhr.setRequestHeader("Accept", "application/soap+xml, application/dime, multipart/related, text/*"); xhr.setRequestHeader("User-Agent", "IBM Web Services Explorer"); xhr.setRequestHeader("Cache-Control", "no-cache"); xhr.setRequestHeader("Pragma", "no-cache"); xhr.setRequestHeader("Connection", "close"); var soapEnv = '' + '&lt;soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ndf="http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl"&gt;' + ' &lt;soapenv:Header/&gt;' + ' &lt;soapenv:Body&gt;' + ' &lt;ndf:NDFDgenByDayLatLonList soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;' + ' &lt;listLatLon xsi:type="dwml:listLatLonType" xmlns:dwml="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd"&gt;35.4,-97.6&lt;/listLatLon&gt;' + ' &lt;startDate xsi:type="xsd:date"&gt;2012-06-27&lt;/startDate&gt;' + ' &lt;numDays xsi:type="xsd:integer"&gt;3&lt;/numDays&gt;' + ' &lt;Unit xsi:type="dwml:unitType" xmlns:dwml="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd"&gt;e&lt;/Unit&gt;' + ' &lt;format xsi:type="dwml:formatType" xmlns:dwml="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd"&gt;24 hourly&lt;/format&gt;' + ' &lt;/ndf:NDFDgenByDayLatLonList&gt;' + ' &lt;/soapenv:Body&gt;' + '&lt;/soapenv:Envelope&gt;'; xhr.send( soapEnv ); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload