cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mehmet Zahid Aydin (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-6096) WP8 Project - XHRHelper.HandleCommand failing with 'System.InvalidOperationException
Date Mon, 24 Feb 2014 14:47:22 GMT
Mehmet Zahid Aydin created CB-6096:
--------------------------------------

             Summary: WP8 Project - XHRHelper.HandleCommand failing with 'System.InvalidOperationException
                 Key: CB-6096
                 URL: https://issues.apache.org/jira/browse/CB-6096
             Project: Apache Cordova
          Issue Type: Bug
          Components: WP8
    Affects Versions: 3.3.0
         Environment: Development Environment: Visual Studio 2012 (with Update 4), Windows
8.1 Pro x64, Target Environment: Windows Phone 8.0, Other libraries - jquery
            Reporter: Mehmet Zahid Aydin
            Assignee: Jesse MacFadyen


I need jquery/ajax script to ping SAP-Server.

I get the following exception:
System.InvalidOperationException occured of type "System.ni.dll" 
Exception of Type System.InvalidOperationException in Microsoft.Phone.Interop.ni.dll 

In these cases I received a 404 error.
I can change value of commandStr during debugging.
commandStr: "XHRLOCAL/Http://sapfd1.flexus.net:8030/sap/public/ping?=1362547834285"
or
commandStr: "XHRLOCAL/Http://sapfd1.flexus.net:8030/sap/public/ping"

{code:title=Part of JavaScript|borderStyle=solid}
function checkPublicPing() {
		var successful = false;
        var publicPingPath = "sap/public/ping";
        var serverURI = "http://sapfd1.flexus.net:8030";

		$.ajax({
			async : false,
			url : serverURI + publicPingPath,
			cache : false
		}).fail(function(error) {
			successful = false;
		}).done(function(data, textStatus, xhr) {
			successful = true;
		});
		return successful;
	}
{code}

Part of cordovalib/XHRHelper.cs:
 public bool HandleCommand(string commandStr)
        {
//commandStr: "XHRLOCAL/Http:/sapfd1.flexus.net:8030/sap/public/ping?_=1362547834285"

            if (commandStr.IndexOf("XHRLOCAL") == 0)
            {
                string url = commandStr.Replace("XHRLOCAL/", "");
// url: {Http:/sapfd1.flexus.net:8030/sap/public/ping?_=1362547834285}

                Uri uri = new Uri(url, UriKind.RelativeOrAbsolute);
// uri: {Http:/sapfd1.flexus.net:8030/sap/public/ping?_=1362547834285}

                using (IsolatedStorageFile isoFile = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    if (isoFile.FileExists(uri.AbsolutePath))
                    {
//uri.AbsolutePath: InvalidOperationException Typ "Sytem.ni.dll"

                        using (TextReader reader = new StreamReader(isoFile.OpenFile(uri.AbsolutePath,
FileMode.Open, FileAccess.Read)))
                        {
                            string text = reader.ReadToEnd();
                            Browser.InvokeScript("__onXHRLocalCallback", new string[] { "200",
text });
                            return true;
                        }
                    }
                }
				
Please advise.				



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message