Help and Support
Ask a question, report a problem, request a feature...
<<  Back To Forum

Wrong order of elements in AddPortMapping upnp message

by Guest on 2021/11/02 12:31:29 AM    
I found that upnp on my router does not work. It seems Tixati sends upnp elements in wrong order, not as defined by my device specification.

Output of my router (excerpt from
AddPortMapping NewRemoteHost in RemoteHost NewExternalPort in ExternalPort NewProtocol in PortMappingProtocol NewInternalPort in InternalPort NewInternalClient in InternalClient NewEnabled in PortMappingEnabled NewPortMappingDescription in PortMappingDescription NewLeaseDuration in PortMappingLeaseDuration

What Tixati sends (from Tixati upnp log):
[00:16:00]  UPNP mapping UDP port 26676 on gateway - sending AddPortMapping to service WANIPConnection:1
[00:16:00]  UPNP mapping UDP port 26676 on gateway - sending POST command to
<s:Envelope xmlns:s="" s:encodingStyle="">
<u:AddPortMapping xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1">
[00:16:00]  UPNP mapping UDP port 26676 on gateway - got HTTP response code 500
[00:16:00]  UPNP mapping UDP port 26676 on gateway - got reply:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="" s:encodingStyle=""><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring>UPnPError</faultstring><detail><UPnPError xmlns="urn:schemas-upnp-org:control-1-0"><errorCode>402</errorCode><errorDescription>See UPnP Device Architecture section on Control.e:1</errorDescription></UPnPError></detail></s:Fault></s:Body></s:Envelope>
[00:16:00]  UPNP mapping UDP port 26676 on gateway - command failed with error 402 See UPnP Device Architecture section on Control.e:1

If I send it manually as:

Then it is succesful:
<?xml version="1.0" encoding="utf-8"?>

From Upnp spec, it seems this has changed in version 2.0:

2.5.4 Ordering of Elements
The  order  of  XML  elements  in  device  and  service  description  documents  shall  adhere  to  the  
order  as  defined  in  the  corresponding  specification  as  defined  by  the  working  committee  for  
that  device  or  service  type.  Furthermore,  the  order  of  elements  (e.g.  arguments)  in  control  
messages  and  in  their  responses  shall  adhere  to  the  order  defined  in  the  device’s  service  
description document.
Note:  UPnP  1.0  does  NOT  REQUIRE  that  the  order  of  XML  elements  in  device  and  service  
description  documents  adheres  to  the  order  as  defined  in  the  corresponding  schema  (as  
defined by the working committee) for that device or service type.  However, it does
REQUIRE  that  control  messages  and  responses  are  ordered  according  to  the  corresponding  
device’s  service  description,  a  REQUIREMENT  that  is  sometimes  overlooked.  Therefore,  
when  receiving  messages  from  UPnP  1.0  services,  control  points  should  be  able  to  process  
out-of-order  elements;  and  when  transmitting  messages  to  UPnP  1.0  services,  control  points  
shall send elements in the order defined by that particular device’s service description.

Tixati v.2.86.

Thanks for looking into it.
by KH on 2021/11/04 04:49:56 AM    
Thanks a ton for catching this one and taking the time to make this detailed post.

This will be corrected in the next release, 2.87.
by Guest on 2021/11/05 11:58:56 PM    
Thank you so much.
by KH on 2021/12/10 07:32:18 AM    
Thanks again for this report.

We released 2.87 today, should be all fixed up now.
by Guest on 2021/12/13 10:10:48 PM    
It works well now. Thank you :-)

This web site is powered by Super Simple Server