No API Key was provided

Questions about the WURFL Cloud service.
iceyp
Posts: 11
Joined: Sun May 03, 2015 1:38 am

No API Key was provided

Postby iceyp » Sun May 03, 2015 4:34 am

Have recently signed up to WURFL Cloud and get the above error when trying to load my site.

The code (VB .Net) to call the Wurfl function is :

Code: Select all

            Dim wrapper = New HttpContextWrapper(HttpContext.Current)
            Dim dinfo As DeviceInfo = WurflService.GetDataByRequest(wrapper)
            Dim strWireless = dinfo.Get("is_wireless_device")
and the class is defined as follows:

Code: Select all

Imports ScientiaMobile.WurflCloud
Imports ScientiaMobile.WurflCloud.Config
Imports ScientiaMobile.WurflCloud.Device

Public Class WurflService
    Public Shared Function GetDataByRequest(ByVal context As HttpContextBase) As DeviceInfo
        Dim config = New DefaultCloudClientConfig() With {.ApiKey = "mykey:apikeycheckedascorrect"}
        Dim manager = New CloudClientManager(config)
        Return manager.GetDeviceInfo(context)
    End Function
End Class
manager.GetDeviceInfo raises the API key error. I am testing using VS 2010 and the default web browser (IIS Express). The exception detail is:

ScientiaMobile.WurflCloud.Exc.ApiKeyException was unhandled by user code
HResult=-2146233088
Message=No API key was provided
Source=ScientiaMobile.WurflCloud
StackTrace:
at ScientiaMobile.WurflCloud.Http.CloudClient.SendRequest(HttpContextBase context, String url, Boolean uaMayBeDifferent)
at ScientiaMobile.WurflCloud.CloudClientManager.DetectDevice(HttpContextBase context, String userAgent, Dictionary`2 reqParams, String[] capabilities, Boolean uaMayBeDifferent)
at ScientiaMobile.WurflCloud.CloudClientManager.GetDeviceInfo(HttpContextBase context, String[] capabilities)
at ScientiaMobile.WurflCloud.CloudClientManager.GetDeviceInfo(HttpContextBase context)
at WurflService.GetDataByRequest(HttpContextBase context) in C:\Development Area\Website Modulise\Modulise\App_Code\WurflService.vb:line 9
at Login_S.Page_Load(Object sender, EventArgs e) in C:\Development Area\Website Modulise\Modulise\Site\Login_S.aspx.vb:line 31
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:

Any help would be appreciated.

Thanks.

Elliotfehr

Re: No API Key was provided

Postby Elliotfehr » Mon May 04, 2015 11:43 am

Hello,

I have just uploaded an updated .dll to your file manager on scientiamobile.com. Please let me know if the issue persists after you have updated.

Thank you,

Elliot

iceyp
Posts: 11
Joined: Sun May 03, 2015 1:38 am

Re: No API Key was provided

Postby iceyp » Tue May 05, 2015 12:27 am

Different error now. I get:

System.Web.HttpException was caught
ErrorCode=-2147467259
HResult=-2147467259
Message=The WURFL Cloud service returned an unexpected response
Source=ScientiaMobile.WurflCloud
WebEventCode=0
StackTrace:
at ScientiaMobile.WurflCloud.Http.CloudClient.SendRequest(HttpContextBase context, String url, Boolean uaMayBeDifferent)
at ScientiaMobile.WurflCloud.CloudClientManager.DetectDevice(HttpContextBase context, String userAgent, Dictionary`2 reqParams, String[] capabilities, Boolean uaMayBeDifferent)
at ScientiaMobile.WurflCloud.CloudClientManager.GetDeviceInfo(HttpContextBase context, String[] capabilities)
at ScientiaMobile.WurflCloud.CloudClientManager.GetDeviceInfo(HttpContextBase context)
at WurflService.GetDataByRequest(HttpContextBase context) in C:\Development Area\Website Modulise\Modulise\App_Code\WurflService.vb:line 11
InnerException:

Am I the only one having this problem?

Smart guy
Posts: 2
Joined: Wed Feb 04, 2015 8:23 am

Re: No API Key was provided

Postby Smart guy » Wed May 06, 2015 7:29 am

I get the same error:
Exception: ScientiaMobile.WurflCloud.Exc.ApiKeyException
Message: No API key was provided
Source: ScientiaMobile.WurflCloud
at ScientiaMobile.WurflCloud.Http.CloudClient.SendRequest(HttpContextBase context, String url, Boolean uaMayBeDifferent)
at ScientiaMobile.WurflCloud.CloudClientManager.DetectDevice(HttpContextBase context, String userAgent, Dictionary`2 reqParams, String[] capabilities, Boolean uaMayBeDifferent)
at ScientiaMobile.WurflCloud.CloudClientManager.GetDeviceInfo(HttpContextBase context)
at [MyProject].UI.Util.DeviceDetection.DeviceDetectionHelper.GetDeviceInfo()
I get this with the new dll (downloaded 4/30 and redownloaded today after reading this thread).
My old version (1.1.0.0) works just fine.

Elliotfehr

Re: No API Key was provided

Postby Elliotfehr » Wed May 06, 2015 9:03 am

We have just released a new version of the .NET cloud client, which can be downloaded from your customer vault on scientiamobile.com.

Feel free to let me know if the issue is persisting after you upgrade.

Thank you,

Elliot

Smart guy
Posts: 2
Joined: Wed Feb 04, 2015 8:23 am

Re: No API Key was provided

Postby Smart guy » Wed May 06, 2015 9:46 am

Hi Elliot,

Thanks for the fast fix. The update solved the issue for me.

iceyp
Posts: 11
Joined: Sun May 03, 2015 1:38 am

Re: No API Key was provided

Postby iceyp » Wed May 06, 2015 11:55 pm

As stated above, have installed 1.1.0.2 and am getting the 'unexpected response' exception.

support-all
Posts: 32
Joined: Mon Oct 08, 2012 2:47 am

Re: No API Key was provided

Postby support-all » Thu May 07, 2015 9:14 am

Hi,
I'm Beppe, the .NET engineer of ScientiaMobile.
In the last version there should be the status code and the error description in case of unexpected response.
Can you tell me what is the entire error description?

Thank you

Beppe

iceyp
Posts: 11
Joined: Sun May 03, 2015 1:38 am

Re: No API Key was provided

Postby iceyp » Fri May 08, 2015 12:34 am

Hi Beppe.

The exception was as follows:

System.Web.HttpException was caught
ErrorCode=-2147467259
HResult=-2147467259
Message=The WURFL Cloud service returned an unexpected response
Source=ScientiaMobile.WurflCloud
WebEventCode=0
StackTrace:
at ScientiaMobile.WurflCloud.Http.CloudClient.SendRequest(HttpContextBase context, String url, Boolean uaMayBeDifferent)
at ScientiaMobile.WurflCloud.CloudClientManager.DetectDevice(HttpContextBase context, String userAgent, Dictionary`2 reqParams, String[] capabilities, Boolean uaMayBeDifferent)
at ScientiaMobile.WurflCloud.CloudClientManager.GetDeviceInfo(HttpContextBase context, String[] capabilities)
at ScientiaMobile.WurflCloud.CloudClientManager.GetDeviceInfo(HttpContextBase context)
at WurflService.GetDataByRequest(HttpContextBase context) in C:\Development Area\Website Modulise\Modulise\App_Code\WurflService.vb:line 11
InnerException:

support-all
Posts: 32
Joined: Mon Oct 08, 2012 2:47 am

Re: No API Key was provided

Postby support-all » Fri May 08, 2015 3:44 am

Hi,
the new version should not raise web exceptions. All the errors are now collected in DeviceInfo.Errors field, avoiding the crash.
It is possible that you have cached something?

Beppe

iceyp
Posts: 11
Joined: Sun May 03, 2015 1:38 am

Re: No API Key was provided

Postby iceyp » Sat May 09, 2015 1:07 am

Hi Beppe.

Have narrowed the problem down to Internet Explorer (Version 11.0.9600.17728). Have tested with Firefox, Chrome, Safari and Opera and all work ok.

Not sure it is a caching issue as our default site policy is 'no cache' (our site is very dynamic). I also have cleared all 'Temporary Internet files and website files' from the browser with no luck.

I am using Windows 7 (x64), Visual Studio 2013 Pro and default web server.

Cheers.

support-all
Posts: 32
Joined: Mon Oct 08, 2012 2:47 am

Re: No API Key was provided

Postby support-all » Tue May 12, 2015 11:22 am

Hi,

just few questions in order to understand what's going on:
- The version of the ScientiaMobile.WurflCloud dll is the 1.1.0.2? (just check the file details by right clicking on it )
- What is the content of DeviceInfo.Errors?

Just below you can see a basic usage of the library as example (written in C#).

Code: Select all

public class WurflService
{
        public DeviceInfoViewModel GetDataByRequest(HttpContextBase context)
        {
            var config = new DefaultCloudClientConfig
            {
                ApiKey = "xxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" //your API key here!
            };

            var manager = new CloudClientManager(config);
            
            var deviceInfo = manager.GetDeviceInfo(context, new[] { "is_wireless_device" });
            var model = new DeviceInfoViewModel
                                {
                                    DeviceId = deviceInfo.Id,
                                    ServerVersion = deviceInfo.ServerVersion,
                                    DateOfRequest = deviceInfo.WurflLastUpdate.ToString(),
                                    Library = manager.GetClientVersion(),
                                    Capabilities = deviceInfo.Capabilities,
                                    Errors = deviceInfo.Errors,
                                    Source = deviceInfo.ResponseOrigin
                                };

            return model;
        }
}
where DeviceInfoViewModel is:

Code: Select all

public class DeviceInfoViewModel
    {
        public String ServerVersion { get; set; }
        public String Library { get; set; }
        public String DeviceId { get; set; }
        public String DateOfRequest { get; set; }
        public ResponseType Source { get; set; }
        public IDictionary<String, String> Capabilities { get; set; }
        public IDictionary<String, String> Errors { get; set; }
    }
Regards,

Beppe

iceyp
Posts: 11
Joined: Sun May 03, 2015 1:38 am

Re: No API Key was provided

Postby iceyp » Wed May 13, 2015 5:43 am

Hi Beppe.

The code we are using is in the first post for this thread. Please confirm that this code should work.

We are definitely using 1.1.0.2.

Cannot tell you what is in DeviceInfo.Errors as the exception is thrown by the manager.GetDeviceInfo statement and so the DeviceInfo object is nothing. Have tried Internet Explorer on other machines...all return the exception, whereas all other browsers work ok.

Cheers.

support-all
Posts: 32
Joined: Mon Oct 08, 2012 2:47 am

Re: No API Key was provided

Postby support-all » Wed May 13, 2015 9:51 am

Hi iceyp!

it's a very strange behaviour! As I said, in the new version, there is no point in cloud client code where the exception (which message is "The WURFL Cloud service returned an unexpected response") is thrown.
In order to replicate the problem, can I ask you what is the type of your project (ASP.NET web forms app, ASP .NET MVC web app, ..., etc)?

Cheers

Beppe

support-all
Posts: 32
Joined: Mon Oct 08, 2012 2:47 am

Re: No API Key was provided

Postby support-all » Wed May 13, 2015 9:51 am

Hi iceyp!

it's a very strange behaviour! As I said, in the new version, there is no point in cloud client code where the exception (which message is "The WURFL Cloud service returned an unexpected response") is thrown.
In order to replicate the problem, can I ask you what is the type of your project (ASP.NET web forms app, ASP .NET MVC web app, ..., etc)?

Cheers

Beppe

iceyp
Posts: 11
Joined: Sun May 03, 2015 1:38 am

Re: No API Key was provided

Postby iceyp » Thu May 14, 2015 12:50 am

Hi Beppe.

The project is ASP .NET Web Forms.

Cheers.

Elliotfehr

Re: No API Key was provided

Postby Elliotfehr » Fri May 15, 2015 10:58 am

Iceyp,

We are having difficulty replicating this issue on our end. Are you able to try and create a fresh ASP.NET project and include the WURFL cloud client and let us know if the issue occurs with the new project?

Thank you,

Elliot

iceyp
Posts: 11
Joined: Sun May 03, 2015 1:38 am

Re: No API Key was provided

Postby iceyp » Sat May 16, 2015 4:33 am

Hi Elliot.

I created a completely new Website (ASP .Net Web Forms), installed WURFL client, hit F5 in VS (using IE as the default browser) and the problem still occurred. I have tried to attach the project to this post (as a zip) but the upload doesn't work.

Cheers.

Elliotfehr

Re: No API Key was provided

Postby Elliotfehr » Sat May 16, 2015 9:30 am

Hello,

Are you able to upload the zipped project to your file manager in your customer vault so that we can investigate?

Thank you,

Elliot

iceyp
Posts: 11
Joined: Sun May 03, 2015 1:38 am

Re: No API Key was provided

Postby iceyp » Sat May 16, 2015 10:56 pm

Hi Elliot.

File Website1 uploaded to my File Manager.

Cheers.


Who is online

Users browsing this forum: No registered users and 5 guests