如何使用 DLNA 浏览 Synology NAS 上的目录?

问题描述 投票:0回答:1

GET http://192.168.1.5:50001/desc/device.xml
返回以下数据:

<?xml version="1.0" encoding="utf-8"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
    <specVersion>
        <major>1</major>
        <minor>0</minor>
    </specVersion>
    <device>
        <deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>
        <dlna:X_DLNADOC xmlns:dlna="urn:schemas-dlna-org:device-1-0">DMS-1.50</dlna:X_DLNADOC>
        <friendlyName>MY-NAS</friendlyName>
        <manufacturer>Synology Inc</manufacturer>
        <manufacturerURL>http://www.synology.com/</manufacturerURL>
        <modelDescription>Synology DLNA/UPnP Media Server</modelDescription>
        <modelName>DS210j</modelName>
        <modelURL>http://www.synology.com/</modelURL>
        <serialNumber>A2G6N03829</serialNumber>
        <UDN>uuid:00113206-3dd5-0011-d53d-d53d01234567</UDN>
        <presentationURL>http://192.168.1.5:5000/</presentationURL>
        <iconList>
            <icon>
                <mimetype>image/jpeg</mimetype>
                <width>120</width>
                <height>120</height>
                <depth>24</depth>
                <url>/tmp_icon/dmsicon120.jpg</url>
            </icon>
            <!-- 3 more icons here -->
        </iconList>
        <serviceList>
            <service>
                <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
                <serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
                <SCPDURL>/connmgrSCPD.xml</SCPDURL>
                <controlURL>/ConnectionManager/control</controlURL>
                <eventSubURL>/ConnectionManager/event</eventSubURL>
            </service>
            <service>
                <serviceType>urn:schemas-upnp-org:service:ContentDirectory:1</serviceType>
                <serviceId>urn:upnp-org:serviceId:ContentDirectory</serviceId>
                <SCPDURL>/cdsSCPD.xml</SCPDURL>
                <controlURL>/ContentDirectory/control</controlURL>
                <eventSubURL>/ContentDirectory/event</eventSubURL>
            </service>
            <service>
                <serviceType>urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1</serviceType>
                <serviceId>urn:microsoft.com:serviceId:X_MS_MediaReceiverRegistrar</serviceId>
                <SCPDURL>/msrrSCPD.xml</SCPDURL>
                <eventSubURL>/MediaReceiverRegistrar/event</eventSubURL>
                <controlURL>/MediaReceiverRegistrar/control</controlURL>
            </service>
        </serviceList>
    </device>
</root>

当我尝试执行以下请求时:

curl --location 'http://192.168.1.5:50001/ContentDirectory/control' \
--header 'SOAPAction: urn:schemas-upnp-org:service:ContentDirectory:1#Browse' \
--header 'Content-Type: text/xml; charset="utf-8"' \
--data '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <s:Body>
        <u:Browse xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1">
            <ObjectID>0</ObjectID>
            <BrowseFlag>BrowseDirectChildren</BrowseFlag>
            <Filter>*</Filter>
            <StartingIndex>0</StartingIndex>
            <RequestedCount>1000</RequestedCount>
            <SortCriteria></SortCriteria>
        </u:Browse>
    </s:Body>
</s:Envelope>

我收到错误代码

-111: Invalid Action
。这里有什么问题吗? 我尝试从操作中删除
#Browse
并仅发送
#Browse
- 这没有帮助。

根据服务器回复,Synology 使用

Linux/2.6.32.12, UPnP/1.0, Portable SDK for UPnP devices/1.6.18

soap synology upnp dlna
1个回答
0
投票

根据 UPnP 设备架构规范第 3.2 节,调用操作的标头如下所示

POST path of control URL HTTP/1.1
HOST: host of control URL:port of control URL
CONTENT-LENGTH: bytes in body
CONTENT-TYPE: text/xml; charset="utf-8"
SOAPACTION: "urn:schemas-upnp-org:service:serviceType:v#actionName"

所需的 HTTP 方法是

POST
;你的命令没有设置这个。

我对curl不太熟悉,但认为添加

-X POST
可能会达到你想要的效果。

© www.soinside.com 2019 - 2024. All rights reserved.