Dojo 1.9 を使用してアプリケーションを開発しました。
その中で、HTTP アダプターを使用して SOAP Web サービスからデータをフェッチしようとしています。
Worklight Console の MBS でアプリケーションをプレビューするときに Build All と Deploy を実行すると、Android 2.2 AVD (スクリーン ショット #2 を参照) と同様に正常に動作します (以下のスクリーン ショット #1 を参照)。
実際のデバイスでアプリを実行すると、常に「Request Failed!」が返されます。
別のネットワークに接続されている実際のデバイスで動作させる方法はありますか?
impl.js ファイルでの SOAP メッセージの作成を見逃していませんか?
SOAP リクエスト呼び出しを行うために必要ですか?
はいの場合、SOAP メッセージを生成する方法を教えてください。
アダプター BseNsePrice-impl.js:
function BSENSEPrice(Exchng) {
var path = 'ClientStockService.asmx/BSENSEPrice';
var input = {
method : 'get',
returnedContentType : 'text/xml; charset=utf-8',
path : path,
parameters: {'Exchng': Exchng}
};
return WL.Server.invokeHttp(input);
}
アプリケーション JavaScript:
function wlCommonInit(){
require([ "layers/core-web-layer", "layers/mobile-ui-layer" ], dojoInit);
}
function dojoInit() {
require([ "dojo/ready", "dojo/parser", "dojox/mobile", "dojo/dom", "dijit/registry", "dojox/mobile/ScrollableView", "dojox/mobile/Heading", "dojox/mobile/RoundRectList", "dojox/mobile/ListItem", "dojox/mobile/View", "dojox/mobile/Container", "dojox/mobile/ContentPane", "dojox/mobile/TabBar", "dojox/mobile/TabBarButton" ], function(ready) {
ready(function() {
});
});
}
function mobBSENSEPrice(Exchng) {
var invocationData = {
adapter : 'BSENSEPrice',
procedure : 'BSENSEPrice',
parameters : []
};
WL.Client.invokeProcedure(invocationData,{
onSuccess : mobBSENSEPriceSuccess,
onFailure : mobBSENSEPriceFailure,
});
};
function mobBSENSEPriceSuccess(result) {
var httpStatusCode = result.status;
var div = $("#invokeResult");
/*var span = $("#value");*/
if (200 == httpStatusCode) {
var invocationResult = result.invocationResult;
var isSuccessful = invocationResult.isSuccessful;
if (true == isSuccessful) {
var data = invocationResult.DataSet.diffgram.NewDataSet.Table;
for (var i=0;i<data.length;i++)
{
div.append(data[i].SYMBOL);
div.append('<br>');
div.append(data[i].PRICE);
div.append('<br>');
div.append('<strong>Change:</strong> ' + data[i].PER_CHANGE);
div.append('<br>');
div.append('<strong>Change(%) :</strong> ' + data[i].ChangePer);
div.append('<br>');
div.append('<br>');
}
}
else {
div.append("Request Failed....!");
}
}
else {
div.append("Request Failed!");
}
}
function mobBSENSEPriceFailure(result){
var div = $("#invokeResult");
div.append("Request Failed!");
}
LogCat:
07-24 11:27:08.227: I/dalvikvm(326): Could not find method org.apache.cordova.CordovaWebView.setOverScrollMode, referenced from method org.apache.cordova.DroidGap.init
07-24 11:27:08.227: W/dalvikvm(326): VFY: unable to resolve virtual method 12024: Lorg/apache/cordova/CordovaWebView;.setOverScrollMode (I)V
07-24 11:27:08.227: D/dalvikvm(326): VFY: replacing opcode 0x6e at 0x0043
07-24 11:27:08.267: I/CordovaLog(326): Changing log level to DEBUG(3)
07-24 11:27:08.277: I/CordovaLog(326): Found preference for exit-on-suspend=false
07-24 11:27:08.277: D/CordovaLog(326): Found preference for exit-on-suspend=false
07-24 11:27:08.277: D/DroidGap(326): DroidGap.onCreate()
07-24 11:27:08.317: I/dalvikvm(326): Could not find method android.webkit.WebView.<init>, referenced from method org.apache.cordova.CordovaWebView.<init>
07-24 11:27:08.317: W/dalvikvm(326): VFY: unable to resolve direct method 536: Landroid/webkit/WebView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;IZ)V
07-24 11:27:08.317: D/dalvikvm(326): VFY: replacing opcode 0x70 at 0x0001
07-24 11:27:08.317: D/dalvikvm(326): VFY: dead code 0x0004-0046 in Lorg/apache/cordova/CordovaWebView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;IZ)V
07-24 11:27:08.737: D/JsMessageQueue(326): Set native->JS mode to 2
07-24 11:27:08.737: I/CordovaWebView(326): Disabled addJavascriptInterface() bridge since Android version is old.
07-24 11:27:08.767: E/dalvikvm(326): Could not find class 'android.webkit.WebResourceResponse', referenced from method org.apache.cordova.CordovaWebViewClient.getWhitelistResponse
07-24 11:27:08.767: W/dalvikvm(326): VFY: unable to resolve new-instance 176 (Landroid/webkit/WebResourceResponse;) in Lorg/apache/cordova/CordovaWebViewClient;
07-24 11:27:08.767: D/dalvikvm(326): VFY: replacing opcode 0x22 at 0x000b
07-24 11:27:08.767: D/dalvikvm(326): VFY: dead code 0x000d-0014 in Lorg/apache/cordova/CordovaWebViewClient;.getWhitelistResponse ()Landroid/webkit/WebResourceResponse;
07-24 11:27:08.777: W/dalvikvm(326): VFY: unable to find class referenced in signature (Landroid/webkit/WebResourceResponse;)
07-24 11:27:08.777: W/dalvikvm(326): VFY: unable to find class referenced in signature (Landroid/webkit/WebResourceResponse;)
07-24 11:27:08.777: W/dalvikvm(326): VFY: unable to find class referenced in signature (Landroid/webkit/WebResourceResponse;)
07-24 11:27:08.797: D/DroidGap(326): DroidGap.init()
07-24 11:27:08.937: I/UICAndroid(326): {LoggingLevel=3, AddCookieDomain=false, PostMessageTimeout=60000, CookiePath=/, CookieParam=, KillSwitchTimeInterval=180, BufferPercent=20, HasToPersistLocalCache=true , MessageTypeHeader=WorklightHit, CookieDomain=, WhiteListParam=id, LibraryVersion=8.8.1.0, MaskIdList=com.tealeaf.sp:id/EditText*,com.tealeaf.sp:id/login.password, PostMessageLevelWiFi=3, UseRandomSample=false, KillSwitchMaxNumberOfTries=3, SensitiveCapitalCaseAlphabet=X, FilterMessageTypes=true, PostMessageTimeIntervals=30, SensitiveSmallCaseAlphabet=x, CompressPostMessage=true, PostMessageMaxBytesSize=20000, SensitiveSymbol=#, PostMessageLevelCellular=3, MessageTypes=4,5,6, PostMessageSocketTimeout=60000, CookieUrl=, UseWhiteList=true, KillSwitchUrl=, KillSwitchEnabled=false, MessageVersion=2.1.0.0, HasMasking=true, TimeIntervalBetweenSnapshots=60, PostMessageUrl=@USE_WORKLIGHT_DEFAULT@, CachedFileMaxBytesSize=512000, BufferLimit=100, AddCookiePath=false, SensitiveNumber=9, CachingLevel=3, ManualPostEnabled=true, HasCustomMask=true, DisplayLogging=true, MaxStringsLength=300, AddMessageTypeHeader=true, RandomSampleParam=, DoPostOnIntervals=false}
07-24 11:27:09.118: D/dalvikvm(326): GC_FOR_MALLOC freed 3477 objects / 255912 bytes in 101ms
07-24 11:27:09.257: I/UICAndroid(326): Screen height:420 Screen width780
07-24 11:27:09.317: D/DroidGap(326): Resuming the App
07-24 11:27:09.327: D/WLDroidGap(326): New installation/upgrade detected, copying resources and saving new checksum
07-24 11:27:09.417: I/UICAndroid(326): Network changed
07-24 11:27:09.447: D/SoftKeyboardDetect(326): Ignore this event
07-24 11:27:09.567: D/SoftKeyboardDetect(326): Ignore this event
07-24 11:27:09.698: D/WLDroidGap(326): Started copying files to local storage...
07-24 11:27:09.987: I/UICAndroid(326): Did Client State change?: true
07-24 11:27:13.757: D/dalvikvm(326): GC_FOR_MALLOC freed 3411 objects / 478752 bytes in 54ms
07-24 11:27:14.618: D/dalvikvm(326): GC_FOR_MALLOC freed 1944 objects / 461952 bytes in 52ms
07-24 11:27:17.138: D/dalvikvm(326): GC_FOR_MALLOC freed 1855 objects / 468928 bytes in 73ms
07-24 11:27:19.058: D/dalvikvm(326): GC_FOR_MALLOC freed 2204 objects / 516816 bytes in 57ms
07-24 11:27:20.668: D/dalvikvm(326): GC_FOR_MALLOC freed 2098 objects / 483856 bytes in 50ms
07-24 11:27:21.418: D/dalvikvm(326): GC_FOR_MALLOC freed 1791 objects / 472968 bytes in 56ms
07-24 11:27:22.998: D/dalvikvm(326): GC_FOR_MALLOC freed 2105 objects / 498800 bytes in 55ms
07-24 11:27:24.683: D/dalvikvm(326): GC_FOR_MALLOC freed 2203 objects / 512160 bytes in 74ms
07-24 11:27:28.677: D/WLDroidGap(326): Finished copying files to local storage...
07-24 11:27:28.709: D/WLDroidGap(326): no need to check web resource integrity
07-24 11:27:28.797: D/dalvikvm(326): GC_FOR_MALLOC freed 2474 objects / 524672 bytes in 90ms
07-24 11:27:28.877: D/CordovaWebView(326): >>> loadUrl(file:///data/data/com.Accordfintech/files/www/skinLoader.html)
07-24 11:27:28.892: D/PluginManager(326): init()
07-24 11:27:28.907: D/CordovaWebView(326): >>> loadUrlNow()
07-24 11:27:28.977: D/DroidGap(326): onMessage(onPageStarted,file:///data/data/com.Accordfintech/files/www/skinLoader.html)
07-24 11:27:30.067: D/Cordova(326): onPageFinished(file:///data/data/com.Accordfintech/files/www/skinLoader.html)
07-24 11:27:30.067: D/Cordova(326): Trying to fire onNativeReady
07-24 11:27:30.067: D/DroidGap(326): onMessage(onNativeReady,null)
07-24 11:27:30.067: D/DroidGap(326): onMessage(onPageFinished,file:///data/data/com.Accordfintech/files/www/skinLoader.html)
07-24 11:27:30.837: D/CordovaLog(326): Falling back on PROMPT mode since _cordovaNative is missing. Expected for Android 3.2 and lower only.
07-24 11:27:30.837: I/Web Console(326): Falling back on PROMPT mode since _cordovaNative is missing. Expected for Android 3.2 and lower only. at file:///data/data/com.Accordfintech/files/www/default/wlclient/js/cordova.js:908
07-24 11:27:30.937: D/CordovaNetworkManager(326): Connection Type: 3g
07-24 11:27:30.937: D/CordovaNetworkManager(326): Connection Type: 3g
07-24 11:27:30.937: D/DroidGap(326): onMessage(networkconnection,3g)
07-24 11:27:30.977: D/DroidGap(326): onMessage(spinner,stop)
07-24 11:27:31.177: D/dalvikvm(326): GC_FOR_MALLOC freed 2179 objects / 213704 bytes in 137ms
07-24 11:27:31.267: D/CordovaWebView(326): >>> loadUrl(file:///data/data/com.Accordfintech/files/www/default/Accordfintech.html)
07-24 11:27:31.267: D/PluginManager(326): init()
07-24 11:27:31.277: D/CordovaWebView(326): >>> loadUrlNow()
07-24 11:27:31.318: D/DroidGap(326): onMessage(onPageStarted,file:///data/data/com.Accordfintech/files/www/default/Accordfintech.html)
07-24 11:27:31.597: D/dalvikvm(326): GC_FOR_MALLOC freed 3136 objects / 267808 bytes in 65ms
07-24 11:27:31.817: D/dalvikvm(326): GC_FOR_MALLOC freed 1006 objects / 173440 bytes in 101ms
07-24 11:27:32.087: D/DroidGap(326): onMessage(spinner,stop)
07-24 11:27:40.138: D/Cordova(326): onPageFinished(file:///data/data/com.Accordfintech/files/www/default/Accordfintech.html)
07-24 11:27:40.148: D/Cordova(326): Trying to fire onNativeReady
07-24 11:27:40.148: D/DroidGap(326): onMessage(onNativeReady,null)
07-24 11:27:40.148: D/DroidGap(326): onMessage(onPageFinished,file:///data/data/com.Accordfintech/files/www/default/Accordfintech.html)
07-24 11:27:40.898: D/CordovaLog(326): Falling back on PROMPT mode since _cordovaNative is missing. Expected for Android 3.2 and lower only.
07-24 11:27:40.898: I/Web Console(326): Falling back on PROMPT mode since _cordovaNative is missing. Expected for Android 3.2 and lower only. at file:///data/data/com.Accordfintech/files/www/default/wlclient/js/cordova.js:908
07-24 11:27:40.958: D/CordovaNetworkManager(326): Connection Type: 3g
07-24 11:27:40.988: D/CordovaNetworkManager(326): Connection Type: 3g
07-24 11:27:40.988: D/DroidGap(326): onMessage(networkconnection,3g)
07-24 11:27:41.018: D/DroidGap(326): onMessage(spinner,stop)
07-24 11:27:41.198: I/dalvikvm(326): Could not find method java.util.Calendar.getDisplayNames, referenced from method org.apache.cordova.Globalization.getDateNames
07-24 11:27:41.198: W/dalvikvm(326): VFY: unable to resolve virtual method 10795: Ljava/util/Calendar;.getDisplayNames (IILjava/util/Locale;)Ljava/util/Map;
07-24 11:27:41.198: D/dalvikvm(326): VFY: replacing opcode 0x74 at 0x009d
07-24 11:27:41.198: I/dalvikvm(326): Could not find method java.util.Calendar.getDisplayNames, referenced from method org.apache.cordova.Globalization.getDateNames
07-24 11:27:41.198: W/dalvikvm(326): VFY: unable to resolve virtual method 10795: Ljava/util/Calendar;.getDisplayNames (IILjava/util/Locale;)Ljava/util/Map;
07-24 11:27:41.198: D/dalvikvm(326): VFY: replacing opcode 0x74 at 0x00d0
07-24 11:27:41.198: I/dalvikvm(326): Could not find method java.util.Calendar.getDisplayNames, referenced from method org.apache.cordova.Globalization.getDateNames
07-24 11:27:41.198: W/dalvikvm(326): VFY: unable to resolve virtual method 10795: Ljava/util/Calendar;.getDisplayNames (IILjava/util/Locale;)Ljava/util/Map;
07-24 11:27:41.198: D/dalvikvm(326): VFY: replacing opcode 0x74 at 0x00e3
07-24 11:27:41.198: I/dalvikvm(326): Could not find method java.util.Calendar.getDisplayNames, referenced from method org.apache.cordova.Globalization.getDateNames
07-24 11:27:41.198: W/dalvikvm(326): VFY: unable to resolve virtual method 10795: Ljava/util/Calendar;.getDisplayNames (IILjava/util/Locale;)Ljava/util/Map;
07-24 11:27:41.198: D/dalvikvm(326): VFY: replacing opcode 0x74 at 0x00f2
07-24 11:27:41.198: D/dalvikvm(326): VFY: dead code 0x00a0-00b8 in Lorg/apache/cordova/Globalization;.getDateNames (Lorg/json/JSONArray;)Lorg/json/JSONObject;
07-24 11:27:41.198: D/dalvikvm(326): VFY: dead code 0x00d3-00d4 in Lorg/apache/cordova/Globalization;.getDateNames (Lorg/json/JSONArray;)Lorg/json/JSONObject;
07-24 11:27:41.198: D/dalvikvm(326): VFY: dead code 0x00e6-00e7 in Lorg/apache/cordova/Globalization;.getDateNames (Lorg/json/JSONArray;)Lorg/json/JSONObject;
07-24 11:27:41.198: D/dalvikvm(326): VFY: dead code 0x00f5-0118 in Lorg/apache/cordova/Globalization;.getDateNames (Lorg/json/JSONArray;)Lorg/json/JSONObject;
07-24 11:27:41.388: D/Accordfintech(326): wlclient init started
07-24 11:27:41.428: D/Accordfintech(326): Read cookies: null
07-24 11:27:41.428: D/Accordfintech(326): CookieMgr read cookies: {}
07-24 11:27:41.618: D/dalvikvm(326): GC_FOR_MALLOC freed 5221 objects / 855328 bytes in 82ms
07-24 11:27:41.928: D/Accordfintech(326): before: app init onSuccess
07-24 11:27:42.018: D/Accordfintech(326): after: app init onSuccess
07-24 11:27:42.018: D/Accordfintech(326): added onPause event handler
07-24 11:27:42.028: D/Accordfintech(326): wlclient init success
07-24 11:27:59.578: D/Accordfintech(326): Request [http://10.20.50.244:10080/Accord/apps/services/api/Accordfintech/android/query]
07-24 11:28:00.369: D/dalvikvm(326): GC_FOR_MALLOC freed 7040 objects / 435712 bytes in 63ms
07-24 11:28:00.629: D/Accordfintech(326): Request [http://10.20.50.244:10080/Accord/apps/services/api/Accordfintech/android/query]
07-24 11:28:00.698: D/Accordfintech(326): Request [http://10.20.50.244:10080/Accord/apps/services/api/Accordfintech/android/query]
07-24 11:28:01.038: D/Accordfintech(326): response [http://10.20.50.244:10080/Accord/apps/services/api/Accordfintech/android/query] success: /*-secure-
07-24 11:28:01.038: D/Accordfintech(326): {"responseID":"2","statusCode":200,"errors":[],"isSuccessful":true,"statusReason":"OK","WL-Authentication-Success":{"wl_remoteDisableRealm":{"userId":"null","attributes":{},"isUserAuthenticated":1,"displayName":"null"},"wl_antiXSRFRealm":{"userId":"88cgj8s4m26caj0vstt6imlief","attributes":{},"isUserAuthenticated":1,"displayName":"88cgj8s4m26caj0vstt6imlief"},"wl_deviceNoProvisioningRealm":{"userId":"cf95dc53-f383-39a8-b6fd-749f3ef439cd","attributes":{"mobileClientData":"com.worklight.core.auth.ext.MobileClientData@59727ed4"},"isUserAuthenticated":1,"displayName":"cf95dc53-f383-39a8-b6fd-749f3ef439cd"},"wl_anonymousUserRealm":{"userId":"587f3a3b-148c-492a-9fa5-7bdbb8b9e046","attributes":{},"isUserAuthenticated":1,"displayName":"587f3a3b-148c-492a-9fa5-7bdbb8b9e046"}},"DataSet":{"schema":{"id":"NewDataSet","element":{"complexType":{"choice":{"element":{"complexType":{"sequence":{"element":[{"name":"SYMBOL","type":"xs:string","minOccurs":"0"},{"name":"PRICE","type":"xs:decimal","minOccurs":"0"},{"name":"PER_CHANGE","type":"xs:decimal","minOccurs":"0"},{"name":"ChangePer","type":"xs:decimal","minOccurs":"0"},{"name":"PREV_CLOSE","type":"xs:decimal","minOccurs":"0"},{"name":"Open","type":"xs:decimal","minOccurs":"0"},{"name":"UPD_TIME","type":"xs:string","minOccurs":"0"},{"name":"Trend","type":"xs:string","minOccurs":"0"},{"name":"high","type":"xs:double","minOccurs":"0"},{"name":"low","type":"xs:double","minOccurs":"0"}]}},"name":"Table"},"maxOccurs":"unbounded","minOccurs":"0"}},"name":"NewDataSet","IsDataSet":"true","UseCurrentLocale":"true"},"msdata":"urn:schemas-microsoft-com:xml-msdata","xs":"http:\/\/www.w3.org\/2001\/XMLSchema","xmlns":""},"xmlns":"http:\/\/ACEwebservice\/","diffgram":{"NewDataSet":{"Table":[{"id":"Table1","Open":"20200.20","PRICE":"20041.68","PREV_CLOSE":"20302.13","PER_CHANGE":"-260.45","SYMBOL":"SENSEX","ChangePer":"-1.28","high":"20252.7","low":"20018.32","rowOrder":"0","Trend":"-","UPD_TIME":"24-Jul-2013 11:25"},{"id":"Table2","Open":"6032.20","PRICE":"5974.95","PREV_CLOSE":"6077.80","PER_CHANGE":"-102.85","SYMBOL":"NIFTY","ChangePer":"-1.69","high":"6047.25","low":"5968.4","rowOrder":"1","Trend":"-","UPD_TIME":"24-Jul-2013 11:15"}],"xmlns":""},"msdata":"urn:schemas-microsoft-com:xml-msdata","diffgr":"urn:schemas-microsoft-com:xml-diffgram-v1"}},"responseHeaders":{"X-AspNet-Version":"2.0.50727","Date":"Wed, 24 Jul 2013 06:00:48 GMT","Content-Length":"2480","Expires":"-1","Content-Type":"text\/xml; charset=utf-8","Server":"Microsoft-IIS\/6.0","X-Powered-By":"ASP.NET","Cache-Control":"no-cache","Pragma":"no-cache"},"warnings":[],"totalTime":140,"responseTime":139,"info":[]}*/
07-24 11:28:01.268: D/Accordfintech(326): response [http://10.20.50.244:10080/Accord/apps/services/api/Accordfintech/android/query] success: /*-secure-
07-24 11:28:01.268: D/Accordfintech(326): {"responseID":"3","statusCode":200,"errors":[],"isSuccessful":true,"statusReason":"OK","DataSet":{"schema":{"id":"NewDataSet","element":{"complexType":{"choice":{"element":{"complexType":{"sequence":{"element":[{"name":"SYMBOL","type":"xs:string","minOccurs":"0"},{"name":"PRICE","type":"xs:decimal","minOccurs":"0"},{"name":"PER_CHANGE","type":"xs:decimal","minOccurs":"0"},{"name":"ChangePer","type":"xs:decimal","minOccurs":"0"},{"name":"PREV_CLOSE","type":"xs:decimal","minOccurs":"0"},{"name":"Open","type":"xs:decimal","minOccurs":"0"},{"name":"UPD_TIME","type":"xs:string","minOccurs":"0"},{"name":"Trend","type":"xs:string","minOccurs":"0"},{"name":"high","type":"xs:double","minOccurs":"0"},{"name":"low","type":"xs:double","minOccurs":"0"}]}},"name":"Table"},"maxOccurs":"unbounded","minOccurs":"0"}},"name":"NewDataSet","IsDataSet":"true","UseCurrentLocale":"true"},"msdata":"urn:schemas-microsoft-com:xml-msdata","xs":"http:\/\/www.w3.org\/2001\/XMLSchema","xmlns":""},"xmlns":"http:\/\/ACEwebservice\/","diffgram":{"NewDataSet":{"Table":[{"id":"Table1","Open":"20200.20","PRICE":"20041.68","PREV_CLOSE":"20302.13","PER_CHANGE":"-260.45","SYMBOL":"SENSEX","ChangePer":"-1.28","high":"20252.7","low":"20018.32","rowOrder":"0","Trend":"-","UPD_TIME":"24-Jul-2013 11:25"},{"id":"Table2","Open":"6032.20","PRICE":"5974.95","PREV_CLOSE":"6077.80","PER_CHANGE":"-102.85","SYMBOL":"NIFTY","ChangePer":"-1.69","high":"6047.25","low":"5968.4","rowOrder":"1","Trend":"-","UPD_TIME":"24-Jul-2013 11:15"}],"xmlns":""},"msdata":"urn:schemas-microsoft-com:xml-msdata","diffgr":"urn:schemas-microsoft-com:xml-diffgram-v1"}},"responseHeaders":{"X-AspNet-Version":"2.0.50727","Date":"Wed, 24 Jul 2013 06:00:48 GMT","Content-Length":"2480","Expires":"-1","Content-Type":"text\/xml; charset=utf-8","Server":"Microsoft-IIS\/6.0","X-Powered-By":"ASP.NET","Cache-Control":"no-cache","Pragma":"no-cache"},"warnings":[],"totalTime":181,"responseTime":180,"info":[]}*/
スクリーン・ショット #1 - Worklight Console MBS:
スクリーン ショット #2 - Android 2.2。AVD: