added SOAP out to project, actual WSDL still missing
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Thu, 5 Aug 2010 20:42:03 +0000 (20:42 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Thu, 5 Aug 2010 20:42:03 +0000 (20:42 +0000)
git-svn-id: https://silmor.de/svn/softmagic/pack/trunk@585 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

woc/proc/processor.cpp
woc/soap/soap.pri
woc/soap/soapout.cpp

index b5b9a6a..4daa1da 100644 (file)
@@ -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");
index 379ddb6..080b0a2 100644 (file)
@@ -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
index bb302eb..1aa845d 100644 (file)
 #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());
@@ -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*/
 }