uPnp SetAVTransportURI缺少SOAP操作头

时间:2016-08-29 09:20:03

标签: soap xmlhttprequest action upnp dlna

我正在玩bubbleUpnp并一般地看着uPnp。我已经推出了一个urn:schemas-upnp-org:device:MediaRenderer:1发现,应用程序会通知它的功能。

第一个问题是我在不同的设备上有xmbc,ps3,ps4都可以看到对方但只有bubbleUpnp和我的路由器回复(这适用于ssdp:all to)。

尝试在bubbleUpnp上设置AVTransportURI我一直在收到uPnp错误

<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <s:Fault>
            <faultcode>s:Client</faultcode>
            <faultstring>UPnPError</faultstring>
            <detail>
                <UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
                    <errorCode>401</errorCode>
                    <errorDescription>No action by that name at this service. Missing SOAP action header.</errorDescription>
                </UPnPError>
            </detail>
        </s:Fault>
    </s:Body>
</s:Envelope>

但抓住查尔斯的头球显示了那里。

POST
/dev/9bfe134f-b027-52f3-ffff-ffffaae644dd/svc/upnp-org/AVTransport/
action HTTP/1.1 Host    192.168.1.65:58645 Accept   */*
Accept-Encoding gzip, deflate Content-Length    429
Content-Type    text/xml; charset=utf-8 Accept-Language en-us
soapaction  urn:schemas-upnp-org:service:AVTransport:1#
SetAVTransportURI Connection    keep-alive
User-Agent  channelListingTest/1 CFNetwork/758.3.15 Darwin/15.4.0

继承人肥皂要求

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <s:Body>
        <u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
            <InstanceID>0</InstanceID>
            <CurrentURI>http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4</CurrentURI>
            <CurrentURIMetaData />
        </u:SetAVTransportURI>
    </s:Body>
</s:Envelope>

在查尔斯的肥皂标签下,我看起来没问题

SetAVTransportURI   Method  
Parameters  Element 
[InstanceID: null]  Element 0
[CurrentURI: null]  Element http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4
[CurrentURIMetaData: null]  Element

这可能是我在使用soap / upnp的经验中有什么突出的吗?

干杯

编辑继承人发送请求的代码。

                var request = new XMLHttpRequest();
                request.open("POST", "http://192.168.1.65:58645/dev/9bfe134f-b027-52f3-ffff-ffffaae644dd/svc/upnp-org/AVTransport/action");

                request.onreadystatechange = function() {
                        console.log(request.responseText)
                };

                let setAVTransport = '<?xml version="1.0" encoding="utf-8"?>' +
                                        '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">' +
                                                '<u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">' +
                                                    '<InstanceID>0</InstanceID>' +
                                                      '<CurrentURI>http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4</CurrentURI>' +
                                                    '<CurrentURIMetaData></CurrentURIMetaData>' +
                                                '</u:SetAVTransportURI>' +
                                            '</s:Body>' +
                                        '</s:Envelope>';

            request.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
            request.setRequestHeader("SOAPAction", "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI");

                request.send(setAVTransport);

1 个答案:

答案 0 :(得分:0)

我不能保证这是真正的问题,但SOAPAction值应该是双引号(不要问我,我认为它也没有任何意义)。

尝试这样的事情:

request.setRequestHeader("SOAPAction", "\"urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI\"");

总的来说,我建议检查网络上的实际消息(wireshark是一个很棒的工具),并将它们与有效的客户端发送的消息进行比较。