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
zantoro
Posts: 14
Registered: ‎09-14-2012
My Device: Bold 9700
My Carrier: Bouygues
Accepted Solution

Troubleshooting Webworks web service consumption - works on Ripple

[ Edited ]

Hello,

I'm trying to develop my first web service Webworks app. It works perfectly fine on Ripple.

I've published the app on my BB Bold 9700 (OS6), it opens up fine but when I fire the XMLHttpRequest.open I seem not to receive any answer from the webservice.

Is there any way to troubleshoot these kind of issues?

 

      var xmlHttp = new XMLHttpRequest();
		    
      function doClick() {
		var varfirstname = document.getElementById('Firstname').value;
		var varlastname = document.getElementById('Lastname').value;
//        var url = "http://localhost:1762/EPB-Webservice.asmx/GetUserJSON?firstname=" + varfirstname + "&lastname=" + varlastname;
        var url = "http://myserver/EPB-Webservice/EPB-Webservice.asmx/GetUserJSON?firstname=" + varfirstname + "&lastname=" + varlastname;
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = callbackFunction;
        xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        document.getElementById('results').innerHTML = "Requesting...";
        xmlHttp.send(null);
      }

 

 

Thanks,

Roberto.

Please use plain text.
Developer
The_Anomaly
Posts: 322
Registered: ‎08-06-2012
My Device: Dev Alpha / Playbook / Curve 9300

Re: Troubleshooting Webworks web service consumption - works on Ripple

Are you aware of the web inspector option.  You can enable it in ripple before launching your app on the device?  Then you can inspect errors and elements on the device using the ip address of the device and port 1337.

 

Also have you white listed the service domain in your config.xml?

If it helped you, click like. :smileyhappy:
Please use plain text.
BlackBerry Development Advisor
chadtatro
Posts: 619
Registered: ‎10-01-2009
My Device: Z10
My Carrier: Bell

Re: Troubleshooting Webworks web service consumption - works on Ripple

Hello,

 

I would first start by making sure the domain you're trying to access via XHR is properly whitelisted in the config.xml.  

 

Docs: https://developer.blackberry.com/html5/documentation/access_element_834677_11.html

 

<access uri="http://www.mydomain.com" subdomains="true"></access>

 

 

 

Chad Tetreault | App Development Consultant | BlackBerry Developer Relations | developer.blackberry.com | @chadtatro
Please use plain text.
Contributor
zantoro
Posts: 14
Registered: ‎09-14-2012
My Device: Bold 9700
My Carrier: Bouygues

Re: Troubleshooting Webworks web service consumption - works on Ripple

sorry guys, I forgot to answer... you were both right. I was missing the whitelist for the domain.

 

Thanks a lot

Please use plain text.