From: konrad Date: Thu, 5 Aug 2010 20:42:03 +0000 (+0000) Subject: added SOAP out to project, actual WSDL still missing X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=81adb43c3afd018a050c1a7a09500f5d88456bda;p=web%2Fkonrad%2Fpack.git added SOAP out to project, actual WSDL still missing git-svn-id: https://silmor.de/svn/softmagic/pack/trunk@585 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/woc/proc/processor.cpp b/woc/proc/processor.cpp index b5b9a6a..4daa1da 100644 --- a/woc/proc/processor.cpp +++ b/woc/proc/processor.cpp @@ -16,6 +16,7 @@ #include "qtout.h" #include "htmlout.h" #include "schemaout.h" +#include "soapout.h" #include "domquery.h" @@ -180,6 +181,10 @@ bool WocProcessor::processFile(QString fn) new WocSchemaOut(el); if(m_error)return false; }else + if(tn=="SoapOutput"){ + new WocSoapOut(el); + if(m_error)return false; + }else if(tn=="Version"){ if(el.hasAttribute("comm")) m_verComm=el.attribute("comm"); diff --git a/woc/soap/soap.pri b/woc/soap/soap.pri index 379ddb6..080b0a2 100644 --- a/woc/soap/soap.pri +++ b/woc/soap/soap.pri @@ -1,9 +1,11 @@ RESOURCES += soap/schemafiles.qrc SOURCES += \ - soap/schemaout.cpp + soap/schemaout.cpp \ + soap/soapout.cpp HEADERS += \ - soap/schemaout.h + soap/schemaout.h \ + soap/soapout.h INCLUDEPATH += soap \ No newline at end of file diff --git a/woc/soap/soapout.cpp b/woc/soap/soapout.cpp index bb302eb..1aa845d 100644 --- a/woc/soap/soapout.cpp +++ b/woc/soap/soapout.cpp @@ -17,18 +17,25 @@ #include #include -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()); @@ -36,7 +43,7 @@ WocSchemaOut::WocSchemaOut(const QDomElement& el): WocOutput() m_root.setAttribute("elementFormDefault","qualified"); } -void WocSchemaOut::finalize() +void WocSoapOut::finalize() { //finish off m_doc.appendChild(m_root); @@ -46,7 +53,7 @@ void WocSchemaOut::finalize() 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 @@ -70,13 +77,11 @@ void WocSchemaOut::newTransaction(const WocTransaction& trn) 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"); @@ -95,13 +100,11 @@ void WocSchemaOut::newTransaction(const WocTransaction& trn) 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"); @@ -111,12 +114,12 @@ void WocSchemaOut::newTransaction(const WocTransaction& trn) 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*/ }