28 appendChild( createProcessingInstruction(
"xml-stylesheet",
29 R
"(type="text/xsl" href="/xslt/service.xslt")" ));
35 QString sTargetNamespace = "http://mythtv.org";
37 m_oRoot = createElementNS(
"http://schemas.xmlsoap.org/wsdl/",
"definitions");
39 m_oRoot.setAttribute(
"targetNamespace", sTargetNamespace );
41 m_oRoot.setAttribute(
"xmlns:soap",
"http://schemas.xmlsoap.org/wsdl/soap/" );
42 m_oRoot.setAttribute(
"xmlns:xs" ,
"http://www.w3.org/2001/XMLSchema" );
43 m_oRoot.setAttribute(
"xmlns:soap",
"http://schemas.xmlsoap.org/wsdl/soap/" );
44 m_oRoot.setAttribute(
"xmlns:tns" , sTargetNamespace );
45 m_oRoot.setAttribute(
"xmlns:wsaw",
"http://www.w3.org/2006/05/addressing/wsdl" );
47 m_oRoot.setAttribute(
"name", QString(
"%1Services" ).arg( sClassName ) );
65 QDomElement oImportNode = createElement(
"xs:schema" );
66 oImportNode.setAttribute(
"targetNamespace" ,
"http://MythTV.org/Imports" );
72 oNode = createElement(
"xs:schema" );
73 oNode.setAttribute(
"targetNamespace" , sTargetNamespace );
74 oNode.setAttribute(
"elementFormDefault",
"qualified" );
83 m_oBindings.setAttribute(
"name", QString(
"BasicHttpBinding_%1").arg( sClassName ));
84 m_oBindings.setAttribute(
"type", QString(
"tns:%1" ).arg( sClassName ));
86 oNode = createElement(
"soap:binding" );
88 oNode.setAttribute(
"transport",
"http://schemas.xmlsoap.org/soap/http" );
99 QString sRequestTypeName = oInfo.m_sName;
100 QString sResponseTypeName = oInfo.m_sName +
"Response";
102 QString sInputMsgName = QString(
"%1_%2_InputMessage" )
105 QString sOutputMsgName = QString(
"%1_%2_OutputMessage" )
113 QDomElement oOp = createElement(
"operation" );
115 oOp.setAttribute(
"name", oInfo.m_sName );
121 QString sDescription;
124 sDescription =
"POST ";
126 sDescription =
"GET ";
131 oNode = createElement(
"documentation" );
132 oNode.appendChild( createTextNode( sDescription ));
134 oOp.appendChild( oNode );
140 oNode = createElement(
"input" );
141 oNode.setAttribute(
"wsaw:Action", QString(
"%1/%2/%3" )
142 .arg( sTargetNamespace,
145 oNode.setAttribute(
"message" ,
"tns:" + sInputMsgName );
147 oOp.appendChild( oNode );
153 oNode = createElement(
"output" );
154 oNode.setAttribute(
"wsaw:Action", QString(
"%1/%2/%3Response" )
155 .arg( sTargetNamespace,
158 oNode.setAttribute(
"message",
"tns:" + sOutputMsgName );
160 oOp.appendChild( oNode );
168 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://" +
239 oPort.appendChild( oNode );
256 QMap<QString, TypeInfo>::const_iterator it2 =
m_typesToInclude.constBegin();
259 QDomElement oIncNode = createElement(
"xs:import" );
260 QString sType = it2.key();
263 sType.remove(
"DTC::" );
265 QString sValue = QString(
"%1?%2=%3" ).arg( sBaseUri,
269 if (!
info.sContentType.isEmpty())
270 sValue +=
"&name=" +
info.sContentType;
272 oIncNode.setAttribute(
"schemaLocation", sValue );
273 oIncNode.setAttribute(
"namespace" ,
"http://mythtv.org" );
275 oImportNode.appendChild( oIncNode );
298 const QString &sClassName)
304 QDomElement oOp = createElement(
"operation" );
306 oOp.setAttribute(
"name", oInfo.
m_sName );
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 (QString::compare( oInfo.
m_oMethod.typeName(),
"void", Qt::CaseInsensitive ) != 0)
331 oDirection = createElement(
"output" );
333 oNode = createElement(
"soap:body" );
334 oNode.setAttribute(
"use",
"literal" );
336 oDirection.appendChild( oNode );
337 oOp.appendChild( oDirection );
349 const QString& sTypeName )
351 QDomElement oMsg = createElement(
"message" );
353 oMsg.setAttribute(
"name", sMsgName );
355 QDomElement oNode = createElement(
"part" );
357 oNode.setAttribute(
"name" ,
"parameters" );
358 oNode.setAttribute(
"element",
"tns:" + sTypeName );
360 oMsg.appendChild( oNode );
373 QDomElement oElementNode = createElement(
"xs:element" );
375 oElementNode.setAttribute(
"name", sTypeName );
377 QDomElement oTypeNode = createElement(
"xs:complexType" );
378 QDomElement oSeqNode = createElement(
"xs:sequence" );
380 oElementNode.appendChild( oTypeNode );
381 oTypeNode .appendChild( oSeqNode );
389 QDomElement oNode = createElement(
"xs:element" );
391 QString sType = oInfo.
m_oMethod.typeName();
393 sTypeName.remove(
"Response" );
395 oNode.setAttribute(
"minOccurs", 0 );
396 oNode.setAttribute(
"name" , sTypeName +
"Result" );
397 oNode.setAttribute(
"nillable" ,
static_cast<int>(
true) );
403 QString sPrefix =
"xs:";
412 oNode.setAttribute(
"type", sPrefix + sType );
414 oSeqNode.appendChild( oNode );
418 QList<QByteArray> paramNames = oInfo.
m_oMethod.parameterNames();
419 QList<QByteArray> paramTypes = oInfo.
m_oMethod.parameterTypes();
421 for(
int nIdx = 0; nIdx < paramNames.length(); nIdx++ )
423 QString sName = paramNames[ nIdx ];
424 QString sParamType = paramTypes[ nIdx ];
430 QString sPrefix =
"xs:";
439 QDomElement oNode = createElement(
"xs:element" );
441 oNode.setAttribute(
"minOccurs", 0 );
442 oNode.setAttribute(
"name" , sName );
443 oNode.setAttribute(
"nillable" ,
static_cast<int>(
true) );
444 oNode.setAttribute(
"type" , sPrefix + sParamType );
446 oSeqNode.appendChild( oNode );
459#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
462 int id = QMetaType::fromName( sTypeName.toUtf8() ).id();
467 case QMetaType::QStringList:
468 case QMetaType::QVariantList:
469 case QMetaType::QVariantMap:
474 if (
id == qMetaTypeId<QFileInfo>())
479 return !(
id < QMetaType::User);
488 QString sCustomAttr =
"type";
493 if (sType.contains(
"::" ))
495 sType = sType.replace(
"::",
"." );
496 sCustomAttr =
"enum";
515 nIdx = pMeta->indexOfClassInfo( sKey.toUtf8().constData() );
518 return pMeta->classInfo( nIdx ).value();
HttpResponseType m_eResponseType
QString GetLastHeader(const QString &sType) const
const MetaInfoMap & GetMethods()
const QMetaObject & GetServiceMetaObject()
virtual QString GetServiceControlURL()
QString AddTypeInfo(QString sType)
QDomElement CreateMessage(const QString &sMsgName, const QString &sTypeName)
QMap< QString, TypeInfo > m_typesToInclude
bool GetWSDL(HTTPRequest *pRequest)
QDomElement CreateMethodType(const MethodInfo &oInfo, QString sTypeName, bool bReturnType=false)
static QString ReadClassInfo(const QMetaObject *pMeta, const QString &sKey)
static bool IsCustomType(const QString &sTypeName)
ServiceHost * m_pServiceHost
QDomElement CreateBindingOperation(const MethodInfo &oInfo, const QString &sClassName)
static QString ConvertTypeToXSD(const QString &sType, bool bCustomType=false)