You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Jesse MacFadyen (JIRA)" <ji...@apache.org> on 2014/03/20 08:52:43 UTC

[jira] [Resolved] (CB-6096) WP8 Project - XHRHelper.HandleCommand failing with 'System.InvalidOperationException

     [ https://issues.apache.org/jira/browse/CB-6096?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse MacFadyen resolved CB-6096.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 3.5.0

This has been resolved in another commit.

This should never have been routed through XHRHelper.cs, which is only required when it is a local file.

> 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
>              Labels: 3.3.0, InvalidOperationException, ajax, cordova, phonegap, wp8, xhrhelper
>             Fix For: 3.5.0
>
>
> I need jquery/ajax to ping SAP-Server.
> I get the following exceptions:
> 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.
> Value of commandSt was changed 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}
> {code:title=Part of cordovalib/XHRHelper.cs|borderStyle=solid}
>  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;
>                         }
>                     }
>                 }
> {code}
> Please advise.				



--
This message was sent by Atlassian JIRA
(v6.2#6252)