0
votes

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

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
@jku : Yes, LOCATION header was a valid URL with an IP:PORT (LOCATION: http://<IP>:<PORT>/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
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
@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
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

1 Answers

2
votes

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