var button = Ti.UI.createButton({
left: 180,
top: 180,
width: 100,
hight: 30,
title: 'Go'
});
self.add(button);
button.addEventListener('click', function() {
var xhr = Ti.Network.createHTTPClient();
var authstr = 'Basic ' +Titanium.Utils.base64encode('S0009231839'+':'+ 'm8390967743!');
xhr.open("GET","http://erp.esworkplace.sap.com/sap/bc/srt/wsdl/bndg_DF52FF9E9AF025F18F0400145E5ADE89/wsdl11/allinone/ws_policy/document?sap-client=800");
xhr.setRequestHeader('Authorization', authstr);
xhr.setRequestHeader('Content-Type','text/xml');
xhr.setRequestHeader('Accept-Language','en');
alert('show');
xhr.onload = function(e)
{ try
{
//get the xml data and let it roll!
var doc = this.responseXML.documentElement;
// var items = doc.getElementsByTagName("atom:entry");
var items = doc.getElementsByTagName("wsdl:portType");
for(var c=0; c<items.length;c++){
var item = items.item(c);
alert(items.length);
var attributeEmployeeLeave = items.item(c).attributes.getNamedItem("name").nodeValue;
Ti.API.info(items.item(c).attributes.getNamedItem("name").nodeValue);
}
}
catch(E)
{
alert('error on xhr');
}
按钮的响应addEventListener
不起作用
我不知道为什么!
任何人都可以给我建议!