Service Subscription Problem

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Service Subscription Problem

bebopfreak
I added Cling as an alternative to Cyberlink to UPnPlay (Android UPnP Control Point).
It's mostly working. but I have difficulties with subscribing to services. I don't know, what I'm missing.
Subscriptions are established, but afterwards there is a NullPointerException from Cling.

The remote device is a Roku Soundbridge (Media Renderer), Cling library is snapshot beta5.

I haven't tested much so far
- SSDP detection usually takes noticibly longer than with Cyberlink
- library is bigger (shouldn't be a problem)
- there is one example streaming from WMP 12 to Soundbridge, where I get Action Response Errors from Cyberlink, but Cling work without problems.

Log of the NullPointerException:

09-05 10:29:46.925 V/Player  (20022): setRenderer: uuid:526F6B75-536F-756E-6442-000D4B20056C
09-05 10:29:46.925 V/ClingDevice(20022): subscribe service 0
09-05 10:29:46.935 V/ClingDevice(20022): subscribe service 1
09-05 10:29:46.945 V/ClingDevice(20022): subscribe service 2
09-05 10:29:46.985 I/dalvikvm(20022): Jit: resizing JitTable from 4096 to 8192
09-05 10:29:47.085 D/dalvikvm(20022): GC_FOR_MALLOC freed 6314 objects / 427824 bytes in 61ms
09-05 10:29:47.125 V/ClingDevice(20022): subscription established
09-05 10:29:47.175 D/dalvikvm(20022): GC_FOR_MALLOC freed 1501 objects / 273224 bytes in 49ms
09-05 10:29:47.215 I/dalvikvm(20022): Could not find method eu.medsea.mimeutil.MimeUtil.getMimeTypes, referenced from method org.teleal.common.io.IO.discoverContentType
09-05 10:29:47.215 V/ClingDevice(20022): subscription established
09-05 10:29:47.215 W/dalvikvm(20022): VFY: unable to resolve static method 980: Leu/medsea/mimeutil/MimeUtil;.getMimeTypes (Ljava/io/File;)Ljava/util/Collection;
09-05 10:29:47.215 D/dalvikvm(20022): VFY: replacing opcode 0x71 at 0x0000
09-05 10:29:47.215 D/dalvikvm(20022): VFY: dead code 0x0003-0033 in Lorg/teleal/common/io/IO;.discoverContentType (Ljava/io/File;)Ljava/lang/String;
09-05 10:29:47.225 W/UpnpStream(20022): Processing stream request failed - org.teleal.cling.protocol.ProtocolCreationException: Protocol for message type not found: (StreamRequestMessage) NOTIFY /upnp/device/526F6B75-536F-756E-6442-000D4B20056C/service/upnp-org/RenderingControl/subscription/cal)
09-05 10:29:47.255 W/dalvikvm(20022): threadid=17: thread exiting with uncaught exception (group=0x400259f8)
09-05 10:29:47.255 E/AndroidRuntime(20022): FATAL EXCEPTION: Thread 18 (Active: 8)
09-05 10:29:47.255 E/AndroidRuntime(20022): java.lang.NullPointerException
09-05 10:29:47.255 E/AndroidRuntime(20022): at org.teleal.cling.transport.spi.UpnpStream.responseSent(UpnpStream.java:81)
09-05 10:29:47.255 E/AndroidRuntime(20022): at org.teleal.cling.transport.impl.apache.HttpServerConnectionUpnpStream$UpnpHttpService.doService(HttpServerConnectionUpnpStream.java:247)
09-05 10:29:47.255 E/AndroidRuntime(20022): at org.apache.http.protocol.HttpService.handleRequest(HttpService.java:187)
09-05 10:29:47.255 E/AndroidRuntime(20022): at org.teleal.cling.transport.impl.apache.HttpServerConnectionUpnpStream.execute(HttpServerConnectionUpnpStream.java:114)
09-05 10:29:47.255 E/AndroidRuntime(20022): at org.teleal.cling.transport.spi.UpnpStream.run(UpnpStream.java:48)
09-05 10:29:47.255 E/AndroidRuntime(20022): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
09-05 10:29:47.255 E/AndroidRuntime(20022): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
09-05 10:29:47.255 E/AndroidRuntime(20022): at java.lang.Thread.run(Thread.java:1102)
09-05 10:29:47.265 W/ActivityManager(   98):   Force finishing activity cx.hoohol.silanoid/.Silanoid
09-05 10:29:47.275 V/ClingDevice(20022): subscription established
Reply | Threaded
Open this post in threaded view
|

Re: Service Subscription Problem

Christian Bauer
Administrator
The error you are getting is this:

09-05 10:29:47.225 W/UpnpStream(20022): Processing stream request failed - org.teleal.cling.protocol.ProtocolCreationException: Protocol for message type not found: (StreamRequestMessage) NOTIFY /upnp/device/526F6B75-536F-756E-6442-000D4B20056C/service/upnp-org/RenderingControl/subscription/cal)

(And then there is a NullPointer in the code, which I've just fixed.) What happens is that the service you are subscribing to tries to reply with a notification message, an actual event. It sends this event to this URI:

/upnp/device/526F6B75-536F-756E-6442-000D4B20056C/service/upnp-org/RenderingControl/subscription/cal

This is not the correct URI, it should be:

/upnp/device/526F6B75-536F-756E-6442-000D4B20056C/service/upnp-org/RenderingControl/subscription/callback.xml

It looks like the Roku Soundbridge cuts off the rest of the URI. Are you sure this is not a copy/paste problem?

(I'll look into the MimeType warnings, they are unrelated to the problem.)
Reply | Threaded
Open this post in threaded view
|

Re: Service Subscription Problem

bebopfreak
I did a simple copy and paste via mouse from emacs to the browser - no editing involved - the ')' at the end of the line should be an indicator.

I do know for sure that the Soundbridge has size restrictions concerning the lenght of item and container id's, so there might be other restrictions as well. I don't know, if there are any requirements in the UPnP standard that postulate minimum lengths for identifiers.

In the meantime I tested with XBMC, and it doesn't crash there.

Sometimes I get Action failures with a null response. What might be the reason?

A general question about UPnP and SOAP. Do you assume out arguments to be of the specified order?

getFirstIcon() returns byte[], is that raw pixmap data? Currently I seem to only get null pointers.
Reply | Threaded
Open this post in threaded view
|

Re: Service Subscription Problem

bebopfreak
That's from another crash:

09-05 13:37:32.055 W/UpnpStream(26607): Processing stream request failed - org.teleal.cling.protocol.ProtocolCreationException: Protocol for message type not found: (StreamRequestMessage) NOTIFY /upnp/device/526F6B75-536F-756E-6442-000D4B20056C/service/upnp-org/AVTransport/subscription/callback)
Reply | Threaded
Open this post in threaded view
|

Re: Service Subscription Problem

Christian Bauer
Administrator
In reply to this post by bebopfreak
bebopfreak wrote
I do know for sure that the Soundbridge has size restrictions concerning the lenght of item and container id's, so there might be other restrictions as well. I don't know, if there are any requirements in the UPnP standard that postulate minimum lengths for identifiers.
There are no limit/length considerations in the standard and that URI is not particularly long. I'd say this should be fixed in the Soundbridge, or at least the subscription should be denied instead of a callback to the wrong URI path.

I'm not sure what to do at this point. The callback path is customizable in Cling so you could shorten it. But it really affects all users, so maybe it should be shorter in general. Now, once we are going down that path, what happens if some other manufacturer thinks that 10 characters is enough for everyone. Do you know if the Soundbridge vendor is responsive and if users can update their devices with a new firmware?

bebopfreak wrote
Sometimes I get Action failures with a null response. What might be the reason?
If you mean ActionCallback.failure(ActionInvocation actionInvocation, UpnpResponse operation) with a null 'operation' argument, that is documented: "If the invocation was on a remote service, the response message, otherwise null"

bebopfreak wrote
A general question about UPnP and SOAP. Do you assume out arguments to be of the specified order?
Yes, the SOAP action response XML message and ordering of output arguments is standardized as follows: 'Every “out” argument in the definition of the action in the service description must be included, in the same order as specified in the service description (SCPD) available from the device.'

bebopfreak wrote
getFirstIcon() returns byte[], is that raw pixmap data? Currently I seem to only get null pointers.
This method is only applicable to LocalDevice with local icon data and my code is not using it. I'm going to remove it, it was just a convenient shortcut at some point. See DeviceListModel in the Workbench, this is how I retrieve icons. It's kind of up up to you, because you might want to use the native Android HTTP client operations instead.


Reply | Threaded
Open this post in threaded view
|

Re: Service Subscription Problem

Christian Bauer
Administrator
In reply to this post by bebopfreak
Well, clearly the Soundbridge cuts off the URI after 100 characters. It should not allow the subscription if it can't handle the callback URL.
Reply | Threaded
Open this post in threaded view
|

Re: Service Subscription Problem

Christian Bauer
Administrator
In reply to this post by Christian Bauer
I'm not sure what to do at this point. The callback path is customizable in Cling so you could shorten it. But it really affects all users, so maybe it should be shorter in general.
OK, so I've committed and updated the snapshot of today with a new Namespace that generates shorter paths. It's not much shorter but I hope that for all services of this Soundbridge we have now less than 100 characters in the callback path. I wonder what happens if you send two callback URLs within one subscription to the Soundbridge. Will it cut both paths after 100 characters? :)
Reply | Threaded
Open this post in threaded view
|

Re: Service Subscription Problem

bebopfreak
In reply to this post by Christian Bauer
Christian Bauer wrote
bebopfreak wrote
Sometimes I get Action failures with a null response. What might be the reason?
If you mean ActionCallback.failure(ActionInvocation actionInvocation, UpnpResponse operation) with a null 'operation' argument, that is documented: "If the invocation was on a remote service, the response message, otherwise null"
The invocation was on a remote service and the response message was null. Does this mean there was no response? What could be the reason? Currently I treat it as sort of "Unknown Error".

If I should go on using this library, I need to know about its primary goal:
If the primary goal is to test and validate everything to make sure it adheres to the standard, then together with a workbench it's certainly a perfect tool for developing devices.
But how should I deal with devices that are on the market, but aren't perfect?
I don't want to throw away my TV, just because it sometimes forgets to escape '&' in xml.
Reply | Threaded
Open this post in threaded view
|

Re: Service Subscription Problem

bebopfreak
In reply to this post by Christian Bauer
There won't be any more firmware updates for Soundbridges. The product cycle is finished! But products still exist.
Reply | Threaded
Open this post in threaded view
|

Re: Service Subscription Problem

bebopfreak
In reply to this post by Christian Bauer
Christian Bauer wrote
OK, so I've committed and updated the snapshot of today with a new Namespace that generates shorter paths. It's not much shorter but I hope that for all services of this Soundbridge we have now less than 100 characters in the callback path. I wonder what happens if you send two callback URLs within one subscription to the Soundbridge. Will it cut both paths after 100 characters? :)
Doesn't crash any more and events are received.
Reply | Threaded
Open this post in threaded view
|

Re: Service Subscription Problem

Christian Bauer
Administrator
In reply to this post by bebopfreak
bebopfreak wrote
The invocation was on a remote service and the response message was null. Does this mean there was no response? What could be the reason? Currently I treat it as sort of "Unknown Error".
Yes, no response within the configured timeout.

But how should I deal with devices that are on the market, but aren't perfect?
I don't want to throw away my TV, just because it sometimes forgets to escape '&' in xml.
There are very few standard compliant UPnP devices, most have bugs. That's why Cling is modular and extensible. The problem with your Soundbridge could have been solved with a different Namespace instance. So far I've been able to work around many problems without compromising Clings 99.999% compliance with the UPnP spec.

If in the future an important and widely used device is misbehaving in a way which requires modifications of Cling that break compliance, support for pluggable device profiles is probably needed. I'll cross that bridge when it happens...