Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 15
Registered: ‎05-03-2011
My Device: 9900 Bold
My Carrier: bell
Accepted Solution

Remote data access to corporate intranet services with WebWorks

 

I'm trying to work out the process of accessing data from a service on my corporate intranet in a WebWorks application. I would like to determine a methodology that works from one end of the testing spectrum to the other; ie. in Ripple, in a simulator, and on a device.

 

My problem centres around how to structure my URL in a way that works in all the above scenarios.

 

in my config.xml I have the following entry:

 

<access uri="http://myserver.mycompany.ca" subdomains="true" />

 

I'm using a simple jQuery $.get:

 

$.get(urlLogin,function (data) {
alert(data);
});

 

In Ripple, if I specify urlLogin as "/myApp/service/login.ashx?loginID=123456" I get a legitimate return of data in my alert above. As soon as I alter the urlLogin value to "http://myserver.mycompany.ca/myApp/service/login.ashx?loginID=123456" (which I assume is necessary to reach the service) I run into all sorts of cross-domain issues, which I think I can solve with CORS (messily) but would rather not.

 

When I try in a simulator I get no data back regardless of which approach I take.


Also, the Web Inspector is not working in my environment (Windows 7 x64) when I run the simulator (9930 OS 7). It loads up an IP address as expected and claims to be online, but when I use the IP address in Chrome (v.27.0.1453.110) I get a blank form (as described in other requests for assistance) which consists of a search field in the top right and two controls, bottom left.

 

Because this doesn't work either I have limited options for determining what is going on in the simulator.

 

Any assistance would be greatly appreciated.

 

Thanks in advance,

Jim Ashton

Developer
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: Remote data access to corporate intranet services with WebWorks

Its not too hard

 

Buy any dumb domain

 

Return the data with a CORS header

 

If you need it internal only make - e.g. private.fred.com point to your internal IP and deploy that to the DNS server

 

Its pretty easy once you get past the basics




Click the like button if you find my posts useful!
Contributor
Posts: 15
Registered: ‎05-03-2011
My Device: 9900 Bold
My Carrier: bell

Re: Remote data access to corporate intranet services with WebWorks

I looked at the following sample http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Calling-a-web-service-from-a-Bla... which purports to do what I'm trying to accomplish.

 

Specifically, there is a line in the sample referencing the URL of the service:

 

var url = "http://localhost:4100/service/service.asmx/GetCarJSON?make=Subaru&model=WRX";

The implication here (to me) is that this service is available to the webworks application locally in some manner, but there are no details explaining how this is implemented.  So either I have misunderstood the implication, or more information is needed.

 

Any thoughts?  Maybe from the authors of the post?

 

Thanks in advance,

Jim Ashton

Retired
Posts: 71
Registered: ‎09-19-2012
My Device: No sleep til BlackBerry 10
My Carrier: Bell

Re: Remote data access to corporate intranet services with WebWorks

I think the locahost portion of that solution is just a placeholder domain and should not be explicitly added into your own code.  I say this since localhost would point to your BlackBerry and not to your intranet server.  I would use a cname url like http://mydomain.com and ensure that the domain has been whitelisted (already accomplished on your end as stated in your first post).

 

Following the code in the solution should yield the results you're looking for and, hopefully, shouldn't cause you any cross-domain issues.  As for Ripple, you might just need to switch-up the URL based on the environment you're testing on if Chrome doesn't allow you to make the cross-domain request you're hoping for.

 

Hope that helps!

------------------------------
@grahamzibar
-_- zZZ
Regular Contributor
Posts: 101
Registered: ‎03-18-2013
My Device: Dev Alpha B & PlayBook 32
My Carrier: mobinil

Re: Remote data access to corporate intranet services with WebWorks

Thanks ,
Developer
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: Remote data access to corporate intranet services with WebWorks

I hope we helped a little

 

If you have any specific Qs PM me + I'll do what I can




Click the like button if you find my posts useful!
Contributor
Posts: 15
Registered: ‎05-03-2011
My Device: 9900 Bold
My Carrier: bell

Re: Remote data access to corporate intranet services with WebWorks

@grahamzibar,

 

Is the whitelisted domain (or domains) expected to be treated as "same origin" from the point of view of the application, and thus immune to cross-origin restrictions?

 

That is the behaviour I had hoped for, but so far it is not the behaviour evidenced by the application...

 

Now that I have a somewhat working debugger I can at least see what is (not) happening, which may enable me to ask more specific (and hopefully thus more beneficial) questions.

Contributor
Posts: 15
Registered: ‎05-03-2011
My Device: 9900 Bold
My Carrier: bell

Re: Remote data access to corporate intranet services with WebWorks

With a working debugger I can see that I have a timeout error.  This occurs whether the page I am trying to access is a public facing internet page or a private intranet page.  In other words both

 

<accessuri=http://myserver.mycompany.ca"subdomains="true />

and

<accessuri=http://mypubliccompany.ca"subdomains="true />

 

fail equally. 

 

The timeout error is http://mypubliccompany.ca/:<br><br>Local connection timed out after ~ 120000

 

I've included my entire config.xml file as shown below:

 

<?

xmlversion="1.0"encoding="utf-8"?>

<

widgetxmlns:rim="http://www.blackberry.com/ns/widgets"version="1.0.0"rim:header="RIM-webworks:rim/webworks"xmlns="http://www.w3.org/ns/widgets">

<

name>CRS Mobile</name>

<

description/>

<

authorhref=""rim:copyright=""email="">Me</author>

<

contentsrc="index.htm"/>

<

featureid="blackberry.app"websecurity="disable"required="true"version="1.0.0.0"/>

<

featureid="blackberry.system"required="true"version="1.0.0.0"/>

<

accessuri="http://myserver.mycompany.ca"subdomains="true"/>

<

licensehref=""/>

<

rim:cachedisableAllCache="false"aggressiveCacheAge="2592000"maxCacheSizeTotal="1024"maxCacheSizeItem="128"/>

</

widget>

 

Hopefully this will be enough detail to coincide with somebody's experience.

 

Thanks in advance,

 

Jim Ashton

Retired
Posts: 71
Registered: ‎09-19-2012
My Device: No sleep til BlackBerry 10
My Carrier: Bell

Re: Remote data access to corporate intranet services with WebWorks

Unfortunately I'm not sure why you would get a timeout Smiley Sad  Your code looks fine to me.  I'll ask around and see what I can find.

------------------------------
@grahamzibar
-_- zZZ
Retired
Posts: 71
Registered: ‎09-19-2012
My Device: No sleep til BlackBerry 10
My Carrier: Bell

Re: Remote data access to corporate intranet services with WebWorks

Did you adopt the xhr request format used in the solution you found?  Or are you still using jQuery?

------------------------------
@grahamzibar
-_- zZZ