I'm using Cling to do an NAT work but failed.
The modal of my router is TL-WR840N, made in China.
UpnpService service = new UpnpServiceImpl(listener);
cling-core-1.0.5 throws an exception, telling "Invalid URLBase".
I traced the networking packets and found the router response a null URLBase.
Affected files are org.teleal.cling.binding.xml.UDA10DeviceDescriptorBinderSAXImpl.java and UDA10DeviceDescriptorBinderImpl.java, where both commeted with "We hope it's RFC 2396 and RFC 2732 compliant".
I fixed it by adding a check:
String url = XMLUtil.getTextContent(rootChild);
if(url != null && ! url.trim().isEmpty())
Besides, many URI in the xml are padded with white-spaces(0x20) by the router.
So function parseURI in UDA10DeviceDescriptorBinderImpl.java might need to check this to avoid an exception.
What I did is adding:
uri = uri.trim();
to the first line of the function.
I have to say this shouldn't be trade as cling's bug. But it must be much better if cling is more compatible.