#include <QDebug>
#include <QDir>
-WocSchemaOut::WocSchemaOut(const QDomElement& el): WocOutput()
+WocSoapOut::WocSoapOut(const QDomElement& el): WocOutput()
{
WocProcessor*woc=WocProcessor::instance();
- m_name=el.attribute("filename");
+ //parse XML config
+ m_name=el.attribute("fileprefix");
m_dir=woc->baseDir()+"/"+el.attribute("sourceDir");
- initialize();
- if(el.hasAttribute("compound"))
- addStaticSchemas(el.attribute("compound"));
+ //sanity check
+ if(woc->messageEncoding()==WocProcessor::WobEncoding){
+ if(str2bool(el.attribute("noerror","false"))){
+ qDebug("Warning: SoapOutput generating WSDL file, while not in SOAP mode - the WSDL will not work with the generated code!");
+ }else{
+ qDebug("Error: SoapOutput active although the project is in Wob mode. Stopping.");
+ emit errorFound();
+ return;
+ }
+ }
//make sure directory exists
QDir().mkpath(m_dir);
//create document and root node
- WocProcessor*woc=WocProcessor::instance();
m_doc.appendChild(m_doc.createComment("Automatically generated WSDL file for project "+woc->projectName()+"\nDO NOT CHANGE THIS FILE DIRECTLY!"));
m_root=m_doc.createElementNS(woc->xmlSchemaNamespace(),"ws:wsdl");
m_root.setAttribute("targetNamespace",woc->xmlProjectNamespace());
m_root.setAttribute("elementFormDefault","qualified");
}
-void WocSchemaOut::finalize()
+void WocSoapOut::finalize()
{
//finish off
m_doc.appendChild(m_root);
fd.write(m_doc.toByteArray());
}
-void WocSchemaOut::newTransaction(const WocTransaction& trn)
+void WocSoapOut::newTransaction(const WocTransaction& trn)
{
m_root.appendChild(m_doc.createComment("Transaction "+trn.name()));
//create elements
if(trn.isAttributeType(tp)){
QDomElement at=m_doc.createElement("xs:attribute");
at.setAttribute("name",vars[i]);
- at.setAttribute("type",schemaType(tp));
at.setAttribute("use","optional");
tel.appendChild(at);
}else{
QDomElement el=m_doc.createElement("xs:element");
el.setAttribute("name",vars[i]);
- el.setAttribute("type",schemaType(tp));
el.setAttribute("minOccurs","0");
if(trn.isListType(tp))
el.setAttribute("maxOccurs","unbounded");
if(trn.isAttributeType(tp)){
QDomElement at=m_doc.createElement("xs:attribute");
at.setAttribute("name",vars[i]);
- at.setAttribute("type",schemaType(tp));
at.setAttribute("use","optional");
tel.appendChild(at);
}else{
QDomElement el=m_doc.createElement("xs:element");
el.setAttribute("name",vars[i]);
- el.setAttribute("type",schemaType(tp));
el.setAttribute("minOccurs","0");
if(trn.isListType(tp))
el.setAttribute("maxOccurs","unbounded");
m_root.appendChild(tel);
}
-void WocSchemaOut::newClass(const WocClass& cls)
+void WocSoapOut::newClass(const WocClass& )
{
/*classes are not reflected in the WSDL*/
}
-void WocSchemaOut::newTable(const WocTable& )
+void WocSoapOut::newTable(const WocTable& )
{
/*tables are not exposed to the network, hence no WSDL*/
}