File indexing completed on 2025-01-05 04:37:28

0001 /*
0002     SPDX-FileCopyrightText: 2005-2007 Joris Guisson <joris.guisson@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "soap.h"
0008 
0009 namespace bt
0010 {
0011 QString SOAP::createCommand(const QString &action, const QString &service)
0012 {
0013     QString comm = QString(
0014                        "<?xml version=\"1.0\"?>"
0015                        "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" "
0016                        "SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
0017                        "<SOAP-ENV:Body>"
0018                        "<m:%1 xmlns:m=\"%2\"/>"
0019                        "</SOAP-ENV:Body></SOAP-ENV:Envelope>")
0020                        .arg(action)
0021                        .arg(service);
0022 
0023     return comm;
0024 }
0025 
0026 QString SOAP::createCommand(const QString &action, const QString &service, const QList<Arg> &args)
0027 {
0028     QString comm = QString(
0029                        "<?xml version=\"1.0\"?>"
0030                        "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" "
0031                        "SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
0032                        "<SOAP-ENV:Body>"
0033                        "<m:%1 xmlns:m=\"%2\">")
0034                        .arg(action)
0035                        .arg(service);
0036 
0037     for (const Arg &a : args)
0038         comm += "<" + a.element + ">" + a.value + "</" + a.element + ">";
0039 
0040     comm += QString("</m:%1></SOAP-ENV:Body></SOAP-ENV:Envelope>").arg(action);
0041     return comm;
0042 }
0043 }