我正在尝试在 Titanium Studio(版本 2.1.1)中构建的移动应用程序中测试接收 SOAP 响应。我正在使用 suds 库来执行此操作,但是当我调用它时,我收到错误
[WARN] Exception in event callback. {<br/>
line = 27;<br/>
message = "Can't find variable: window"
我不太确定为什么会收到这个消息,我包含了 suds.js 库,并且应用程序不会崩溃,只是不会发送。我用来实现这个的代码是:
var suds = new SudsClient({
endpoint: 'http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL',
targetNamespace: 'http://ws.cdyne.com/'
});
var soapBtn = Ti.UI.createButton({
title:'SOAP',
bottom:'100'
});
homeHolder.add(soapBtn);
var callParams = {
ZIP:'33325'
};
soapBtn.addEventListener('click',function(e){
suds.invoke("GetCityForecastByZIP", callParams, function(xmlDoc) {
var response = xmlDoc.documentElement.getElementsByTagName('GetCityForecastByZIPResult');
Ti.API.info(response);
});
我做错了什么?谢谢!
最佳答案
您收到此错误是因为您没有使用针对钛的修改后的 suds.js,您可以从厨房水槽示例或 suds github 上的钛移动示例中获得正确的错误 https://github.com/kwhinnery/Suds/tree/master/TitaniumMobileExample/CurrencyConverter/Resources
关于javascript - "Can' t 查找变量 : window"in suds. js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12268280/