a/libupnpp/soaphelp.cxx b/libupnpp/soaphelp.cxx
...
...
33
     <DesiredMute>False</DesiredMute>
33
     <DesiredMute>False</DesiredMute>
34
   </ns0:SetMute>
34
   </ns0:SetMute>
35
   
35
   
36
   As the top node name is qualified by a namespace, it's easier to just use 
36
   As the top node name is qualified by a namespace, it's easier to just use 
37
   action name passed in the libupnp action callback.
37
   action name passed in the libupnp action callback.
38
   
39
   This is used both for decoding action requests in the device and responses
40
   in the control point side
38
*/
41
*/
39
bool decodeSoapBody(const char *callnm, IXML_Document *actReq, 
42
bool decodeSoapBody(const char *callnm, IXML_Document *actReq, 
40
                    SoapDecodeOutput *res)
43
                    SoapDecodeOutput *res)
41
{
44
{
42
    bool ret = false;
45
    bool ret = false;
43
    IXML_NodeList* nl = 0;
46
    IXML_NodeList* nl = 0;
44
    IXML_Node* topNode = 
47
    IXML_Node* topNode = 
45
        ixmlNode_getFirstChild((IXML_Node *)actReq);
48
        ixmlNode_getFirstChild((IXML_Node *)actReq);
46
    if (topNode == 0) {
49
    if (topNode == 0) {
47
        cerr << "decodeSoap: Empty Action request (no topNode) ??" << endl;
50
        LOGERR("decodeSoap: Empty Action request (no topNode) ??" << endl);
48
        return false;
51
        return false;
49
    }
52
    }
50
    // cerr << "decodeSoap: top node name: " << ixmlNode_getNodeName(topNode) 
53
    //LOGDEB("decodeSoap: top node name: " << ixmlNode_getNodeName(topNode) 
51
    // << endl;
54
    //       << endl);
52
55
53
    nl = ixmlNode_getChildNodes(topNode);
56
    nl = ixmlNode_getChildNodes(topNode);
54
    if (nl == 0) {
57
    if (nl == 0) {
55
        // cerr << "decodeSoap: empty Action request (no childs)" << endl;
56
        // Ok actually, there are no args
58
        // Ok actually, there are no args
57
        return true;
59
        return true;
58
    }
60
    }
59
    // cerr << "decodeSoap: childnodes list length: " << ixmlNodeList_length(nl)
61
    //LOGDEB("decodeSoap: childnodes list length: " << ixmlNodeList_length(nl)
60
    // << endl;
62
    // << endl);
61
63
62
    for (unsigned long i = 0; i <  ixmlNodeList_length(nl); i++) {
64
    for (unsigned long i = 0; i <  ixmlNodeList_length(nl); i++) {
63
        IXML_Node *cld = ixmlNodeList_item(nl, i);
65
        IXML_Node *cld = ixmlNodeList_item(nl, i);
64
        if (cld == 0) {
66
        if (cld == 0) {
65
            // cerr << "decodeSoap: got null node  from nodelist at index " <<
67
            LOGDEB1("decodeSoap: got null node  from nodelist at index " <<
66
            // i << " ??" << endl;
68
                   i << " ??" << endl);
67
            // Seems to happen with empty arg list?? This looks like a bug, 
69
            // Seems to happen with empty arg list?? This looks like a bug, 
68
            // should we not get an empty node instead?
70
            // should we not get an empty node instead?
69
            if (i == 0) {
71
            if (i == 0) {
70
                ret = true;
72
                ret = true;
71
            }
73
            }
72
            goto out;
74
            goto out;
73
        }
75
        }
74
        const char *name = ixmlNode_getNodeName(cld);
76
        const char *name = ixmlNode_getNodeName(cld);
75
        if (cld == 0) {
77
        if (name == 0) {
76
            DOMString pnode = ixmlPrintNode(cld);
78
            DOMString pnode = ixmlPrintNode(cld);
77
            cerr << "decodeSoap: got null name ??:" << pnode << endl;
79
            LOGDEB("decodeSoap: got null name ??:" << pnode << endl);
78
            ixmlFreeDOMString(pnode);
80
            ixmlFreeDOMString(pnode);
79
            goto out;
81
            goto out;
80
        }
82
        }
81
        IXML_Node *txtnode = ixmlNode_getFirstChild(cld);
83
        IXML_Node *txtnode = ixmlNode_getFirstChild(cld);
82
        const char *value = "";
84
        const char *value = "";
...
...
116
}
118
}
117
119
118
bool SoapDecodeOutput::getString(const char *nm, string *value) const
120
bool SoapDecodeOutput::getString(const char *nm, string *value) const
119
{
121
{
120
    map<string, string>::const_iterator it = args.find(nm);
122
    map<string, string>::const_iterator it = args.find(nm);
121
    if (it == args.end() || it->second.empty()) {
123
    if (it == args.end()) {
122
        return false;
124
        return false;
123
    }
125
    }
124
    *value = it->second;
126
    *value = it->second;
125
    return true;
127
    return true;
126
}
128
}