0

On searching for LG TV through UPnP/SSDP, I get below response:

HTTP/1.1 200 OK
CACHE-CONTROL: max-age=172800
DATE: Mon Dec 16 06:31:03 2013 GMT
EXT:
LOCATION: http://<IP>:<PORT>/udap/api/data?target=rootservice.xml
SERVER: Linux/3.0.13 UDAP/1.0 47LN5750-UH/05.00.30
ST: udap:rootservice
USN: uuid:c8ffxxxx-xxxx-xxxx-xxxx-xxxx34b4c708::udap:rootservice

After this, using LOCATION URL provided above when I try to get the LG Smart TV description to know device info, services & commands supported, I get a "404 - Not Found" error.

Here is my code for getting decription:

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://<IP>:<PORT>/udap/api/data?target=rootservice.xml"]
                                                               cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
                                                           timeoutInterval:10];

[request setHTTPMethod: @"GET"];

NSError *requestError;
NSURLResponse *urlResponse = nil;

NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&requestError];*

Why am I getting "404 - Not Found" error when I am trying to access a URL returned by UDAP service?

Thanks in advance

simonc
  • 41,632
  • 12
  • 85
  • 103
Coding Glory
  • 1
  • 1
  • 1
  • LOCATION header has a valid url in reality I assume? Have you checked that the url really exists (e.g. with a Web browser)? – Jussi Kukkonen Dec 16 '13 at 08:31
  • @jku : Yes, LOCATION header was a valid URL with an IP:PORT (LOCATION: http://:/udap/api/data?target=rootservice.xml). However, when i test this URL on a web brower, it also fails to load the page. Does this sound like a bug in LG or am I doing something wrong? – Coding Glory Dec 16 '13 at 09:03
  • 1
    It should be available, so that does sound like an LG bug so far (just one that's a bit hard to believe...). Have you checked other M-SEARCH replies (if you search for "ssdp:all"), maybe e.g. the device that owns the service (or the upnp:rootdevice) has a different url? – Jussi Kukkonen Dec 16 '13 at 09:55
  • @jku : Through "ssdp:all" I am able to discover LG TV and it provided a valid description URL. I am able to get description of TV. – Coding Glory Dec 18 '13 at 17:27
  • Continuing above comment: I am able to get description of TV with AVTransport, RenderingControl, ConnectionManager services which I think will be useful for DLNA. I am trying to build a remote control for LG and from my investigation it seems, I need access to netrcu and/or rootservice services. Please guide me if I am correct on this. – Coding Glory Dec 18 '13 at 17:40
  • AVTransport+RedneringControl+ConnectionManager = DLNA Digital Media Renderer (DMR). If you just want to control the DMR through the standard API (in other words implement a UPnP control point), that's enough: I don't know why you would want that though, many media players can already control a DMR. "rootservice" and "netrcu" are not familiar to me -- maybe they are some LG proprietary ones -- but they might provide other functionality (like a "remote control" API for a TV). – Jussi Kukkonen Dec 18 '13 at 18:52
  • Can you share how are you discovering the device? I'm trying everything but I can't get location info. I only got `User-Agent` info from the device. – Sebastian May 02 '16 at 01:53

1 Answers1

2

When doing HTTP GET try setting HTTP header User-Agent to UDAP/2.0

If you want to access netrcu and other services check out UDAP spec http://developer.lgappstv.com/TV_HELP/index.jsp?topic=%2Flge.tvsdk.references.book%2Fhtml%2FUDAP%2FUDAP%2FLG+UDAP+2+0+Protocol+Specifications.htm

vinayr
  • 11,026
  • 3
  • 46
  • 42