Reputation: 52
I am currently working on a new SONOS integration. I have built the bare minimum functions outlined here and have had the python test suite pass all tests:
SUITE Summary: Passed. Passed: 60, Warnings: 0, Failed: 0.
I have added a custom service description on a new SID, with a Service Name, both endpoints, a polling interval, anonymous authentication, the correct strings URL, a Music Service container type and no selected capabilities.
I can add my service in my SONOS client, but receive the message "Unable to browse music". I know there could be any number of things at play, but does anything jump out here? My brain is frazzled and I expect I'm missing something obvious! :)
Thanks for your help!
EDIT:
Here's an example "root" getMetadata request:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:SOAPServerWSDL" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getMetadata>
<id xsi:type="xsd:string">root</id>
<index xsi:type="xsd:integer">0</index>
<count xsi:type="xsd:integer">10</count>
<recursive xsi:type="xsd:boolean">false</recursive>
</ns1:getMetadata>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
And its result:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://api-server.dev/index.php/sonos" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getMetadataResponse xmlns:ns1="urn:SOAPServerWSDL">
<getMetadataResult xsi:type="tns:metadata">
<index xsi:type="xsd:integer">0</index>
<count xsi:type="xsd:integer">2</count>
<total xsi:type="xsd:integer">2</total>
<mediaCollection xmlns="" xsi:type="tns:mediaCollection">
<id xsi:type="xsd:string">genres</id>
<title xsi:type="xsd:string">Playlists</title>
<itemType xsi:type="xsd:string">collection</itemType>
</mediaCollection>
<mediaCollection xmlns="" xsi:type="tns:mediaCollection">
<id xsi:type="xsd:string">my_playlists</id>
<title xsi:type="xsd:string">My Playlists</title>
<itemType xsi:type="xsd:string">collection</itemType>
</mediaCollection>
</getMetadataResult>
</ns1:getMetadataResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
These, and the other functions all pass the python self-test. ¯\_(ツ)_/¯
Upvotes: 0
Views: 894
Reputation: 52
I finally have our playlists and tracks in SONOS!
Firstly, SOAP is new to me. Haven't worked with it before and I'm building our SONOS integration in PHP. I was using the NuSOAP library through which I had built my own WSDL file which I was then using under my SOAP server.
Instead I have now rebuilt my SOAP server from scratch using the WSDL available in the API documentation and using the standard PHP SoapServer class. This has resulted in some subtle changes in the WSDL structure and in the server responses.
If anyone is having trouble getting started, I'd recommend using SONOS' own WSDL as follows:
$server = new SoapServer(
'sonos.wsdl',
array('encoding'=>'ISO-8859-1')
);
Don't forget to update the wsdl:service value at the bottom of the file:
<soap:address location="{endpoint}"/>
What I didn't know is that approaching the solution like this helps to highlight anywhere you've misnamed or omitted parameters or response values as the SOAP server will already know what the data looks like (rather than relying on your own, custom WSDL file).
Upvotes: 1
Reputation: 31
"Unable to to browse music" normally means that Sonos can't connect to your server. If you remove your account from Music Services and try to login again it won't let you either. If you passed the test successfully, try to remove and add your service again and check all the URL's. Hope it helps.
Upvotes: 0