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
When doing HTTP GET try setting HTTP header
User-Agent
toUDAP/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