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
|
from __future__ import print_function
import pyxb.utils.domutils
import xml.dom
import xml.dom.minidom
import pyxb.namespace
# Structure
#import DWML
#print 'Validating DWML'
#DWML.Namespace.validateSchema()
#print 'Validated DWML: types %s' % ("\n".join(DWML.Namespace.typeDefinitions().iterkeys()),)
dom = xml.dom.minidom.parse(open('NDFDgen.xml', 'rb'))
body_dom = dom.documentElement.firstChild.nextSibling.firstChild.nextSibling
print(body_dom)
# Service interface types
import ndfd
# WSDL
import pyxb.bundles.wssplat.wsdl11 as wsdl
uri_src = open('ndfdXML.wsdl')
doc = xml.dom.minidom.parse(uri_src)
spec = wsdl.definitions.createFromDOM(doc.documentElement, process_schema=True)
binding = spec.binding[0]
print(binding.name)
port_type = spec.portType[0]
print(port_type.name)
bop = binding.operationMap()[body_dom.localName]
print(bop.toxml("utf-8"))
pop = port_type.operationMap()[body_dom.localName]
print(pop.toxml("utf-8"))
input = pop.input
print(input.toxml("utf-8"))
print(type(input))
print(input.message)
im_en = input._namespaceContext().interpretQName(input.message)
print(im_en)
msg = im_en.message()
print(msg)
for p in msg.part:
print(p.toxml("utf-8"))
msg_ns = pyxb.namespace.NamespaceForURI(body_dom.namespaceURI)
print('%s %s' % (body_dom.namespaceURI, msg_ns))
parts = msg.part
nodes = body_dom.childNodes
while parts and nodes:
p = parts.pop(0)
while nodes and (not (xml.dom.Node.ELEMENT_NODE == nodes[0].nodeType)):
nodes.pop(0)
assert nodes
n = nodes.pop(0)
if p.name != n.localName:
print('Desynchronized: part %s expected node %s' % (p.name, n.localName))
nodes.insert(0, n)
continue
print('%s %s' % (p.name, n.localName))
#print '%s yielded %s' msg_ns
#msg = spec.messageMap()
#print msg
#print req
#dom_support = req.toDOM(pyxb.utils.domutils.BindingDOMSupport())
#dom_support.finalize()
#print dom_support.document().toxml("utf-8")
|