Search code examples
soapnetwork-programmingupnpservice-discovery

My Samsung TV won't respond to some UPNP XML requests to describe its service


I've been reading this UPNP PDF and it says that when a device enters the network, it sends a SSDP message with its LOCATION, which is an address that will describe its services. When I turn my Samsung Smart TV on, I get around 6 or 7 SSDP messages. One of them is the following:

NOTIFY * HTTP/1.1
HOST: 239.255.255.250:1900
CACHE-CONTROL: max-age=1800
LOCATION: http://192.168.1.107:7676/smp_7_
NT: upnp:rootdevice
NTS: ssdp:alive
SERVER: SHP, UPnP/1.0, Samsung UPnP SDK/1.0
USN: uuid:uuid_here::upnp:rootdevice

So when I try to connect to the LOCATION in this SSDP message, I get this:

<?xml version="1.0"?>
<root xmlns='urn:schemas-upnp-org:device-1-0' xmlns:sec='http://www.sec.co.kr/dlna' xmlns:dlna='urn:schemas-dlna-org:device-1-0'>
 <specVersion>
  <major>1</major>
  <minor>0</minor>
 </specVersion>
 <device>
  <deviceType>urn:dial-multiscreen-org:device:dialreceiver:1</deviceType>
  <friendlyName>[TV]Samsung LED40</friendlyName>
  <manufacturer>Samsung Electronics</manufacturer>
  <manufacturerURL>http://www.samsung.com/sec</manufacturerURL>
  <modelDescription>Samsung TV NS</modelDescription>
  <modelName>UN40HU7000</modelName>
  <modelNumber>1.0</modelNumber>
  <modelURL>http://www.samsung.com/sec</modelURL>
  <serialNumber>serialNumberHere</serialNumber>
  <UDN>uuid:uuid_here</UDN>
  <sec:deviceID>EXCNHA5ILPT66</sec:deviceID>
  <sec:ProductCap>Resolution:1920X1080,Y2014</sec:ProductCap>
  <serviceList>
   <service>
    <serviceType>urn:dial-multiscreen-org:service:dial:1</serviceType>
    <serviceId>urn:dial-multiscreen-org:serviceId:dial</serviceId>
    <controlURL>/smp_9_</controlURL>
    <eventSubURL>/smp_10_</eventSubURL>
    <SCPDURL>/smp_8_</SCPDURL>
   </service>
  </serviceList>
  <sec:Capabilities>
   <sec:Capability name='samsung:multiscreen:1' port='8001' location='/ms/1.0/'></sec:Capability>
  </sec:Capabilities>
 </device>
</root>

The UPNP PDF says that I must connect to the controlURL in the service described above, but when i GET http://192.168.1.107/smp_9_ I get no response. It simply does not respond. I though it was something related to the service being not activated at the moment, but for example, this post teaches how to send a SOAP message to the RenderingControl1 service to change the volume. This service should be active when I'm using the TV to watch something. So I tried to respond to the SSDP message related to RenderingControl1:

NOTIFY * HTTP/1.1
HOST: 239.255.255.250:1900
CACHE-CONTROL: max-age=1800
LOCATION: http://192.168.1.107:7676/smp_3_
NT: urn:samsung.com:device:RemoteControlReceiver:1
NTS: ssdp:alive
SERVER: SHP, UPnP/1.0, Samsung UPnP SDK/1.0
USN: uuid:uuid_here::urn:samsung.com:device:RemoteControlReceiver:1

When I GET 192.168.1.107:7676/smp_3_ the response is:

<?xml version="1.0"?>
<root xmlns='urn:schemas-upnp-org:device-1-0' xmlns:sec='http://www.sec.co.kr/dlna' xmlns:dlna='urn:schemas-dlna-org:device-1-0'>
 <specVersion>
  <major>1</major>
  <minor>0</minor>
 </specVersion>
 <device>
  <deviceType>urn:samsung.com:device:RemoteControlReceiver:1</deviceType>
  <friendlyName>[TV]Samsung LED40</friendlyName>
  <manufacturer>Samsung Electronics</manufacturer>
  <manufacturerURL>http://www.samsung.com/sec</manufacturerURL>
  <modelDescription>Samsung TV RCR</modelDescription>
  <modelName>UN40HU7000</modelName>
  <modelNumber>1.0</modelNumber>
  <modelURL>http://www.samsung.com/sec</modelURL>
  <serialNumber>serialNumberHere</serialNumber>
  <UDN>uuid:uuid_here</UDN>
  <sec:deviceID>EXCNHA5ILPT66</sec:deviceID>
  <sec:ProductCap>Resolution:1920X1080,ImageZoom,ImageRotate,Y2014,ENC</sec:ProductCap>
  <serviceList>
   <service>
    <serviceType>urn:samsung.com:service:MultiScreenService:1</serviceType>
    <serviceId>urn:samsung.com:serviceId:MultiScreenService</serviceId>
    <controlURL>/smp_5_</controlURL>
    <eventSubURL>/smp_6_</eventSubURL>
    <SCPDURL>/smp_4_</SCPDURL>
   </service>
  </serviceList>
  <sec:Capabilities>
   <sec:Capability name='samsung:multiscreen:1' port='8001' location='/ms/1.0/'></sec:Capability>
  </sec:Capabilities>
 </device>
</root>

but when I try to GET 192.168.1.107:7676/smp_5_ I also get no response. I also tried to GET 192.168.1.107:7676/smp_3_/smp_5_ because /smp_5_ is a 'subset' of /smp_3_ I get BAD Request, which tells that my TV is ignoring /smp_5_ but explictly tells that /smp_3_/smp_5_ is wrong, so /smp_3_ is quite rigth, but I don['t know what's happening. According to the UPNP PDF, GET 192.168.1.107:7676/smp_5_ should retrieve the description for the service... How to get the description of the RenderingControl?


Solution

  • According to UPnP Specification,

    http://192.168.1.107:7676/smp_7_ from SSDP is called DeviceDescription URL, so you could get XML via HTTP GET

    while URLs in

    <controlURL>/smp_9_</controlURL>
    <eventSubURL>/smp_10_</eventSubURL>
    <SCPDURL>/smp_8_</SCPDURL>
    

    http://192.168.1.107:7676/smp_9_ is control URL, you need to do SOAP action with HTTP Post and necessary parameters.

    http://192.168.1.107:7676/smp_10_ is event subscription URL, but you need to do SUBSCRIBE with necessary parameters not GET.

    http://192.168.1.107:7676/smp_8_ is ServiceDescription URL, you can do GET and get XML file.

    More in: http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf