32 if (!
Request->m_queries.contains(
"raw"))
34 appendChild( createProcessingInstruction(
"xml-stylesheet",
35 R
"(type="text/xsl" href="/xslt/service.xslt")" ));
41 QString sTargetNamespace = "http://mythtv.org";
43 m_oRoot = createElementNS(
"http://schemas.xmlsoap.org/wsdl/",
"definitions");
45 m_oRoot.setAttribute(
"targetNamespace", sTargetNamespace );
47 m_oRoot.setAttribute(
"xmlns:soap",
"http://schemas.xmlsoap.org/wsdl/soap/" );
48 m_oRoot.setAttribute(
"xmlns:xs" ,
"http://www.w3.org/2001/XMLSchema" );
49 m_oRoot.setAttribute(
"xmlns:soap",
"http://schemas.xmlsoap.org/wsdl/soap/" );
50 m_oRoot.setAttribute(
"xmlns:tns" , sTargetNamespace );
51 m_oRoot.setAttribute(
"xmlns:wsaw",
"http://www.w3.org/2006/05/addressing/wsdl" );
53 m_oRoot.setAttribute(
"name", QString(
"%1Services" ).arg( sClassName ) );
71 QDomElement oImportNode = createElement(
"xs:schema" );
72 oImportNode.setAttribute(
"targetNamespace" ,
"http://MythTV.org/Imports" );
78 oNode = createElement(
"xs:schema" );
79 oNode.setAttribute(
"targetNamespace" , sTargetNamespace );
80 oNode.setAttribute(
"elementFormDefault",
"qualified" );
89 m_oBindings.setAttribute(
"name", QString(
"BasicHttpBinding_%1").arg( sClassName ));
90 m_oBindings.setAttribute(
"type", QString(
"tns:%1" ).arg( sClassName ));
92 oNode = createElement(
"soap:binding" );
93 oNode.setAttribute(
"transport",
"http://schemas.xmlsoap.org/soap/http" );
103 QString sRequestTypeName = path;
104 QString sResponseTypeName = path +
"Response";
106 QString sInputMsgName = QString(
"%1_%2_InputMessage" )
109 QString sOutputMsgName = QString(
"%1_%2_OutputMessage" )
117 QDomElement oOp = createElement(
"operation" );
119 oOp.setAttribute(
"name", path );
125 QString sDescription;
127 if (handler->m_requestTypes &
HTTPGet)
128 sDescription =
"GET ";
130 sDescription =
"POST ";
132 oNode = createElement(
"documentation" );
133 oNode.appendChild( createTextNode( sDescription ));
135 oOp.appendChild( oNode );
141 oNode = createElement(
"input" );
142 oNode.setAttribute(
"wsaw:Action", QString(
"%1/%2/%3" )
143 .arg( sTargetNamespace,
146 oNode.setAttribute(
"message" ,
"tns:" + sInputMsgName );
148 oOp.appendChild( oNode );
154 oNode = createElement(
"output" );
155 oNode.setAttribute(
"wsaw:Action", QString(
"%1/%2/%3Response" )
156 .arg( sTargetNamespace,
159 oNode.setAttribute(
"message",
"tns:" + sOutputMsgName );
161 oOp.appendChild( oNode );
169 QDomElement oMsg =
CreateMessage( sInputMsgName, sRequestTypeName );
205 QString sServiceName = QString(
"%1Services" ).arg( sClassName );
207 m_oService.setAttribute(
"name", sServiceName );
213 QString sDescription =
"Interface Version " +
220 oNode = createElement(
"documentation" );
221 oNode.appendChild( createTextNode( sDescription ));
229 QDomElement oPort = createElement(
"port" );
231 oPort.setAttribute(
"name" , QString(
"BasicHttpBinding_%1" ).arg( sClassName ));
232 oPort.setAttribute(
"binding", QString(
"tns:BasicHttpBinding_%1").arg( sClassName ));
234 oNode = createElement(
"soap:address" );
235 oNode.setAttribute(
"location",
"http://" +
236 Request->m_headers->value(
"host") +
"/" +
238 oPort.appendChild( oNode );
254 QMap<QString, TypeInfo>::const_iterator it2 =
m_typesToInclude.constBegin();
257 QDomElement oIncNode = createElement(
"xs:import" );
258 QString sType = it2.key();
262 if (sType.startsWith(
"V2"))
266 QString sValue = QString(
"%1?%2=%3" ).arg( sBaseUri,
273 oIncNode.setAttribute(
"schemaLocation", sValue );
274 oIncNode.setAttribute(
"namespace" ,
"http://mythtv.org" );
276 oImportNode.appendChild( oIncNode );
298 const QString &sClassName)
304 QDomElement oOp = createElement(
"operation" );
306 oOp.setAttribute(
"name", path );
308 QDomElement oNode = createElement(
"soap:operation" );
309 oNode.setAttribute(
"soapAction", QString(
"http://mythtv.org/%1/%2" )
312 oNode.setAttribute(
"style" ,
"document" );
314 oOp.appendChild( oNode );
320 QDomElement oDirection = createElement(
"input" );
321 oNode = createElement(
"soap:body" );
322 oNode.setAttribute(
"use",
"literal" );
324 oDirection.appendChild( oNode );
325 oOp.appendChild( oDirection );
327 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
328 const char * typeName = QMetaType::typeName(handler->m_types[0]);
330 const char * typeName = QMetaType(handler->m_types[0]).name();
333 if (QString::compare(typeName,
"void", Qt::CaseInsensitive ) != 0)
337 oDirection = createElement(
"output" );
339 oNode = createElement(
"soap:body" );
340 oNode.setAttribute(
"use",
"literal" );
342 oDirection.appendChild( oNode );
343 oOp.appendChild( oDirection );
355 const QString& sTypeName )
357 QDomElement oMsg = createElement(
"message" );
359 oMsg.setAttribute(
"name", sMsgName );
361 QDomElement oNode = createElement(
"part" );
363 oNode.setAttribute(
"name" ,
"parameters" );
364 oNode.setAttribute(
"element",
"tns:" + sTypeName );
366 oMsg.appendChild( oNode );
379 QDomElement oElementNode = createElement(
"xs:element" );
381 oElementNode.setAttribute(
"name", sTypeName );
383 QDomElement oTypeNode = createElement(
"xs:complexType" );
384 QDomElement oSeqNode = createElement(
"xs:sequence" );
386 oElementNode.appendChild( oTypeNode );
387 oTypeNode .appendChild( oSeqNode );
395 QDomElement oNode = createElement(
"xs:element" );
398 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
399 const char * typeName = QMetaType::typeName(handler->m_types[0]);
401 const char * typeName = QMetaType(handler->m_types[0]).name();
404 QString sType(typeName);
409 sTypeName.remove(
"Response" );
411 oNode.setAttribute(
"minOccurs", 0 );
412 oNode.setAttribute(
"name" , sTypeName +
"Result" );
413 oNode.setAttribute(
"nillable" ,
static_cast<int>(
true) );
417 QString sPrefix =
"xs:";
419 if (sType.startsWith(
"V2"))
432 oNode.setAttribute(
"type", sPrefix + sType );
434 oSeqNode.appendChild( oNode );
439 size_t typecount = std::min(handler->m_types.size(),
static_cast<size_t>(100));
444 QList<QByteArray> paramNames;
445 QList<QByteArray> paramTypes;
446 for (count=1; count < typecount; count++)
448 auto name = handler->m_names[count];
449 paramNames.append(name.toUtf8());
450 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
451 const char * typeName = QMetaType::typeName(handler->m_types[count]);
453 const char * typeName = QMetaType(handler->m_types[count]).name();
455 paramTypes.append(QByteArray(typeName));
458 for(
int nIdx = 0; nIdx < paramNames.length(); nIdx++ )
460 QString sName = paramNames[ nIdx ];
461 QString sParamType = paramTypes[ nIdx ];
465 QString sPrefix =
"xs:";
474 QDomElement oNode = createElement(
"xs:element" );
476 oNode.setAttribute(
"minOccurs", 0 );
477 oNode.setAttribute(
"name" , sName );
478 oNode.setAttribute(
"nillable" ,
static_cast<int>(
true) );
479 oNode.setAttribute(
"type" , sPrefix + sParamType );
481 oSeqNode.appendChild( oNode );
494 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
497 int id = QMetaType::fromName( sTypeName.toUtf8() ).id();
502 case QMetaType::QStringList:
503 case QMetaType::QVariantList:
504 case QMetaType::QVariantMap:
509 if (
id == qMetaTypeId<QFileInfo>())
511 if (sTypeName ==
"std::chrono::seconds")
516 return !(
id < QMetaType::User);
525 QString sCustomAttr =
"type";
530 if (sType.contains(
"::" ))
532 sType = sType.replace(
"::",
"." );
533 sCustomAttr =
"enum";
536 TypeInfo info = { sCustomAttr, QString() };
552 nIdx = pMeta->indexOfClassInfo( sKey.toUtf8() );
555 return pMeta->classInfo( nIdx ).value();