Modified Files:
Namespaces.py
-- added some new WSRF namespaces.
WSDLTools.py
-- look for resourceProperties in all relevant namespaces.
XMLSchema.py
-- added 1 convenience method.
----------------------------------------------------------------------
main
| @@ -70,15 +70,57 @@ except: | |||
| WRAP_AES256 = "http://www.w3.org/2001/04/xmlenc#kw-aes256" | |||
| class WSRF_V1_2: | |||
| '''OASIS WSRF Specifications Version 1.2 | |||
| ''' | |||
| class LIFETIME: | |||
| XSD_DRAFT1 = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd" | |||
| XSD_DRAFT4 = "http://docs.oasis-open.org/wsrf/2004/11/wsrf-WS-ResourceLifetime-1.2-draft-04.xsd" | |||
| WSDL_DRAFT1 = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.wsdl" | |||
| WSDL_DRAFT4 = "http://docs.oasis-open.org/wsrf/2004/11/wsrf-WS-ResourceLifetime-1.2-draft-04.wsdl" | |||
| #LATEST = DRAFT4 | |||
| WSDL_LIST = (WSDL_DRAFT1, WSDL_DRAFT4) | |||
| XSD_LIST = (XSD_DRAFT1, XSD_DRAFT4) | |||
| class PROPERTIES: | |||
| XSD_DRAFT1 = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd" | |||
| XSD_DRAFT5 = "http://docs.oasis-open.org/wsrf/2004/11/wsrf-WS-ResourceProperties-1.2-draft-05.xsd" | |||
| WSDL_DRAFT1 = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl" | |||
| WSDL_DRAFT5 = "http://docs.oasis-open.org/wsrf/2004/11/wsrf-WS-ResourceProperties-1.2-draft-05.wsdl" | |||
| #LATEST = DRAFT5 | |||
| WSDL_LIST = (WSDL_DRAFT1, WSDL_DRAFT5) | |||
| XSD_LIST = (XSD_DRAFT1, XSD_DRAFT5) | |||
| class BASENOTIFICATION: | |||
| XSD_DRAFT1 = "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd" | |||
| #LATEST = DRAFT1 | |||
| #WSDL_LIST = (WSDL_DRAFT1,) | |||
| XSD_LIST = (XSD_DRAFT1,) | |||
| class BASEFAULTS: | |||
| XSD_DRAFT1 = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.xsd" | |||
| XSD_DRAFT3 = "http://docs.oasis-open.org/wsrf/2004/11/wsrf-WS-BaseFaults-1.2-draft-03.xsd" | |||
| #LATEST = DRAFT3 | |||
| #WSDL_LIST = (WSDL_DRAFT1, WSDL_DRAFT3) | |||
| XSD_LIST = (XSD_DRAFT1, XSD_DRAFT3) | |||
| WSRF = WSRF_V1_2 | |||
| WSRFLIST = (WSRF_V1_2,) | |||
| class OASIS: | |||
| '''URLs for Oasis specifications | |||
| ''' | |||
| WSSE = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" | |||
| UTILITY = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" | |||
| LIFETIME = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd" | |||
| PROPERTIES = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd" | |||
| BASENOTIFICATION = "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd" | |||
| BASEFAULTS = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.xsd" | |||
| LIFETIME = WSRF_V1_2.LIFETIME.XSD_DRAFT1 | |||
| PROPERTIES = WSRF_V1_2.PROPERTIES.XSD_DRAFT1 | |||
| BASENOTIFICATION = WSRF_V1_2.BASENOTIFICATION.XSD_DRAFT1 | |||
| BASEFAULTS = WSRF_V1_2.BASEFAULTS.XSD_DRAFT1 | |||
| class WSSE: | |||
| BASE = "http://schemas.xmlsoap.org/ws/2002/04/secext" | |||
| @@ -99,7 +141,6 @@ class WSA200408: | |||
| ADDRESS = "http://schemas.xmlsoap.org/ws/2004/08/addressing" | |||
| ANONYMOUS = "%s/role/anonymous" %ADDRESS | |||
| FAULT = "%s/fault" %ADDRESS | |||
| WSA = WSA200408 | |||
| class WSA200403: | |||
| ADDRESS = "http://schemas.xmlsoap.org/ws/2004/03/addressing" | |||
| @@ -111,6 +152,9 @@ class WSA200303: | |||
| ANONYMOUS = "%s/role/anonymous" %ADDRESS | |||
| FAULT = None | |||
| WSA = WSA200408 | |||
| WSA_LIST = (WSA200408, WSA200403, WSA200303) | |||
| class WSP: | |||
| POLICY = "http://schemas.xmlsoap.org/ws/2002/12/policy" | |||
| @@ -11,7 +11,7 @@ ident = "$Id$" | |||
| import weakref | |||
| from cStringIO import StringIO | |||
| from Namespaces import OASIS, XMLNS, WSA200408, WSA200403, WSA200303 | |||
| from Namespaces import OASIS, XMLNS, WSA, WSA_LIST, WSRF_V1_2 | |||
| from Utility import Collection, CollectionNS, DOM, ElementProxy, basejoin | |||
| from XMLSchema import XMLSchema, SchemaReader, WSDLToolsAdapter | |||
| @@ -556,11 +556,12 @@ class PortType(Element): | |||
| self.name = DOM.getAttr(element, 'name') | |||
| self.documentation = GetDocumentation(element) | |||
| self.targetNamespace = DOM.getAttr(element, 'targetNamespace') | |||
| if DOM.hasAttr(element, 'ResourceProperties', OASIS.PROPERTIES): | |||
| rpref = DOM.getAttr(element, 'ResourceProperties', OASIS.PROPERTIES) | |||
| self.resourceProperties = ParseQName(rpref, element) | |||
| lookfor = (WSA200408, WSA200403, WSA200303,) | |||
| for nsuri in WSRF_V1_2.PROPERTIES.XSD_LIST: | |||
| if DOM.hasAttr(element, 'ResourceProperties', nsuri): | |||
| rpref = DOM.getAttr(element, 'ResourceProperties', nsuri) | |||
| self.resourceProperties = ParseQName(rpref, element) | |||
| NS_WSDL = DOM.GetWSDLUri(self.getWSDL().version) | |||
| elements = DOM.getElements(element, 'operation', NS_WSDL) | |||
| for element in elements: | |||
| @@ -577,7 +578,7 @@ class PortType(Element): | |||
| docs = GetDocumentation(item) | |||
| msgref = DOM.getAttr(item, 'message') | |||
| message = ParseQName(msgref, item) | |||
| for WSA in lookfor: | |||
| for WSA in WSA_LIST: | |||
| action = DOM.getAttr(item, 'Action', WSA.ADDRESS, None) | |||
| if action: break | |||
| operation.setInput(message, name, docs, action) | |||
| @@ -588,7 +589,7 @@ class PortType(Element): | |||
| docs = GetDocumentation(item) | |||
| msgref = DOM.getAttr(item, 'message') | |||
| message = ParseQName(msgref, item) | |||
| for WSA in lookfor: | |||
| for WSA in WSA_LIST: | |||
| action = DOM.getAttr(item, 'Action', WSA.ADDRESS, None) | |||
| if action: break | |||
| operation.setOutput(message, name, docs, action) | |||
| @@ -598,7 +599,7 @@ class PortType(Element): | |||
| docs = GetDocumentation(item) | |||
| msgref = DOM.getAttr(item, 'message') | |||
| message = ParseQName(msgref, item) | |||
| for WSA in lookfor: | |||
| for WSA in WSA_LIST: | |||
| action = DOM.getAttr(item, 'Action', WSA.ADDRESS, None) | |||
| if action: break | |||
| operation.addFault(message, name, docs, action) | |||
| @@ -612,7 +613,7 @@ class PortType(Element): | |||
| if self.resourceProperties: | |||
| ns,name = self.resourceProperties | |||
| prefix = epc.getPrefix(ns) | |||
| epc.setAttributeNS(OASIS.PROPERTIES, 'ResourceProperties', '%s:%s'%(prefix,name)) | |||
| epc.setAttributeNS(WSRF.PROPERTIES.LATEST, 'ResourceProperties', '%s:%s'%(prefix,name)) | |||
| for op in self.operations: | |||
| op.toDom(epc._getNode()) | |||
| @@ -724,7 +725,7 @@ class MessageRole(Element): | |||
| epc.setAttributeNS(None, 'message', self.message) | |||
| if self.action: | |||
| epc.setAttributeNS(WSA200408.ADDRESS, 'Action', self.action) | |||
| epc.setAttributeNS(WSA.ADDRESS, 'Action', self.action) | |||
| class Binding(Element): | |||
| @@ -591,6 +591,11 @@ class XMLSchemaComponent(XMLBase, MarkerInterface): | |||
| """return requested attribute or None | |||
| """ | |||
| return self.attributes.get(attribute) | |||
| def getAttributeName(self): | |||
| """return attribute name or None | |||
| """ | |||
| return self.getAttribute('name') | |||
| def setAttributes(self, node): | |||
| """Sets up attribute dictionary, checks for required attributes and | |||