SOAP 1.1 classes
authorcantor <cantor@de75baf8-a10c-0410-a50a-987c0e22f00f>
Thu, 7 Sep 2006 03:50:47 +0000 (03:50 +0000)
committercantor <cantor@de75baf8-a10c-0410-a50a-987c0e22f00f>
Thu, 7 Sep 2006 03:50:47 +0000 (03:50 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-xmltooling/trunk@164 de75baf8-a10c-0410-a50a-987c0e22f00f

12 files changed:
.cdtproject
schemas/Makefile.am
schemas/catalog.xml.in
schemas/soap-envelope.xsd [new file with mode: 0644]
xmltooling/Makefile.am
xmltooling/XMLToolingConfig.cpp
xmltooling/soap/SOAP.h [new file with mode: 0644]
xmltooling/soap/impl/SOAPImpl.cpp [new file with mode: 0644]
xmltooling/soap/impl/SOAPSchemaValidators.cpp [new file with mode: 0644]
xmltooling/util/XMLConstants.cpp
xmltooling/util/XMLConstants.h
xmltooling/xmltooling.vcproj

index b9e02ab..aa129f2 100644 (file)
@@ -60,7 +60,7 @@
 <pathentry kind="mac" name="WIN32" path="" value=""/>\r
 <pathentry kind="out" path=""/>\r
 <pathentry kind="con" path="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"/>\r
-<pathentry excluding="util/|io/|impl/|validation/|signature/|signature/impl/|encryption/|encryption/impl/|security/|security/impl/" kind="src" path="xmltooling"/>\r
+<pathentry excluding="util/|io/|impl/|validation/|signature/|signature/impl/|encryption/|encryption/impl/|security/|security/impl/|soap/|soap/impl/" kind="src" path="xmltooling"/>\r
 <pathentry kind="src" path="xmltooling/util"/>\r
 <pathentry kind="src" path="xmltooling/io"/>\r
 <pathentry kind="src" path="xmltooling/impl"/>\r
@@ -72,6 +72,8 @@
 <pathentry kind="src" path="xmltooling/encryption/impl"/>\r
 <pathentry excluding="impl/" kind="src" path="xmltooling/security"/>\r
 <pathentry kind="src" path="xmltooling/security/impl"/>\r
+<pathentry excluding="impl/" kind="src" path="xmltooling/soap"/>\r
+<pathentry kind="src" path="xmltooling/soap/impl"/>\r
 </item>\r
 </data>\r
 </cdtproject>\r
index d399785..79beb9f 100644 (file)
@@ -28,8 +28,9 @@ CLEANFILES = catalog.xml
 
 EXTRA_DIST = \
     catalog.xml.in \
+    soap-envelope.xsd \
     xenc-schema.xsd \
     xmldsig-core-schema.xsd \
     xml.xsd \
     xmltooling.xsd
-
+    
\ No newline at end of file
index 2521ae0..e140e05 100644 (file)
@@ -5,4 +5,5 @@
     <uri name="http://www.w3.org/2001/04/xmlenc#" uri="@-PKGXMLDIR-@/xenc-schema.xsd"/>
     <uri name="http://www.w3.org/2000/09/xmldsig#" uri="@-PKGXMLDIR-@/xmldsig-core-schema.xsd"/>
     <uri name="http://www.opensaml.org/xmltooling" uri="@-PKGXMLDIR-@/xmltooling.xsd"/>
+    <uri name="http://schemas.xmlsoap.org/soap/envelope/" uri="@-PKGXMLDIR-@/soap-envelope.xsd"/>
 </catalog>
diff --git a/schemas/soap-envelope.xsd b/schemas/soap-envelope.xsd
new file mode 100644 (file)
index 0000000..224e815
--- /dev/null
@@ -0,0 +1,120 @@
+<?xml version='1.0' encoding='UTF-8' ?>\r
+\r
+<!-- Schema for the SOAP/1.1 envelope\r
+\r
+     This schema has been produced using W3C's SOAP Version 1.2 schema\r
+     found at:\r
+\r
+     http://www.w3.org/2001/06/soap-envelope\r
+\r
+     Copyright 2001 Martin Gudgin, Developmentor.\r
+\r
+     Changes made are the following:\r
+     - reverted namespace to http://schemas.xmlsoap.org/soap/envelope/\r
+     - reverted mustUnderstand to only allow 0 and 1 as lexical values\r
+        - made encodingStyle a global attribute 20020825\r
+\r
+        Further changes:\r
+\r
+        - removed default value from mustUnderstand attribute declaration - 20030314\r
+\r
+     Original copyright:\r
+     \r
+     Copyright 2001 W3C (Massachusetts Institute of Technology,\r
+     Institut National de Recherche en Informatique et en Automatique,\r
+     Keio University). All Rights Reserved.\r
+     http://www.w3.org/Consortium/Legal/\r
+\r
+     This document is governed by the W3C Software License [1] as\r
+     described in the FAQ [2].\r
+\r
+     [1] http://www.w3.org/Consortium/Legal/copyright-software-19980720\r
+     [2] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD\r
+-->\r
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"\r
+           xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/"\r
+           targetNamespace="http://schemas.xmlsoap.org/soap/envelope/" >\r
+\r
+     \r
+  <!-- Envelope, header and body -->\r
+  <xs:element name="Envelope" type="tns:Envelope" />\r
+  <xs:complexType name="Envelope" >\r
+    <xs:sequence>\r
+      <xs:element ref="tns:Header" minOccurs="0" />\r
+      <xs:element ref="tns:Body" minOccurs="1" />\r
+      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax" />\r
+    </xs:sequence>\r
+    <xs:anyAttribute namespace="##any" processContents="lax" />\r
+  </xs:complexType>\r
+\r
+  <xs:element name="Header" type="tns:Header" />\r
+  <xs:complexType name="Header" >\r
+    <xs:sequence>\r
+      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax" />\r
+    </xs:sequence>\r
+    <xs:anyAttribute namespace="##any" processContents="lax" />\r
+  </xs:complexType>\r
+  \r
+  <xs:element name="Body" type="tns:Body" />\r
+  <xs:complexType name="Body" >\r
+    <xs:sequence>\r
+      <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" />\r
+    </xs:sequence>\r
+    <xs:anyAttribute namespace="##any" processContents="lax" >\r
+         <xs:annotation>\r
+           <xs:documentation>\r
+                 Prose in the spec does not specify that attributes are allowed on the Body element\r
+               </xs:documentation>\r
+         </xs:annotation>\r
+       </xs:anyAttribute>\r
+  </xs:complexType>\r
+\r
+       \r
+  <!-- Global Attributes.  The following attributes are intended to be usable via qualified attribute names on any complex type referencing them.  -->\r
+  <xs:attribute name="mustUnderstand" >        \r
+     <xs:simpleType>\r
+     <xs:restriction base='xs:boolean'>\r
+          <xs:pattern value='0|1' />\r
+        </xs:restriction>\r
+   </xs:simpleType>\r
+  </xs:attribute>\r
+  <xs:attribute name="actor" type="xs:anyURI" />\r
+\r
+  <xs:simpleType name="encodingStyle" >\r
+    <xs:annotation>\r
+         <xs:documentation>\r
+           'encodingStyle' indicates any canonicalization conventions followed in the contents of the containing element.  For example, the value 'http://schemas.xmlsoap.org/soap/encoding/' indicates the pattern described in SOAP specification\r
+         </xs:documentation>\r
+       </xs:annotation>\r
+    <xs:list itemType="xs:anyURI" />\r
+  </xs:simpleType>\r
+\r
+  <xs:attribute name="encodingStyle" type="tns:encodingStyle" />\r
+  <xs:attributeGroup name="encodingStyle" >\r
+    <xs:attribute ref="tns:encodingStyle" />\r
+  </xs:attributeGroup>\r
+\r
+  <xs:element name="Fault" type="tns:Fault" />\r
+  <xs:complexType name="Fault" final="extension" >\r
+    <xs:annotation>\r
+         <xs:documentation>\r
+           Fault reporting structure\r
+         </xs:documentation>\r
+       </xs:annotation>\r
+    <xs:sequence>\r
+      <xs:element name="faultcode" type="xs:QName" />\r
+      <xs:element name="faultstring" type="xs:string" />\r
+      <xs:element name="faultactor" type="xs:anyURI" minOccurs="0" />\r
+      <xs:element name="detail" type="tns:detail" minOccurs="0" />      \r
+    </xs:sequence>\r
+  </xs:complexType>\r
+\r
+  <xs:complexType name="detail">\r
+    <xs:sequence>\r
+      <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" />\r
+    </xs:sequence>\r
+    <xs:anyAttribute namespace="##any" processContents="lax" /> \r
+  </xs:complexType>\r
+\r
+</xs:schema>\r
+\r
index 07b843e..7aeccb8 100644 (file)
@@ -72,6 +72,9 @@ siginclude_HEADERS = \
        signature/Signature.h \
        signature/SignatureValidator.h
 
+soapinclude_HEADERS = \
+       soap/SOAP.h
+
 utilinclude_HEADERS = \
        util/DateTime.h \
        util/NDC.h \
@@ -132,6 +135,8 @@ libxmltooling_la_SOURCES = \
        io/AbstractXMLObjectUnmarshaller.cpp \
        signature/impl/KeyInfoImpl.cpp \
        signature/impl/KeyInfoSchemaValidators.cpp \
+       soap/impl/SOAPImpl.cpp \
+       soap/impl/SOAPSchemaValidators.cpp \
        util/DateTime.cpp \
        util/NDC.cpp \
        util/ParserPool.cpp \
index ce58432..9477479 100644 (file)
@@ -28,6 +28,7 @@
 #include "security/TrustEngine.h"
 #include "security/OpenSSLCryptoX509CRL.h"
 #include "signature/CredentialResolver.h"
+#include "soap/SOAP.h"
 #include "util/NDC.h"
 #include "util/XMLConstants.h"
 #include "validation/Validator.h"
@@ -46,6 +47,7 @@
     #include <openssl/err.h>
 #endif
 
+using namespace soap11;
 using namespace xmlencryption;
 using namespace xmlsignature;
 using namespace xmltooling;
@@ -165,6 +167,7 @@ bool XMLToolingInternalConfig::init()
 
         registerKeyInfoClasses();
         registerEncryptionClasses();
+        registerSOAPClasses();
         
         REGISTER_EXCEPTION_FACTORY(XMLParserException,xmltooling);
         REGISTER_EXCEPTION_FACTORY(XMLObjectException,xmltooling);
diff --git a/xmltooling/soap/SOAP.h b/xmltooling/soap/SOAP.h
new file mode 100644 (file)
index 0000000..8baa83e
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ *  Copyright 2001-2006 Internet2
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file SOAP.h
+ * 
+ * XMLObjects representing SOAP content
+ */
+
+#ifndef __xmltooling_soap_h__
+#define __xmltooling_soap_h__
+
+#include <xmltooling/AttributeExtensibleXMLObject.h>
+#include <xmltooling/ElementProxy.h>
+#include <xmltooling/SimpleElement.h>
+#include <xmltooling/XMLObjectBuilder.h>
+#include <xmltooling/util/XMLConstants.h>
+#include <xmltooling/validation/ValidatorSuite.h>
+#include <xercesc/util/XMLUniDefs.hpp>
+
+#define DECL_SOAP11OBJECTBUILDER(cname) \
+    DECL_XMLOBJECTBUILDER(XMLTOOL_API,cname,xmltooling::XMLConstants::SOAP11ENV_NS,xmltooling::XMLConstants::SOAP11ENV_PREFIX)
+
+/**
+ * @namespace soap11
+ * Namespace for SOAP 1.1 schema objects
+ */
+namespace soap11 {
+
+    DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,Faultstring,String,SOAP 1.1 faultstring element);
+    DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,Faultactor,Actor,SOAP 1.1 faultactor element);
+
+    BEGIN_XMLOBJECT(XMLTOOL_API,Faultcode,xmltooling::XMLObject,SOAP 1.1 faultcode element);
+        /** Gets the QName content of the element. */
+        virtual xmltooling::QName* getCode() const=0;
+        /** Sets the QName content of the element. */
+        virtual void setCode(const xmltooling::QName* qname)=0;
+    END_XMLOBJECT;
+
+    BEGIN_XMLOBJECT2(XMLTOOL_API,Detail,xmltooling::ElementProxy,xmltooling::AttributeExtensibleXMLObject,SOAP 1.1 detail element);
+        /** detail (type) local name */
+        static const XMLCh TYPE_NAME[];
+    END_XMLOBJECT;
+
+    BEGIN_XMLOBJECT(XMLTOOL_API,Fault,xmltooling::XMLObject,SOAP 1.1 Fault element);
+        DECL_TYPED_CHILD(Faultcode);
+        DECL_TYPED_CHILD(Faultstring);
+        DECL_TYPED_CHILD(Faultactor);
+        DECL_TYPED_CHILD(Detail);
+        /** Fault (type) local name */
+        static const XMLCh TYPE_NAME[];
+    END_XMLOBJECT;
+
+    BEGIN_XMLOBJECT2(XMLTOOL_API,Body,xmltooling::ElementProxy,xmltooling::AttributeExtensibleXMLObject,SOAP 1.1 Body element);
+        DECL_STRING_ATTRIB(EncodingStyle,ENCODINGSTYLE);
+        /** Body (type) local name */
+        static const XMLCh TYPE_NAME[];
+    END_XMLOBJECT;
+
+    BEGIN_XMLOBJECT2(XMLTOOL_API,Header,xmltooling::ElementProxy,xmltooling::AttributeExtensibleXMLObject,SOAP 1.1 Header element);
+        DECL_BOOLEAN_ATTRIB(MustUnderstand,MUSTUNDERSTAND,false);
+        DECL_STRING_ATTRIB(Actor,ACTOR);
+        /** Header (type) local name */
+        static const XMLCh TYPE_NAME[];
+    END_XMLOBJECT;
+
+    BEGIN_XMLOBJECT(XMLTOOL_API,Envelope,xmltooling::AttributeExtensibleXMLObject,SOAP 1.1 Envelope element);
+        DECL_TYPED_CHILD(Header);
+        DECL_TYPED_CHILD(Body);
+        /** Envelope (type) local name */
+        static const XMLCh TYPE_NAME[];
+    END_XMLOBJECT;
+
+    DECL_SOAP11OBJECTBUILDER(Body);
+    DECL_SOAP11OBJECTBUILDER(Detail);
+    DECL_SOAP11OBJECTBUILDER(Envelope);
+    DECL_SOAP11OBJECTBUILDER(Fault);
+    DECL_SOAP11OBJECTBUILDER(Faultactor);
+    DECL_SOAP11OBJECTBUILDER(Faultcode);
+    DECL_SOAP11OBJECTBUILDER(Faultstring);
+    DECL_SOAP11OBJECTBUILDER(Header);
+
+    /**
+     * Registers builders and validators for SOAP 1.1 classes into the runtime.
+     */
+    void XMLTOOL_API registerSOAPClasses();
+
+    /**
+     * Validator suite for SOAP 1.1 schema validation.
+     */
+    extern XMLTOOL_API xmltooling::ValidatorSuite SOAPSchemaValidators;
+};
+
+#endif /* __xmltooling_soap_h__ */
diff --git a/xmltooling/soap/impl/SOAPImpl.cpp b/xmltooling/soap/impl/SOAPImpl.cpp
new file mode 100644 (file)
index 0000000..1f4ec07
--- /dev/null
@@ -0,0 +1,447 @@
+/*
+ *  Copyright 2001-2006 Internet2
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * SOAPImpl.cpp
+ * 
+ * Implementation classes for SOAP schema
+ */
+
+#include "internal.h"
+#include "AbstractAttributeExtensibleXMLObject.h"
+#include "AbstractChildlessElement.h"
+#include "AbstractElementProxy.h"
+#include "exceptions.h"
+#include "io/AbstractXMLObjectMarshaller.h"
+#include "io/AbstractXMLObjectUnmarshaller.h"
+#include "soap/SOAP.h"
+#include "util/XMLHelper.h"
+
+#include <xercesc/util/XMLUniDefs.hpp>
+
+using namespace soap11;
+using namespace xmltooling;
+using namespace std;
+
+#if defined (_MSC_VER)
+    #pragma warning( push )
+    #pragma warning( disable : 4250 4251 )
+#endif
+
+namespace {
+
+    DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,Faultstring);
+    DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,Faultactor);
+
+    class XMLTOOL_DLLLOCAL FaultcodeImpl : public virtual Faultcode,
+        protected AbstractSimpleElement,
+        public AbstractChildlessElement,
+        public AbstractDOMCachingXMLObject,
+        public AbstractXMLObjectMarshaller,
+        public AbstractXMLObjectUnmarshaller
+    {
+        QName* m_qname;
+    public:
+        virtual ~FaultcodeImpl() {
+            delete m_qname;
+        }
+
+        FaultcodeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+            : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_qname(NULL) {
+        }
+            
+        FaultcodeImpl(const FaultcodeImpl& src)
+                : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src), m_qname(NULL) {
+            setCode(src.getCode());
+        }
+        
+        QName* getCode() const {
+            return m_qname;
+        }
+        
+        void setCode(const QName* qname) {
+            m_qname=prepareForAssignment(m_qname,qname);
+            if (m_qname) {
+                auto_ptr_XMLCh temp(m_qname->toString().c_str());
+                setTextContent(temp.get());
+            }
+            else
+                setTextContent(NULL);
+        }
+        
+        IMPL_XMLOBJECT_CLONE(Faultcode);
+        IMPL_XMLOBJECT_CONTENT;
+    };
+
+    class XMLTOOL_DLLLOCAL DetailImpl : public virtual Detail,
+        public AbstractElementProxy,
+        public AbstractAttributeExtensibleXMLObject,
+        public AbstractDOMCachingXMLObject,
+        public AbstractXMLObjectMarshaller,
+        public AbstractXMLObjectUnmarshaller
+    {
+    public:
+        virtual ~DetailImpl() {}
+
+        DetailImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+            : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+        }
+            
+        DetailImpl(const DetailImpl& src)
+                : AbstractXMLObject(src),
+                    AbstractElementProxy(src),
+                    AbstractAttributeExtensibleXMLObject(src),
+                    AbstractDOMCachingXMLObject(src) {
+            for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+                if (*i) {
+                    getXMLObjects().push_back((*i)->clone());
+                }
+            }
+        }
+        
+        IMPL_XMLOBJECT_CLONE(Detail);
+
+    protected:
+        void marshallAttributes(DOMElement* domElement) const {
+            // Take care of wildcard.
+            for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
+                DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
+                if (i->first.hasPrefix())
+                    attr->setPrefix(i->first.getPrefix());
+                attr->setNodeValue(i->second);
+                domElement->setAttributeNode(attr);
+            }
+        }
+
+        void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+            getXMLObjects().push_back(childXMLObject);
+        }
+
+        void processAttribute(const DOMAttr* attribute) {
+            QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
+            setAttribute(q,attribute->getNodeValue());
+        }
+    };
+
+    class XMLTOOL_DLLLOCAL FaultImpl : public virtual Fault,
+        public AbstractComplexElement,
+        public AbstractDOMCachingXMLObject,
+        public AbstractXMLObjectMarshaller,
+        public AbstractXMLObjectUnmarshaller
+    {
+        void init() {
+            m_Faultcode=NULL;
+            m_Faultstring=NULL;
+            m_Faultactor=NULL;
+            m_Detail=NULL;
+            m_children.push_back(NULL);
+            m_children.push_back(NULL);
+            m_children.push_back(NULL);
+            m_children.push_back(NULL);
+            m_pos_Faultcode=m_children.begin();
+            m_pos_Faultstring=m_pos_Faultcode;
+            ++m_pos_Faultstring;
+            m_pos_Faultactor=m_pos_Faultstring;
+            ++m_pos_Faultactor;
+            m_pos_Detail=m_pos_Faultactor;
+            ++m_pos_Detail;
+        }
+    protected:
+        FaultImpl() {
+            init();
+        }
+        
+    public:
+        virtual ~FaultImpl() {}
+
+        FaultImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+            init();
+        }
+            
+        FaultImpl(const FaultImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
+            init();
+            if (src.getFaultcode())
+                setFaultcode(src.getFaultcode()->cloneFaultcode());
+            if (src.getFaultstring())
+                setFaultstring(src.getFaultstring()->cloneFaultstring());
+            if (src.getFaultactor())
+                setFaultactor(src.getFaultactor()->cloneFaultactor());
+            if (src.getDetail())
+                setDetail(src.getDetail()->cloneDetail());
+        }
+        
+        IMPL_XMLOBJECT_CLONE(Fault);
+        IMPL_TYPED_CHILD(Faultcode);
+        IMPL_TYPED_CHILD(Faultstring);
+        IMPL_TYPED_CHILD(Faultactor);
+        IMPL_TYPED_CHILD(Detail);
+
+    protected:
+        void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+            PROC_TYPED_CHILD(Faultcode,XMLConstants::SOAP11ENV_NS,false);
+            PROC_TYPED_CHILD(Faultstring,XMLConstants::SOAP11ENV_NS,false);
+            PROC_TYPED_CHILD(Faultactor,XMLConstants::SOAP11ENV_NS,false);
+            PROC_TYPED_CHILD(Detail,XMLConstants::SOAP11ENV_NS,false);
+            AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+        }
+    };
+
+    class XMLTOOL_DLLLOCAL BodyImpl : public virtual Body,
+        public AbstractElementProxy,
+        public AbstractAttributeExtensibleXMLObject,
+        public AbstractDOMCachingXMLObject,
+        public AbstractXMLObjectMarshaller,
+        public AbstractXMLObjectUnmarshaller
+    {
+        void init() {
+            m_EncodingStyle=NULL;
+        }
+    public:
+        virtual ~BodyImpl() {
+            XMLString::release(&m_EncodingStyle);
+        }
+
+        BodyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+            : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+            init();
+        }
+            
+        BodyImpl(const BodyImpl& src)
+                : AbstractXMLObject(src),
+                    AbstractElementProxy(src),
+                    AbstractAttributeExtensibleXMLObject(src),
+                    AbstractDOMCachingXMLObject(src) {
+            init();
+            setEncodingStyle(src.getEncodingStyle());
+            for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+                if (*i) {
+                    getXMLObjects().push_back((*i)->clone());
+                }
+            }
+        }
+        
+        IMPL_XMLOBJECT_CLONE(Body);
+        IMPL_STRING_ATTRIB(EncodingStyle);
+
+        void setAttribute(QName& qualifiedName, const XMLCh* value) {
+            if (qualifiedName.hasNamespaceURI() && XMLString::equals(qualifiedName.getNamespaceURI(),XMLConstants::SOAP11ENV_NS)) {
+                if (XMLString::equals(qualifiedName.getLocalPart(),ENCODINGSTYLE_ATTRIB_NAME)) {
+                    setEncodingStyle(value);
+                    return;
+                }
+            }
+            AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
+        }
+
+    protected:
+        void marshallAttributes(DOMElement* domElement) const {
+            MARSHALL_STRING_ATTRIB(EncodingStyle,ENCODINGSTYLE,XMLConstants::SOAP11ENV_NS);
+
+            // Take care of wildcard.
+            for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
+                DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
+                if (i->first.hasPrefix())
+                    attr->setPrefix(i->first.getPrefix());
+                attr->setNodeValue(i->second);
+                domElement->setAttributeNode(attr);
+            }
+        }
+
+        void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+            getXMLObjects().push_back(childXMLObject);
+        }
+
+        void processAttribute(const DOMAttr* attribute) {
+            QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
+            setAttribute(q,attribute->getNodeValue());
+        }
+    };
+
+    class XMLTOOL_DLLLOCAL HeaderImpl : public virtual Header,
+        public AbstractElementProxy,
+        public AbstractAttributeExtensibleXMLObject,
+        public AbstractDOMCachingXMLObject,
+        public AbstractXMLObjectMarshaller,
+        public AbstractXMLObjectUnmarshaller
+    {
+        void init() {
+            m_Actor=NULL;
+            m_MustUnderstand=XMLConstants::XML_BOOL_NULL;
+        }
+    public:
+        virtual ~HeaderImpl() {
+            XMLString::release(&m_Actor);
+        }
+
+        HeaderImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+            : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+            init();
+        }
+            
+        HeaderImpl(const HeaderImpl& src)
+                : AbstractXMLObject(src),
+                    AbstractElementProxy(src),
+                    AbstractAttributeExtensibleXMLObject(src),
+                    AbstractDOMCachingXMLObject(src) {
+            init();
+            setActor(src.getActor());
+            MustUnderstand(m_MustUnderstand);
+            for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+                if (*i) {
+                    getXMLObjects().push_back((*i)->clone());
+                }
+            }
+        }
+        
+        IMPL_XMLOBJECT_CLONE(Header);
+        IMPL_STRING_ATTRIB(Actor);
+        IMPL_BOOLEAN_ATTRIB(MustUnderstand);
+
+        void setAttribute(QName& qualifiedName, const XMLCh* value) {
+            if (qualifiedName.hasNamespaceURI() && XMLString::equals(qualifiedName.getNamespaceURI(),XMLConstants::SOAP11ENV_NS)) {
+                if (XMLString::equals(qualifiedName.getLocalPart(),MUSTUNDERSTAND_ATTRIB_NAME)) {
+                    setMustUnderstand(value);
+                    return;
+                }
+                else if (XMLString::equals(qualifiedName.getLocalPart(),ACTOR_ATTRIB_NAME)) {
+                    setActor(value);
+                    return;
+                }
+            }
+            AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
+        }
+
+    protected:
+        void marshallAttributes(DOMElement* domElement) const {
+            MARSHALL_STRING_ATTRIB(Actor,ACTOR,XMLConstants::SOAP11ENV_NS);
+            MARSHALL_BOOLEAN_ATTRIB(MustUnderstand,MUSTUNDERSTAND,XMLConstants::SOAP11ENV_NS);
+
+            // Take care of wildcard.
+            for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
+                DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
+                if (i->first.hasPrefix())
+                    attr->setPrefix(i->first.getPrefix());
+                attr->setNodeValue(i->second);
+                domElement->setAttributeNode(attr);
+            }
+        }
+
+        void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+            getXMLObjects().push_back(childXMLObject);
+        }
+
+        void processAttribute(const DOMAttr* attribute) {
+            QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
+            setAttribute(q,attribute->getNodeValue());
+        }
+    };
+
+    class XMLTOOL_DLLLOCAL EnvelopeImpl : public virtual Envelope,
+        public AbstractAttributeExtensibleXMLObject,
+        public AbstractComplexElement,
+        public AbstractDOMCachingXMLObject,
+        public AbstractXMLObjectMarshaller,
+        public AbstractXMLObjectUnmarshaller
+    {
+        void init() {
+            m_Header=NULL;
+            m_Body=NULL;
+            m_children.push_back(NULL);
+            m_children.push_back(NULL);
+            m_pos_Header=m_children.begin();
+            m_pos_Body=m_pos_Header;
+            ++m_pos_Body;
+        }
+    public:
+        virtual ~EnvelopeImpl() {}
+
+        EnvelopeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+            : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+            init();
+        }
+            
+        EnvelopeImpl(const EnvelopeImpl& src)
+                : AbstractXMLObject(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
+            init();
+            if (src.getHeader())
+                setHeader(src.getHeader()->cloneHeader());
+            if (src.getBody())
+                setBody(src.getBody()->cloneBody());
+        }
+        
+        IMPL_TYPED_CHILD(Header);
+        IMPL_TYPED_CHILD(Body);
+        IMPL_XMLOBJECT_CLONE(Envelope);
+
+    protected:
+        void marshallAttributes(DOMElement* domElement) const {
+            // Take care of wildcard.
+            for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
+                DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
+                if (i->first.hasPrefix())
+                    attr->setPrefix(i->first.getPrefix());
+                attr->setNodeValue(i->second);
+                domElement->setAttributeNode(attr);
+            }
+        }
+
+        void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+            PROC_TYPED_CHILD(Header,XMLConstants::SOAP11ENV_NS,false);
+            PROC_TYPED_CHILD(Body,XMLConstants::SOAP11ENV_NS,false);
+            AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+        }
+
+        void processAttribute(const DOMAttr* attribute) {
+            QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
+            setAttribute(q,attribute->getNodeValue());
+        }
+    };
+};
+
+#if defined (_MSC_VER)
+    #pragma warning( pop )
+#endif
+
+// Builder Implementations
+
+IMPL_XMLOBJECTBUILDER(Body);
+IMPL_XMLOBJECTBUILDER(Detail);
+IMPL_XMLOBJECTBUILDER(Envelope);
+IMPL_XMLOBJECTBUILDER(Fault);
+IMPL_XMLOBJECTBUILDER(Faultactor);
+IMPL_XMLOBJECTBUILDER(Faultcode);
+IMPL_XMLOBJECTBUILDER(Faultstring);
+IMPL_XMLOBJECTBUILDER(Header);
+
+// Unicode literals
+
+const XMLCh Body::LOCAL_NAME[] =                        UNICODE_LITERAL_4(B,o,d,y);
+const XMLCh Body::TYPE_NAME[] =                         UNICODE_LITERAL_4(B,o,d,y);
+const XMLCh Body::ENCODINGSTYLE_ATTRIB_NAME[] =         UNICODE_LITERAL_13(e,n,c,o,d,i,n,g,S,t,y,l,e);
+const XMLCh Detail::LOCAL_NAME[] =                      UNICODE_LITERAL_6(d,e,t,a,i,l);
+const XMLCh Detail::TYPE_NAME[] =                       UNICODE_LITERAL_6(d,e,t,a,i,l);
+const XMLCh Envelope::LOCAL_NAME[] =                    UNICODE_LITERAL_8(E,n,v,e,l,o,p,e);
+const XMLCh Envelope::TYPE_NAME[] =                     UNICODE_LITERAL_8(E,n,v,e,l,o,p,e);
+const XMLCh Fault::LOCAL_NAME[] =                       UNICODE_LITERAL_5(F,a,u,l,t);
+const XMLCh Fault::TYPE_NAME[] =                        UNICODE_LITERAL_5(F,a,u,l,t);
+const XMLCh Faultactor::LOCAL_NAME[] =                  UNICODE_LITERAL_10(F,a,u,l,t,a,c,t,o,r);
+const XMLCh Faultcode::LOCAL_NAME[] =                   UNICODE_LITERAL_9(F,a,u,l,t,c,o,d,e);
+const XMLCh Faultstring::LOCAL_NAME[] =                 UNICODE_LITERAL_11(F,a,u,l,t,s,t,r,i,n,g);
+const XMLCh Header::LOCAL_NAME[] =                      UNICODE_LITERAL_6(H,e,a,d,e,r);
+const XMLCh Header::TYPE_NAME[] =                       UNICODE_LITERAL_6(H,e,a,d,e,r);
+const XMLCh Header::ACTOR_ATTRIB_NAME[] =               UNICODE_LITERAL_5(a,c,t,o,r);
+const XMLCh Header::MUSTUNDERSTAND_ATTRIB_NAME[] =      UNICODE_LITERAL_14(m,u,s,t,U,n,d,e,r,s,t,a,n,d);
diff --git a/xmltooling/soap/impl/SOAPSchemaValidators.cpp b/xmltooling/soap/impl/SOAPSchemaValidators.cpp
new file mode 100644 (file)
index 0000000..bd4f71e
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+*  Copyright 2001-2006 Internet2
+ * 
+* Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * SOAPSchemaValidators.cpp
+ * 
+ * Schema validators for SOAP schema
+ */
+
+#include "internal.h"
+#include "exceptions.h"
+#include "soap/SOAP.h"
+
+using namespace soap11;
+using namespace xmltooling;
+using namespace std;
+
+namespace {
+
+    XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Faultstring);
+    XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Faultactor);
+
+    BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,Faultcode);
+        XMLOBJECTVALIDATOR_REQUIRE(Faultcode,Code);
+    END_XMLOBJECTVALIDATOR;
+    
+    BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,Fault);
+        XMLOBJECTVALIDATOR_REQUIRE(Fault,Faultcode);
+        XMLOBJECTVALIDATOR_REQUIRE(Fault,Faultstring);
+    END_XMLOBJECTVALIDATOR;
+
+    BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,Envelope);
+        XMLOBJECTVALIDATOR_REQUIRE(Envelope,Body);
+    END_XMLOBJECTVALIDATOR;
+    
+};
+
+#define REGISTER_ELEMENT(namespaceURI,cname) \
+    q=QName(namespaceURI,cname::LOCAL_NAME); \
+    XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
+    SOAPSchemaValidators.registerValidator(q,new cname##SchemaValidator())
+    
+#define REGISTER_TYPE(namespaceURI,cname) \
+    q=QName(namespaceURI,cname::TYPE_NAME); \
+    XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
+    SOAPSchemaValidators.registerValidator(q,new cname##SchemaValidator())
+
+#define REGISTER_ELEMENT_NOVAL(namespaceURI,cname) \
+    q=QName(namespaceURI,cname::LOCAL_NAME); \
+    XMLObjectBuilder::registerBuilder(q,new cname##Builder());
+    
+#define REGISTER_TYPE_NOVAL(namespaceURI,cname) \
+    q=QName(namespaceURI,cname::TYPE_NAME); \
+    XMLObjectBuilder::registerBuilder(q,new cname##Builder());
+
+ValidatorSuite soap11::SOAPSchemaValidators("SOAPSchemaValidators");
+
+void soap11::registerSOAPClasses()
+{
+    QName q;
+    REGISTER_ELEMENT_NOVAL(XMLConstants::SOAP11ENV_NS,Body);
+    REGISTER_ELEMENT_NOVAL(XMLConstants::SOAP11ENV_NS,Detail);
+    REGISTER_ELEMENT(XMLConstants::SOAP11ENV_NS,Envelope);
+    REGISTER_ELEMENT(XMLConstants::SOAP11ENV_NS,Fault);
+    REGISTER_ELEMENT(XMLConstants::SOAP11ENV_NS,Faultactor);
+    REGISTER_ELEMENT(XMLConstants::SOAP11ENV_NS,Faultcode);
+    REGISTER_ELEMENT(XMLConstants::SOAP11ENV_NS,Faultstring);
+    REGISTER_ELEMENT_NOVAL(XMLConstants::SOAP11ENV_NS,Header);
+    REGISTER_TYPE_NOVAL(XMLConstants::SOAP11ENV_NS,Body);
+    REGISTER_TYPE_NOVAL(XMLConstants::SOAP11ENV_NS,Detail);
+    REGISTER_TYPE(XMLConstants::SOAP11ENV_NS,Envelope);
+    REGISTER_TYPE(XMLConstants::SOAP11ENV_NS,Fault);
+    REGISTER_TYPE_NOVAL(XMLConstants::SOAP11ENV_NS,Header);
+}
index 847acb6..232c8d5 100644 (file)
@@ -82,6 +82,17 @@ const XMLCh XMLConstants::XMLENC_NS[] = // http://www.w3.org/2001/04/xmlenc#
 \r
 const XMLCh XMLConstants::XMLENC_PREFIX[] = { chLatin_x, chLatin_e, chLatin_n, chLatin_c, chNull };\r
 \r
+const XMLCh XMLConstants::SOAP11ENV_NS[] = // http://schemas.xmlsoap.org/soap/envelope/\r
+{ chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, chForwardSlash,\r
+  chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_s, chPeriod,\r
+      chLatin_x, chLatin_m, chLatin_l, chLatin_s, chLatin_o, chLatin_a, chLatin_p, chPeriod,\r
+      chLatin_o, chLatin_r, chLatin_g, chForwardSlash,\r
+  chLatin_s, chLatin_o, chLatin_a, chLatin_p, chForwardSlash,\r
+  chLatin_e, chLatin_n, chLatin_v, chLatin_e, chLatin_l, chLatin_o, chLatin_p, chLatin_e, chForwardSlash, chNull\r
+};\r
+\r
+const XMLCh XMLConstants::SOAP11ENV_PREFIX[] = UNICODE_LITERAL_1(S);\r
+\r
 const XMLCh XMLConstants::XMLTOOLING_NS[] = // http://www.opensaml.org/xmltooling\r
 { chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, chForwardSlash,\r
   chLatin_w, chLatin_w, chLatin_w, chPeriod,\r
index 028c4b3..355ec39 100644 (file)
@@ -68,6 +68,12 @@ namespace xmltooling {
         /**  XML Encryption QName prefix ("xenc") */\r
         static const XMLCh XMLENC_PREFIX[];\r
         \r
+        /**  SOAP 1.1 Envelope XML namespace ("http://schemas.xmlsoap.org/soap/envelope/") */\r
+        static const XMLCh SOAP11ENV_NS[]; \r
+\r
+        /**  SOAP 1.1 Envelope QName prefix ("S") */\r
+        static const XMLCh SOAP11ENV_PREFIX[];\r
+    \r
         /**  XML Tooling namespace ("http://www.opensaml.org/xmltooling") */\r
         static const XMLCh XMLTOOLING_NS[];\r
 \r
index 4e865e9..8fdc20e 100644 (file)
                                        </File>\r
                                </Filter>\r
                        </Filter>\r
+                       <Filter\r
+                               Name="soap"\r
+                               >\r
+                               <Filter\r
+                                       Name="impl"\r
+                                       >\r
+                                       <File\r
+                                               RelativePath=".\soap\impl\SOAPImpl.cpp"\r
+                                               >\r
+                                       </File>\r
+                                       <File\r
+                                               RelativePath=".\soap\impl\SOAPSchemaValidators.cpp"\r
+                                               >\r
+                                       </File>\r
+                               </Filter>\r
+                       </Filter>\r
                </Filter>\r
                <Filter\r
                        Name="Header Files"\r
                                        >\r
                                </File>\r
                        </Filter>\r
+                       <Filter\r
+                               Name="soap"\r
+                               >\r
+                               <File\r
+                                       RelativePath=".\soap\SOAP.h"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
                </Filter>\r
                <Filter\r
                        Name="Resource Files"\r