问题
I am using cling UPnP framework in android to connect to UPnP enabled device. I am successful in creating a device and browsing for available devices in the network. But for the samsung TV in the network the framework in not returning any actions. Here I am adding the service detail for the RenderingControl
<service>
<serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType>
<serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
<controlURL>/upnp/control/RenderingControl1</controlURL>
<eventSubURL>/upnp/event/RenderingControl1</eventSubURL>
<SCPDURL>RenderingControl1.xml</SCPDURL>
</service>
This is the url for fetching the service descriptor xml file
> http://<ip address>:52235/dmr/SamsungMRDesc.xml
But the SCPDURL is relative and I am wondering whether the cling framework is searching for
http://<ip address>:52235/RenderingControl1.xml
instead of
http://<ip address>:52235/dmr/RenderingControl1.xml
Is it the reason for no actions being displayed for the services in cling UPnP or am I doing something really stupid?
How can I properly do this with cling UPnP?
回答1:
Just a clarification beforehand: the URL *SamsungMRDesc.xml
is a device descriptor, not a service descriptor as you've written, right?
The <SCPDURL>
per UPnP spec is "relative to the URL at which the device description is located". So yes, the correct absolute SCPDURL is the second one. But i would be highly surprised if there was really such severe bug in Cling. So to offer some theories:
- What do you mean by "no actions being displayed in Cling UPnP" ? Is that some existing example app or your code? Cling itself does not provide any GUI. Might there be a bug in that code?
- Are you absolutely sure about the device descriptor URL (SamsungMRDesc)? Is it reachable manually, i.e. by simply copy&pasting the URL into web browser?
- What you see if you copy&paste the SCPDURL into web browser? Are there some
<action>
nodes under<actionList>
? - Have you tried to query your Samsung TV with DeviceSpy from Intel Developer Tools ? You can see what an other UPnP stack sees, besides Cling. Furthermore, you can right-click on a Device node as well as Service node and see where DeviceSpy looks for the descriptions.
- As a last instance, you can sniff what's being sent back and forth with Wireshark. Start with setting Wireshark IP filter to the address of your Samsung TV.
Theories 4 and 5 obviously require a PC connected to the same network as the TV (and your Android).
来源:https://stackoverflow.com/questions/12392087/cling-upnp-not-returning-actions