Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
guidamedia2
Visitor

Web Service Not Returning Data

I have a simple ruURLTransfer script that returns no data. I am developing for a Roku XD|S running version 3.1 build 1017.

The urls that come with the examples work well, but not my urls. I have tried a myriad of things. Your help is appreciated.

I have tried dynamically generating the XML, and also linked directly to an xml file. I have used my data and data from one of the examples. I have also tried with and without a query string. Nothing works.

Here is my code:

api = CreateObject("roUrlTransfer")
api.setUrl("http://MYSERVER/roku_web_service.php?task=menus")
'api.setUrl("http://MYSERVER/menus.xml")
'debug
print "Sending Request"
content = api.GetToString()
if content = "" then
print "failure reason: " + api.GetFailureReason()
else
print "success: " + content
end if
print "end result"


Here is the result

------ Running ------
SUCCESSFUL
result from the api call:
fail:
end result


I thought it was my xml, but nothing is returned at all.

Thanks in advance for your help,
Rob
0 Kudos
4 REPLIES 4
TheEndless
Channel Surfer

Re: Web Service Not Returning Data

The debug output you posted doesn't match the code you posted, so it's not exactly clear what you're trying to do. Are you trying to retrieve XML from your web site? Can you access the url from a browser on the same network to verify that it's returning the expected data? What's the value returned from api.GetFailureReason()?
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
guidamedia2
Visitor

Re: Web Service Not Returning Data

Some one in my office suggested a solution and it worked. My issue was the url was to my sandbox, something like http://localhost/~mysandbox/service.php.

I am not sure if it is an internal thing or if roUrlTransfer tries to validate URL's, but when I changed from using the server name to an IP it worked fine.

Does roUrlTransfer validate urls?
0 Kudos
belltown
Roku Guru

Re: Web Service Not Returning Data

I don't think Roku is able to resolve 'localhost'. It works on your PC because your PC has a 'hosts' file that maps the domain name, localhost, to the loopback IP address, 127.0.0.1, which refers to your local PC, where your server is running. So if you type the URL in your web browser it will direct the request to the server running on that particular network node. On the Roku, even if it were to support localhost, it would be looking for the server to be running on your Roku, not on your PC. That's why you need to give the actual IP address (or a domain name that resolves to that IP address) of your computer that is running your server.
0 Kudos
guidamedia2
Visitor

Re: Web Service Not Returning Data

I run a web server at home with multiple sites... it should have been obvious especially because I have run into that before. Just not thinking of the Roku as a computer.

Thanks,
R
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.