/*
- * Copyright 2001-2006 Internet2
+ * Copyright 2001-2010 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* SOAPImpl.cpp
*
- * Implementation classes for SOAP schema
+ * Implementation classes for SOAP 1.1 schema.
*/
#include "internal.h"
#include "AbstractAttributeExtensibleXMLObject.h"
-#include "AbstractChildlessElement.h"
-#include "AbstractElementProxy.h"
+#include "AbstractComplexElement.h"
+#include "AbstractSimpleElement.h"
#include "exceptions.h"
#include "io/AbstractXMLObjectMarshaller.h"
#include "io/AbstractXMLObjectUnmarshaller.h"
using namespace soap11;
using namespace xmltooling;
+using namespace xercesc;
using namespace std;
+using xmlconstants::SOAP11ENV_NS;
+using xmlconstants::SOAP11ENV_PREFIX;
#if defined (_MSC_VER)
#pragma warning( push )
DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,Faultactor);
class XMLTOOL_DLLLOCAL FaultcodeImpl : public virtual Faultcode,
- protected AbstractSimpleElement,
- public AbstractChildlessElement,
+ public AbstractSimpleElement,
public AbstractDOMCachingXMLObject,
public AbstractXMLObjectMarshaller,
public AbstractXMLObjectUnmarshaller
{
- QName* m_qname;
+ xmltooling::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 XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_qname(nullptr) {
}
FaultcodeImpl(const FaultcodeImpl& src)
- : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src), m_qname(NULL) {
+ : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src), m_qname(nullptr) {
setCode(src.getCode());
}
- QName* getCode() const {
+ const xmltooling::QName* getCode() const {
return m_qname;
}
- void setCode(const QName* qname) {
+ void setCode(const xmltooling::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);
+ setTextContent(nullptr);
}
IMPL_XMLOBJECT_CLONE(Faultcode);
- IMPL_XMLOBJECT_CONTENT;
};
class XMLTOOL_DLLLOCAL DetailImpl : public virtual Detail,
- public AbstractElementProxy,
public AbstractAttributeExtensibleXMLObject,
+ public AbstractComplexElement,
public AbstractDOMCachingXMLObject,
public AbstractXMLObjectMarshaller,
public AbstractXMLObjectUnmarshaller
public:
virtual ~DetailImpl() {}
- DetailImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ DetailImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
: AbstractXMLObject(nsURI, localName, prefix, schemaType) {
}
DetailImpl(const DetailImpl& src)
: AbstractXMLObject(src),
- AbstractElementProxy(src),
AbstractAttributeExtensibleXMLObject(src),
+ AbstractComplexElement(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());
- }
- }
+ VectorOf(XMLObject) v=getUnknownXMLObjects();
+ for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
+ v.push_back((*i)->clone());
}
IMPL_XMLOBJECT_CLONE(Detail);
+ IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject, m_children.end());
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);
- }
+ marshallExtensionAttributes(domElement);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- getXMLObjects().push_back(childXMLObject);
+ getUnknownXMLObjects().push_back(childXMLObject);
}
void processAttribute(const DOMAttr* attribute) {
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
};
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_Faultcode=nullptr;
+ m_Faultstring=nullptr;
+ m_Faultactor=nullptr;
+ m_Detail=nullptr;
+ m_children.push_back(nullptr);
+ m_children.push_back(nullptr);
+ m_children.push_back(nullptr);
+ m_children.push_back(nullptr);
m_pos_Faultcode=m_children.begin();
m_pos_Faultstring=m_pos_Faultcode;
++m_pos_Faultstring;
public:
virtual ~FaultImpl() {}
- FaultImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ FaultImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
: AbstractXMLObject(nsURI, localName, prefix, schemaType) {
init();
}
- FaultImpl(const FaultImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
+ FaultImpl(const FaultImpl& src)
+ : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
if (src.getFaultcode())
setFaultcode(src.getFaultcode()->cloneFaultcode());
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);
+ PROC_TYPED_CHILD(Faultcode,nullptr,false);
+ PROC_TYPED_CHILD(Faultstring,nullptr,false);
+ PROC_TYPED_CHILD(Faultactor,nullptr,false);
+ PROC_TYPED_CHILD(Detail,nullptr,false);
AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
}
};
class XMLTOOL_DLLLOCAL BodyImpl : public virtual Body,
- public AbstractElementProxy,
public AbstractAttributeExtensibleXMLObject,
+ public AbstractComplexElement,
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)
+ BodyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
: AbstractXMLObject(nsURI, localName, prefix, schemaType) {
- init();
}
BodyImpl(const BodyImpl& src)
: AbstractXMLObject(src),
- AbstractElementProxy(src),
AbstractAttributeExtensibleXMLObject(src),
+ AbstractComplexElement(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());
- }
- }
+ VectorOf(XMLObject) v=getUnknownXMLObjects();
+ for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
+ v.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);
- }
+ IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject, m_children.end());
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);
- }
+ marshallExtensionAttributes(domElement);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- getXMLObjects().push_back(childXMLObject);
+ getUnknownXMLObjects().push_back(childXMLObject);
}
void processAttribute(const DOMAttr* attribute) {
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
};
class XMLTOOL_DLLLOCAL HeaderImpl : public virtual Header,
- public AbstractElementProxy,
public AbstractAttributeExtensibleXMLObject,
+ public AbstractComplexElement,
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)
+ HeaderImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
: AbstractXMLObject(nsURI, localName, prefix, schemaType) {
- init();
}
HeaderImpl(const HeaderImpl& src)
: AbstractXMLObject(src),
- AbstractElementProxy(src),
AbstractAttributeExtensibleXMLObject(src),
+ AbstractComplexElement(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());
- }
- }
+ VectorOf(XMLObject) v=getUnknownXMLObjects();
+ for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
+ v.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);
- }
+ IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject, m_children.end());
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);
- }
+ marshallExtensionAttributes(domElement);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- getXMLObjects().push_back(childXMLObject);
+ getUnknownXMLObjects().push_back(childXMLObject);
}
void processAttribute(const DOMAttr* attribute) {
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
};
public AbstractXMLObjectUnmarshaller
{
void init() {
- m_Header=NULL;
- m_Body=NULL;
- m_children.push_back(NULL);
- m_children.push_back(NULL);
+ m_Header=nullptr;
+ m_Body=nullptr;
+ m_children.push_back(nullptr);
+ m_children.push_back(nullptr);
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)
+ EnvelopeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
: AbstractXMLObject(nsURI, localName, prefix, schemaType) {
init();
}
EnvelopeImpl(const EnvelopeImpl& src)
- : AbstractXMLObject(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
+ : AbstractXMLObject(src), AbstractAttributeExtensibleXMLObject(src),
+ AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
if (src.getHeader())
setHeader(src.getHeader()->cloneHeader());
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);
- }
+ marshallExtensionAttributes(domElement);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_CHILD(Header,XMLConstants::SOAP11ENV_NS,false);
- PROC_TYPED_CHILD(Body,XMLConstants::SOAP11ENV_NS,false);
+ PROC_TYPED_CHILD(Header,SOAP11ENV_NS,false);
+ PROC_TYPED_CHILD(Body,SOAP11ENV_NS,false);
AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
}
void processAttribute(const DOMAttr* attribute) {
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
};
};
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);
+
+static const XMLCh _CLIENT[] = UNICODE_LITERAL_6(C,l,i,e,n,t);
+static const XMLCh _SERVER[] = UNICODE_LITERAL_6(S,e,r,v,e,r);
+static const XMLCh _MUSTUNDERSTAND[] = UNICODE_LITERAL_14(M,u,s,t,U,n,d,e,r,s,t,a,n,d);
+static const XMLCh _VERSIONMISMATCH[] = UNICODE_LITERAL_15(V,e,r,s,i,o,n,M,i,s,m,a,t,c,h);
+
+xmltooling::QName Faultcode::CLIENT(SOAP11ENV_NS,_CLIENT,SOAP11ENV_PREFIX);
+xmltooling::QName Faultcode::SERVER(SOAP11ENV_NS,_SERVER,SOAP11ENV_PREFIX);
+xmltooling::QName Faultcode::MUSTUNDERSTAND(SOAP11ENV_NS,_MUSTUNDERSTAND,SOAP11ENV_PREFIX);
+xmltooling::QName Faultcode::VERSIONMISMATCH(SOAP11ENV_NS,_VERSIONMISMATCH,SOAP11ENV_PREFIX);