语言

Menu
Sites
Language
Accessing External API

Hi,

 

I am trying to build and application, that can access external API and fetch the response (XML or JSON), parse the response and display it.

For now I am using http://www.historytoday.com/feed/rss.xml

When I run application via "" it launches simulator and I can see it workign as expected. But when I try to run same application in emulator it failes with following error message:

02-04 21:39:29.052: DEBUG/WRT_PLUGINS(2474): [wrt-wk2-bundle.cpp:345] willSendRequestForFrameCallback(): willSendRequestForFrameCallback called

02-04 21:39:29.052: DEBUG/WRT_PLUGINS(2474): [wrt-wk2-bundle.cpp:514] willSendRequestForFrame(): willSendReq got http://www.historytoday.com/feed/rss.xml
02-04 21:39:29.092: DEBUG/WRT(2470): [view_logic.cpp:1013] contextMessageFromInjectedBundleCallback(): contextMessageFromInjectedBundleCallback called
02-04 21:39:29.092: DEBUG/WRT(2470): [view_logic.cpp:1637] didReceiveSynchronousMessage(): didReceiveSynchronousMessage called
02-04 21:39:29.092: DEBUG/WRT(2470): [view_logic.cpp:1647] didReceiveSynchronousMessage(): received : will_send_msg
02-04 21:39:29.092: DEBUG/WRT(2470): [view_logic_uri_support.cpp:125] localizeURI(): localizing url: http://www.historytoday.com/feed/rss.xml
02-04 21:39:29.092: DEBUG/WRT(2470): [view_logic_uri_support.cpp:138] localizeURI(): scheme doesn't need to localize
02-04 21:39:29.092: DEBUG/WRT(2470): [view_logic_security_support.cpp:208] filterURIBySecurity(): Request was blocked by WARP: http://www.historytoday.com/feed/rss.xml
02-04 21:39:29.092: INFO/WRT(2470): [view_logic.cpp:1684] requestWillSend(): set blocked uri to open browser later : http://www.historytoday.com/feed/rss.xml
02-04 21:39:29.092: ERROR/WRT(2470): [view_logic.cpp:1653] didReceiveSynchronousMessage(): Wrong type received
02-04 21:39:29.092: DEBUG/WRT_PLUGINS(2474): [wrt-wk2-bundle.cpp:532] willSendRequestForFrame(): uri is blocked
 

I am not able to finding any help on this. Please help.

Thanks

Prashant

 

 

编辑者为: Brock Boland 17 3月, 2014 原因: Paragraph tags added automatically from tizen_format_fix module.

响应

4 回复
Raghavendra Reddy Shiva
Hello Prashant, From the logs, it looks like the core services web runtime is hit with some unexpected errors. Also the uri seems to be blocked by runtime security. Over all it seems to be something to do with access and security. Are you able to browse internet on emulator ?
Prashant Thakkar
Hi Raghavendra, Thanks for your reply. Yes, I tried accessing www.google.com from the Internet Explorer on emulator and it is working. To me it is looking like cross domain communication issue. Following is the piece of code in my function alert("Inside"); $.get('http://www.historytoday.com/feed/rss.xml', null, function(data, textStatus) { var out = "" $(data).find('title').each(function() { if ($(this).text().length > 0) { if (out.length === 0) { out += "

" + $(this).text() + "


    "; } else { out += "
  • " + $(this).text() + "
  • "; } } }); out += "
" $("#data").append(out, ""); });
Raghavendra Reddy Shiva
Hi Prashant, This issue needs to be looked from native side on why the core services web runtime is hit with errors. Will forward this issue to the concerned folks for further analysis. Thanks
Prashant Thakkar
Hi Raghavendra,, We were able to resolve the issue. Issue was with access policy. In config.xml we had granted access to URL by setting origin = " http://www.historytoday.com/feed/rss.xml" and subdomains = true. We changed URL from http://www.historytoday.com/feed/rss.xml to http://www.historytoday.com for origin attribute. And this resovled the issue. Thanks Prashant Thakkar