Page 1 of 1

The Free version of API is not working with .NET 2.0

Posted: Tue May 26, 2015 1:48 am
by virendrad
Hi,

Before trying my hands on the standard version, I was just playing with free version of .NET API. The free version is working fine if I am making a separate web site in visual studio with my localhost url but when I am trying to integrate it my other website which doesn't run on local host, it gives me following error.

Error getting value from 'ServerVersion' on 'ScientiaMobile.WurflCloud.Cache.CookieContent'

Few queries:
1. Does the free version works only with localhost URL? like http://localhost:62133/ScientiaMobileTesting/. AS it doesn't work if I am using a different host name?
2. I was using the old version of Newtonsoft.Json.dll and I have replaced it with the version present in Zip file (Downloaded from your website). Is this the problem? Since it is working with localhost but on my actual website.

Thanks.

Re: The Free version of API is not working with .NET 2.0

Posted: Tue May 26, 2015 1:51 am
by virendrad
Here is the exception stack trace...

ERROR: Error getting value from 'ServerVersion' on 'ScientiaMobile.WurflCloud.Cache.CookieContent'.
at Newtonsoft.Json.Serialization.ReflectionValueProvider.GetValue(Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContract collectionValueContract)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value)
at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Formatting formatting, JsonSerializerSettings settings)
at ScientiaMobile.WurflCloud.Cache.CookieWurflCloudCache.SetDevice(HttpContext context, DeviceInfo device)
at ScientiaMobile.WurflCloud.Http.CloudClient.ProcessWebResponse(HttpContext context, WebResponse response, String overriddenUserAgent)
at ScientiaMobile.WurflCloud.Http.CloudClient.SendRequest(HttpContext context, String url, Boolean uaMayBeDifferent)
at ScientiaMobile.WurflCloud.CloudClientManager.GetDeviceInfo(HttpContext context)
Inner Exception: ScientiaMobile.WurflCloud.Cache.CookieContent.get_ServerVersion()
at System.Reflection.MethodBase.PerformSecurityCheck(Object obj, RuntimeMethodHandle method, IntPtr parent, UInt32 invocationFlags)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)
at Newtonsoft.Json.Utilities.ReflectionUtils.GetMemberValue(MemberInfo member, Object target)
at Newtonsoft.Json.Serialization.ReflectionValueProvider.GetValue(Object target)

I don't know if its the problem with your API or the newtonSoft.json.dll . Also in the documentation, it's not mentioned to add this as reference. I am sure its required, but documentation is silent about it.

Re: The Free version of API is not working with .NET 2.0

Posted: Tue May 26, 2015 9:57 am
by Elliotfehr
Hello,

The free version of the WURFL cloud service will work with other host names. Our engineering team is currently looking into this issue. Are you able to provide a code sample to show how you are configuring the cloud client as well?

Thank you,

Elliot

Re: The Free version of API is not working with .NET 2.0

Posted: Wed May 27, 2015 12:06 am
by virendrad
Hi Elliot,

Here is the code.

Code: Select all

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using ScientiaMobile.WurflCloud;
using ScientiaMobile.WurflCloud.Config;
using ScientiaMobile.WurflCloud.Device;

/// <summary>
/// Summary description for DeviceCapabilities
/// </summary>
public class DeviceCapabilities
{
    public void GetDataByRequest(HttpContext context)
    {
        DefaultCloudClientConfig objCloudConfig = new DefaultCloudClientConfig(c_sAPIKey, false);
        CloudClientManager objCloudManager = new CloudClientManager(objCloudConfig);
        DeviceInfo objDevice = objCloudManager.GetDeviceInfo(context);
        m_DeviceInfo = objDevice;
    }
    
    public string IsTablet()
    {
        return m_DeviceInfo.Get("is_tablet");
    }

    public DeviceInfo DeviceInfo
    {
        get { return m_DeviceInfo; }
        set { m_DeviceInfo = value; }
    }

    #region Variable
    public DeviceInfo m_DeviceInfo = null;
    public const string c_sAPIKey = "XXXXXX:BlahBlahBlah";

    #endregion
}
I have replaced the API key with some random value.

Re: The Free version of API is not working with .NET 2.0

Posted: Wed May 27, 2015 11:57 pm
by virendrad
Hi Elliot,

Can you please update me on this ASAP as its urgent.

Thanks,
Virendra

Re: The Free version of API is not working with .NET 2.0

Posted: Thu May 28, 2015 9:05 am
by Elliotfehr
Hello,

We are currently looking into this issue and I will let you know as soon as we have an update.

Thank you,

Elliot

Re: The Free version of API is not working with .NET 2.0

Posted: Tue Jun 02, 2015 12:57 am
by virendrad
Hi Elliot,

Let me know how much time this is going to take. As my client is also pushing it hard for the same. If it is going to take more time then I may need to look for other options.

Thanks,
Virendra

Re: The Free version of API is not working with .NET 2.0

Posted: Tue Jun 02, 2015 2:43 pm
by despos
It seems a plain error while the API attempts to deserialize the JSON content of the cookie being issued by the cloud API. Deserialization is done via Newtonsoft.JSON and to my best knowledge that's the main difference between the API for .NET 2 and .NET 4. You mention some replacement you did on that DLL. That could be one aspect to further investigate or it could be that -- for some reason -- the cookie was found created with a previous version that could not be any longer deserialized. Have you tried clearing all cookies for the domain?

Re: The Free version of API is not working with .NET 2.0

Posted: Tue Jun 02, 2015 10:35 pm
by virendrad
Well, initially I also thought the same and tried many times via clearing cookie but still no success. I also think it is something to do with NEWSOFT.JSON.dll.

Re: The Free version of API is not working with .NET 2.0

Posted: Thu Jun 04, 2015 5:43 am
by support-all
Hi virendrad,

It seems that the library (Newtonsoft.Json), for some reasons, is not able to SERIALIZE the cookie structure relative only to server version info.
Can you please delete any reference to NewtonSoft.Json and run a clean application with another browser? (also the default browser - page inspector - is well if you are using visual studio).
If the problem persists I'll give you another recompiled dll.

Beppe

Re: The Free version of API is not working with .NET 2.0

Posted: Fri Jun 05, 2015 4:16 am
by support-all
Hi virendrad,
in any case I suggest you to download the new version (1.2.0.0) of cloud client dll.
The great news is that project is now freely available at https://github.com/WURFL/wurfl-cloud-client-dotnet.
You can also directly download only the new dll through NUGET.

Cheers

Beppe