Unable to connect to localhost:port using XMLHttpRequest

Unable to connect to localhost:port using XMLHttpRequest

BY 02 Apr 2015 Web Application Development

Hi,

 We are getting an error when we try to establish a connection to localhost through XMLHttpRequest . Below is the usecase

 we are developing a hybrid application. In native app we have a server running (localhost:port) and based on the html request from web app using XMLHttpRequest  it will serve the content. But looks like an error is happenning.  We have given below permissions

 

    tizen:privilege name=internet (removed complete url as external links are blocked)

    access origin=“*” subdomains=“true”

 Observations : 

[x] Connection is success for other urls. (google)

[x] We are able to connect to the localhost server from the native application using curl

[x] When the error is observed connection is not even landed on the server. Even before that libsoup/Webkit is rejecting the process

 

Please help if we are missing something

 

We are getting below errors during the process

 04-02 16:35:03.536 : DEBUG / libsoup ( 2990 : 2990 ) : soup-message.c: soup_message_finished(1277) > msg[0x9bc0010] status_code[4] reason[Cannot connect to destination (127.0.0.1)]
04-02 16:35:03.536 : DEBUG / libsoup ( 2990 : 2990 ) : soup-message.c: soup_message_finished(1278) > [SECURE_LOG] msg[0x9bc0010] url[127.0.0.1:60223/index.html] status_code[4] reason[Cannot connect to destination (127.0.0.1)]
04-02 16:35:03.536 : DEBUG / libsoup ( 2990 : 2990 ) : soup-http-input-stream.c: send_async_finished(587) > msg[0x9bc0010] error code[4]
04-02 16:35:03.536 : DEBUG / libsoup ( 2990 : 2990 ) : soup-http-input-stream.c: send_async_finished(588) > [SECURE_LOG] url [127.0.0.1:60223/index.html] GError [Cannot connect to destination (127.0.0.1)]
04-02 16:35:03.536 : DEBUG / libsoup ( 2990 : 2990 ) : soup-http-input-stream.c: soup_http_input_stream_send_finish(738) > msg[0x9bc0010] error code[4]
04-02 16:35:03.536 : DEBUG / libsoup ( 2990 : 2990 ) : soup-http-input-stream.c: soup_http_input_stream_send_finish(739) > [SECURE_LOG] url [127.0.0.1:60223/index.html] GError [Cannot connect to destination (127.0.0.1)]
04-02 16:35:03.536 : DEBUG / libsoup ( 2990 : 2990 ) : soup-request-http.c: http_input_stream_ready_cb(160) > msg[0x9bc0010] error code[4]
04-02 16:35:03.536 : DEBUG / libsoup ( 2990 : 2990 ) : soup-request-http.c: http_input_stream_ready_cb(161) > [SECURE_LOG] url [127.0.0.1:60223/index.html] GError [Cannot connect to destination (127.0.0.1)]
04-02 16:35:03.536 : DEBUG / WEBKIT ( 2990 : 2990 ) : void WebCore::sendRequestCallback(GObject*, GAsyncResult*, gpointer)(618) > [SECURE_LOG] [Network] sendRequestCallback error [Cannot connect to destination (127.0.0.1)]
04-02 16:35:03.536 : DEBUG / WEBKIT ( 2990 : 2990 ) : virtual void WebCore::SubresourceLoader::didFail(const WebCore::ResourceError&)(305) > [SECURE_LOG] [Loader] this[0x9bb0fc8], LoadError errorCode [4], url [127.0.0.1:60223/index.html]
04-02 16:35:03.536 : DEBUG / WEBKIT ( 2990 : 2990 ) : virtual void WebCore::XMLHttpRequest::didFail(const WebCore::ResourceError&)(1067) > [SECURE_LOG] [Loader] this[0x9ade1f8], url [127.0.0.1:60223/index.html], domain[Network Request Failed], errorCode[0]
04-02 16:35:03.536 : DEBUG / WEBKIT ( 2990 : 2990 ) : virtual void WebCore::XMLHttpRequest::didFail(const WebCore::ResourceError&)(1067) > [SECURE_LOG] [Loader] this[0x9ade1f8], url [127.0.0.1:60223/index.html], domain[WebKitInternal], errorCode[0]
04-02 16:35:03.536 : DEBUG / WEBKIT ( 2990 : 2990 ) : virtual void WebCore::ResourceLoader::didFail(const WebCore::ResourceError&)(379) > [SECURE_LOG] [Loader] url [127.0.0.1:60223/index.html], error domain [soup_http_error_quark], errorCode [4]
04-02 16:35:03.576 : DEBUG / RESOURCED ( 2195 : 2195 ) : proc-monitor.c: proc_dbus_active_signal_handler(107) > [proc_dbus_active_signal_handler,107] call dbus_proc_active_signal_handler

Written by