/usr/lib/python3/dist-packages/pyxb/bundles/wssplat/wsdl11.py is in python3-pyxb-bundles-wssplat 1.2.6+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | # Copyright 2009-2013, Peter A. Bigot
#
# 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.
from __future__ import print_function
from pyxb.bundles.wssplat.raw.wsdl11 import *
import pyxb.bundles.wssplat.raw.wsdl11 as raw_wsdl11
import pyxb.namespace
from pyxb.utils import domutils, six
import xml.dom
def ImportRelatedNamespaces ():
"""Import modules for related namespaces so they are available to
create binding instances from the WSDL sources."""
try:
import pyxb.bundles.wssplat.soapbind11
except ImportError:
pass
try:
import pyxb.bundles.wssplat.soapbind12
except ImportError:
pass
try:
import pyxb.bundles.wssplat.soap11
except ImportError:
pass
try:
import pyxb.bundles.wssplat.soap12
except ImportError:
pass
try:
import pyxb.bundles.wssplat.soapenv
except ImportError:
pass
try:
import pyxb.bundles.wssplat.httpbind
except ImportError:
pass
try:
import pyxb.bundles.wssplat.mimebind
except ImportError:
pass
class _WSDL_binding_mixin (object):
"""Mix-in class to mark element Python bindings that are expected
to be wildcard matches in WSDL binding elements."""
pass
class _WSDL_port_mixin (object):
"""Mix-in class to mark element Python bindings that are expected
to be wildcard matches in WSDL port elements."""
pass
class _WSDL_operation_mixin (object):
"""Mix-in class to mark element Python bindings that are expected
to be wildcard matches in WSDL (binding) operation elements."""
pass
class tPort (raw_wsdl11.tPort):
def __getBindingReference (self):
return self.__bindingReference
def _setBindingReference (self, binding_reference):
self.__bindingReference = binding_reference
__bindingReference = None
bindingReference = property(__getBindingReference)
def __getAddressReference (self):
return self.__addressReference
def _setAddressReference (self, address_reference):
self.__addressReference = address_reference
__addressReference = None
addressReference = property(__getAddressReference)
raw_wsdl11.tPort._SetSupersedingClass(tPort)
class tBinding (raw_wsdl11.tBinding):
def __getPortTypeReference (self):
return self.__portTypeReference
def setPortTypeReference (self, port_type_reference):
self.__portTypeReference = port_type_reference
__portTypeReference = None
portTypeReference = property(__getPortTypeReference)
def __getProtocolBinding (self):
"""Return the protocol-specific binding information."""
return self.__protocolBinding
def _setProtocolBinding (self, protocol_binding):
self.__protocolBinding = protocol_binding
__protocolBinding = None
protocolBinding = property(__getProtocolBinding)
def operationMap (self):
return self.__operationMap
__operationMap = None
def __init__ (self, *args, **kw):
super(tBinding, self).__init__(*args, **kw)
self.__operationMap = { }
raw_wsdl11.tBinding._SetSupersedingClass(tBinding)
class tPortType (raw_wsdl11.tPortType):
def operationMap (self):
return self.__operationMap
__operationMap = None
def __init__ (self, *args, **kw):
super(tPortType, self).__init__(*args, **kw)
self.__operationMap = { }
raw_wsdl11.tPortType._SetSupersedingClass(tPortType)
class tParam (raw_wsdl11.tParam):
def __getMessageReference (self):
return self.__messageReference
def _setMessageReference (self, message_reference):
self.__messageReference = message_reference
__messageReference = None
messageReference = property(__getMessageReference)
raw_wsdl11.tParam._SetSupersedingClass(tParam)
class tFault (raw_wsdl11.tFault):
def __getMessageReference (self):
return self.__messageReference
def _setMessageReference (self, message_reference):
self.__messageReference = message_reference
__messageReference = None
messageReference = property(__getMessageReference)
raw_wsdl11.tFault._SetSupersedingClass(tFault)
class tPart (raw_wsdl11.tPart):
def __getElementReference (self):
return self.__elementReference
def _setElementReference (self, element_reference):
self.__elementReference = element_reference
__elementReference = None
elementReference = property(__getElementReference)
def __getTypeReference (self):
return self.__typeReference
def _setTypeReference (self, type_reference):
self.__typeReference = type_reference
__typeReference = None
typeReference = property(__getTypeReference)
raw_wsdl11.tPart._SetSupersedingClass(tPart)
class tBindingOperation (raw_wsdl11.tBindingOperation):
def __getOperationReference (self):
return self.__operationReference
def _setOperationReference (self, operation_reference):
self.__operationReference = operation_reference
__operationReference = None
operationReference = property(__getOperationReference)
raw_wsdl11.tBindingOperation._SetSupersedingClass(tBindingOperation)
class tDefinitions (raw_wsdl11.tDefinitions):
def messageMap (self):
return self.targetNamespace().messages()
def namespaceContext (self):
return self.__namespaceContext
__namespaceContext = None
def bindingMap (self):
return self.__bindingMap
__bindingMap = None
def targetNamespace (self):
return self.namespaceContext().targetNamespace()
def namespace (self):
return self.__namespace
__namespace = None
def _addToMap (self, map, qname, value):
map[qname] = value
(ns, ln) = qname
if (ns == self.targetNamespace()):
map[(None, ln)] = value
elif (ns is None):
map[(self.targetNamespace(), ln)] = value
return map
def schema (self):
return self.__schema
__schema = None
@classmethod
def _PreFactory_vx (self, args, kw):
# Import standard bindings. If we do this, then wildcard
# binding, port, and operation elements will be recognized and
# converted into bindings.
import pyxb.bundles.wssplat.soapbind11
import pyxb.bundles.wssplat.soapbind12
import pyxb.bundles.wssplat.httpbind
# Ensure we have definitions for any externally-referenced
# things we might need. @todo: This might have to
# chronologically precede the import above.
pyxb.namespace.archive.NamespaceArchive.PreLoadArchives()
raw_wsdl11.Namespace.validateComponentModel()
state = ( kw.pop('process_schema', False),
kw.pop('generation_uid', None),
kw.get('_dom_node') )
return state
def _postFactory_vx (self, state):
(process_schema, generation_uid, dom_node) = state
assert isinstance(dom_node, xml.dom.Node)
node_en = pyxb.namespace.ExpandedName(dom_node)
self.__namespaceContext = pyxb.namespace.NamespaceContext.GetNodeContext(dom_node)
self.__buildMaps()
if process_schema:
self.__processSchema(generation_uid)
self.__finalizeReferences()
return self
__WSDLCategories = ( 'service', 'port', 'message', 'binding', 'portType' )
def __buildMaps (self):
tns = self.namespaceContext().targetNamespace()
tns.configureCategories(self.__WSDLCategories)
for m in self.message:
tns.messages()[m.name] = m
for pt in self.portType:
tns.portTypes()[pt.name] = pt
for op in pt.operation:
pt.operationMap()[op.name] = op
params = op.fault[:]
if op.input is not None:
params.append(op.input)
if op.output is not None:
params.append(op.output)
for p in params:
msg_en = p.message
p._setMessageReference(p.message.message())
for b in self.binding:
tns.bindings()[b.name] = b
port_type_en = b.type
b.setPortTypeReference(port_type_en.portType())
for wc in b.wildcardElements():
if isinstance(wc, _WSDL_binding_mixin):
b._setProtocolBinding(wc)
break
for op in b.operation:
b.operationMap()[op.name] = op
for wc in op.wildcardElements():
if isinstance(wc, _WSDL_operation_mixin):
op._setOperationReference(wc)
break
for s in self.service:
tns.services()[s.name] = s
for p in s.port:
binding_en = p.binding
p._setBindingReference(binding_en.binding())
for wc in p.wildcardElements():
if isinstance(wc, _WSDL_port_mixin):
p._setAddressReference(wc)
break
def __processSchema (self, generation_uid):
global pyxb
import pyxb.xmlschema
print('PS %s' % (generation_uid,))
if self.__schema is not None:
print('Already have schema')
return self.__schema
for t in self.types:
for wc in t.wildcardElements():
if isinstance(wc, xml.dom.Node) and pyxb.namespace.XMLSchema.nodeIsNamed(wc, 'schema'):
# Try to load component models for any namespace referenced by this.
# Probably shouldn't need to do this except for imported ones.
for ns in six.itervalues(self.namespaceContext().inScopeNamespaces()):
try:
ns.validateComponentModel()
except Exception as e:
print('Error validating component model for %s: %s' % (ns.uri(), e))
self.__schema = pyxb.xmlschema.schema.CreateFromDOM(wc, namespace_context=self.namespaceContext(), generation_uid=generation_uid)
elif isinstance(wc, pyxb.xmlschema.schema):
self.__schema = wc
else:
print('No match: %s %s' % (wc.namespaceURI, namespace.localName))
if self.__schema is not None:
return self.__schema
return None
def __finalizeReferences (self):
tns = self.namespaceContext().targetNamespace()
for m in six.itervalues(tns.messages()):
for p in m.part:
if (p.element is not None) and (p.elementReference is None):
elt_en = p.element
p._setElementReference(elt_en.elementDeclaration())
if (p.type is not None) and (p.typeReference is None):
type_en = p.type
p._setTypeReference(type_en.typeDefinition())
raw_wsdl11.tDefinitions._SetSupersedingClass(tDefinitions)
pyxb.namespace.NamespaceContext._AddTargetNamespaceAttribute(raw_wsdl11.Namespace.createExpandedName('definitions'), pyxb.namespace.ExpandedName('targetNamespace'))
|