<s> """<STR_LIT>""" <EOL> from logging import getLogger <EOL> from suds import * <EOL> from suds . sax import splitPrefix <EOL> from suds . sax . element import Element <EOL> from suds . bindings . document import Document <EOL> from suds . bindings . rpc import RPC , Encoded <EOL> from suds . xsd import qualify , Namespace <EOL> from suds . xsd . schema import Schema , SchemaCollection <EOL> from suds . xsd . query import ElementQuery <EOL> from suds . sudsobject import Object , Facade , Metadata <EOL> from suds . reader import DocumentReader , DefinitionsReader <EOL> from urlparse import urljoin <EOL> import re , soaparray <EOL> log = getLogger ( __name__ ) <EOL> wsdlns = ( None , "<STR_LIT>" ) <EOL> soapns = ( None , '<STR_LIT>' ) <EOL> soap12ns = ( None , '<STR_LIT>' ) <EOL> class WObject ( Object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , root , definitions = None ) : <EOL> """<STR_LIT>""" <EOL> Object . __init__ ( self ) <EOL> self . root = root <EOL> pmd = Metadata ( ) <EOL> pmd . excludes = [ '<STR_LIT:root>' ] <EOL> pmd . wrappers = dict ( qname = repr ) <EOL> self . __metadata__ . __print__ = pmd <EOL> def resolve ( self , definitions ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class NamedObject ( WObject ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , root , definitions ) : <EOL> """<STR_LIT>""" <EOL> WObject . __init__ ( self , root , definitions ) <EOL> self . name = root . get ( '<STR_LIT:name>' ) <EOL> self . qname = ( self . name , definitions . tns [ <NUM_LIT:1> ] ) <EOL> pmd = self . __metadata__ . __print__ <EOL> pmd . wrappers [ '<STR_LIT>' ] = repr <EOL> class Definitions ( WObject ) : <EOL> """<STR_LIT>""" <EOL> Tag = '<STR_LIT>' <EOL> def __init__ ( self , url , options ) : <EOL> """<STR_LIT>""" <EOL> reader = DocumentReader ( options ) <EOL> d = reader . open ( url ) <EOL> root = d . root ( ) <EOL> WObject . __init__ ( self , root ) <EOL> self . id = objid ( self ) <EOL> self . options = options <EOL> self . url = url <EOL> self . tns = self . mktns ( root ) <EOL> self . types = [ ] <EOL> self . schema = None <EOL> self . children = [ ] <EOL> self . imports = [ ] <EOL> self . messages = { } <EOL> self . port_types = { } <EOL> self . bindings = { } <EOL> self . services = [ ] <EOL> self . add_children ( self . root ) <EOL> self . children . sort ( ) <EOL> pmd = self . __metadata__ . __print__ <EOL> pmd . excludes . append ( '<STR_LIT>' ) <EOL> pmd . excludes . append ( '<STR_LIT>' ) <EOL> pmd . wrappers [ '<STR_LIT>' ] = repr <EOL> self . open_imports ( ) <EOL> self . resolve ( ) <EOL> self . build_schema ( ) <EOL> self . set_wrapped ( ) <EOL> for s in self . services : <EOL> self . add_methods ( s ) <EOL> def mktns ( self , root ) : <EOL> """<STR_LIT>""" <EOL> tns = root . get ( '<STR_LIT>' ) <EOL> prefix = root . findPrefix ( tns ) <EOL> if prefix is None : <EOL> prefix = '<STR_LIT>' <EOL> return ( prefix , tns ) <EOL> def add_children ( self , root ) : <EOL> """<STR_LIT>""" <EOL> for c in root . getChildren ( ns = wsdlns ) : <EOL> child = Factory . create ( c , self ) <EOL> if child is None : continue <EOL> self . children . append ( child ) <EOL> if isinstance ( child , Import ) : <EOL> self . imports . append ( child ) <EOL> continue <EOL> if isinstance ( child , Types ) : <EOL> self . types . append ( child ) <EOL> continue <EOL> if isinstance ( child , Message ) : <EOL> self . messages [ child . qname ] = child <EOL> continue <EOL> if isinstance ( child , PortType ) : <EOL> self . port_types [ child . qname ] = child <EOL> continue <EOL> if isinstance ( child , Binding ) : <EOL> self . bindings [ child . qname ] = child <EOL> continue <EOL> if isinstance ( child , Service ) : <EOL> self . services . append ( child ) <EOL> continue <EOL> def open_imports ( self ) : <EOL> """<STR_LIT>""" <EOL> for imp in self . imports : <EOL> imp . load ( self ) <EOL> def resolve ( self ) : <EOL> """<STR_LIT>""" <EOL> for c in self . children : <EOL> c . resolve ( self ) <EOL> def build_schema ( self ) : <EOL> """<STR_LIT>""" <EOL> container = SchemaCollection ( self ) <EOL> for t in [ t for t in self . types if t . local ( ) ] : <EOL> for root in t . contents ( ) : <EOL> schema = Schema ( root , self . url , self . options , container ) <EOL> container . add ( schema ) <EOL> if not len ( container ) : <EOL> root = Element . buildPath ( self . root , '<STR_LIT>' ) <EOL> schema = Schema ( root , self . url , self . options , container ) <EOL> container . add ( schema ) <EOL> self . schema = container . load ( self . options ) <EOL> for s in [ t . schema ( ) for t in self . types if t . imported ( ) ] : <EOL> self . schema . merge ( s ) <EOL> return self . schema <EOL> def add_methods ( self , service ) : <EOL> """<STR_LIT>""" <EOL> bindings = { <EOL> '<STR_LIT>' : Document ( self ) , <EOL> '<STR_LIT>' : RPC ( self ) , <EOL> '<STR_LIT>' : Encoded ( self ) <EOL> } <EOL> for p in service . ports : <EOL> binding = p . binding <EOL> ptype = p . binding . type <EOL> operations = p . binding . type . operations . values ( ) <EOL> for name in [ op . name for op in operations ] : <EOL> m = Facade ( '<STR_LIT>' ) <EOL> m . name = name <EOL> m . location = p . location <EOL> m . binding = Facade ( '<STR_LIT>' ) <EOL> op = binding . operation ( name ) <EOL> m . soap = op . soap <EOL> key = '<STR_LIT:/>' . join ( ( op . soap . style , op . soap . input . body . use ) ) <EOL> m . binding . input = bindings . get ( key ) <EOL> key = '<STR_LIT:/>' . join ( ( op . soap . style , op . soap . output . body . use ) ) <EOL> m . binding . output = bindings . get ( key ) <EOL> op = ptype . operation ( name ) <EOL> p . methods [ name ] = m <EOL> def set_wrapped ( self ) : <EOL> """<STR_LIT>""" <EOL> for b in self . bindings . values ( ) : <EOL> for op in b . operations . values ( ) : <EOL> for body in ( op . soap . input . body , op . soap . output . body ) : <EOL> body . wrapped = False <EOL> if len ( body . parts ) != <NUM_LIT:1> : <EOL> continue <EOL> for p in body . parts : <EOL> if p . element is None : <EOL> continue <EOL> query = ElementQuery ( p . element ) <EOL> pt = query . execute ( self . schema ) <EOL> if pt is None : <EOL> raise TypeNotFound ( query . ref ) <EOL> resolved = pt . resolve ( ) <EOL> if resolved . builtin ( ) : <EOL> continue <EOL> body . wrapped = True <EOL> def __getstate__ ( self ) : <EOL> nopickle = ( '<STR_LIT>' , ) <EOL> state = self . __dict__ . copy ( ) <EOL> for k in nopickle : <EOL> if k in state : <EOL> del state [ k ] <EOL> return state <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % self . id <EOL> class Import ( WObject ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , root , definitions ) : <EOL> """<STR_LIT>""" <EOL> WObject . __init__ ( self , root , definitions ) <EOL> self . location = root . get ( '<STR_LIT:location>' ) <EOL> self . ns = root . get ( '<STR_LIT>' ) <EOL> self . imported = None <EOL> pmd = self . __metadata__ . __print__ <EOL> pmd . wrappers [ '<STR_LIT>' ] = repr <EOL> def load ( self , definitions ) : <EOL> """<STR_LIT>""" <EOL> url = self . location <EOL> if '<STR_LIT>' not in url : <EOL> url = urljoin ( definitions . url , url ) <EOL> options = definitions . options <EOL> d = Definitions ( url , options ) <EOL> if d . root . match ( Definitions . Tag , wsdlns ) : <EOL> self . import_definitions ( definitions , d ) <EOL> return <EOL> if d . root . match ( Schema . Tag , Namespace . xsdns ) : <EOL> self . import_schema ( definitions , d ) <EOL> return <EOL> raise Exception ( '<STR_LIT>' % url ) <EOL> def import_definitions ( self , definitions , d ) : <EOL> """<STR_LIT>""" <EOL> definitions . types += d . types <EOL> definitions . messages . update ( d . messages ) <EOL> definitions . port_types . update ( d . port_types ) <EOL> definitions . bindings . update ( d . bindings ) <EOL> self . imported = d <EOL> def import_schema ( self , definitions , d ) : <EOL> """<STR_LIT>""" <EOL> if not len ( definitions . types ) : <EOL> types = Types . create ( definitions ) <EOL> definitions . types . append ( types ) <EOL> else : <EOL> types = definitions . types [ - <NUM_LIT:1> ] <EOL> types . root . append ( d . root ) <EOL> def __gt__ ( self , other ) : <EOL> return False <EOL> class Types ( WObject ) : <EOL> """<STR_LIT>""" <EOL> @ classmethod <EOL> def create ( cls , definitions ) : <EOL> root = Element ( '<STR_LIT>' , ns = wsdlns ) <EOL> definitions . root . insert ( root ) <EOL> return Types ( root , definitions ) <EOL> def __init__ ( self , root , definitions ) : <EOL> """<STR_LIT>""" <EOL> WObject . __init__ ( self , root , definitions ) <EOL> self . definitions = definitions <EOL> def contents ( self ) : <EOL> return self . root . getChildren ( '<STR_LIT>' , Namespace . xsdns ) <EOL> def schema ( self ) : <EOL> return self . definitions . schema <EOL> def local ( self ) : <EOL> return ( self . definitions . schema is None ) <EOL> def imported ( self ) : <EOL> return ( not self . local ( ) ) <EOL> def __gt__ ( self , other ) : <EOL> return isinstance ( other , Import ) <EOL> class Part ( NamedObject ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , root , definitions ) : <EOL> """<STR_LIT>""" <EOL> NamedObject . __init__ ( self , root , definitions ) <EOL> pmd = Metadata ( ) <EOL> pmd . wrappers = dict ( element = repr , type = repr ) <EOL> self . __metadata__ . __print__ = pmd <EOL> tns = definitions . tns <EOL> self . element = self . __getref ( '<STR_LIT>' , tns ) <EOL> self . type = self . __getref ( '<STR_LIT:type>' , tns ) <EOL> def __getref ( self , a , tns ) : <EOL> """<STR_LIT>""" <EOL> s = self . root . get ( a ) <EOL> if s is None : <EOL> return s <EOL> else : <EOL> return qualify ( s , self . root , tns ) <EOL> class Message ( NamedObject ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , root , definitions ) : <EOL> """<STR_LIT>""" <EOL> NamedObject . __init__ ( self , root , definitions ) <EOL> self . parts = [ ] <EOL> for p in root . getChildren ( '<STR_LIT>' ) : <EOL> part = Part ( p , definitions ) <EOL> self . parts . append ( part ) <EOL> def __gt__ ( self , other ) : <EOL> return isinstance ( other , ( Import , Types ) ) <EOL> class PortType ( NamedObject ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , root , definitions ) : <EOL> """<STR_LIT>""" <EOL> NamedObject . __init__ ( self , root , definitions ) <EOL> self . operations = { } <EOL> for c in root . getChildren ( '<STR_LIT>' ) : <EOL> op = Facade ( '<STR_LIT>' ) <EOL> op . name = c . get ( '<STR_LIT:name>' ) <EOL> op . tns = definitions . tns <EOL> input = c . getChild ( '<STR_LIT:input>' ) <EOL> if input is None : <EOL> op . input = None <EOL> else : <EOL> op . input = input . get ( '<STR_LIT:message>' ) <EOL> output = c . getChild ( '<STR_LIT>' ) <EOL> if output is None : <EOL> op . output = None <EOL> else : <EOL> op . output = output . get ( '<STR_LIT:message>' ) <EOL> faults = [ ] <EOL> for fault in c . getChildren ( '<STR_LIT>' ) : <EOL> f = Facade ( '<STR_LIT>' ) <EOL> f . name = fault . get ( '<STR_LIT:name>' ) <EOL> f . message = fault . get ( '<STR_LIT:message>' ) <EOL> faults . append ( f ) <EOL> op . faults = faults <EOL> self . operations [ op . name ] = op <EOL> def resolve ( self , definitions ) : <EOL> """<STR_LIT>""" <EOL> for op in self . operations . values ( ) : <EOL> if op . input is None : <EOL> op . input = Message ( Element ( '<STR_LIT>' ) , definitions ) <EOL> else : <EOL> qref = qualify ( op . input , self . root , definitions . tns ) <EOL> msg = definitions . messages . get ( qref ) <EOL> if msg is None : <EOL> raise Exception ( "<STR_LIT>" % op . input ) <EOL> else : <EOL> op . input = msg <EOL> if op . output is None : <EOL> op . output = Message ( Element ( '<STR_LIT>' ) , definitions ) <EOL> else : <EOL> qref = qualify ( op . output , self . root , definitions . tns ) <EOL> msg = definitions . messages . get ( qref ) <EOL> if msg is None : <EOL> raise Exception ( "<STR_LIT>" % op . output ) <EOL> else : <EOL> op . output = msg <EOL> for f in op . faults : <EOL> qref = qualify ( f . message , self . root , definitions . tns ) <EOL> msg = definitions . messages . get ( qref ) <EOL> if msg is None : <EOL> raise Exception , "<STR_LIT>" % f . message <EOL> f . message = msg <EOL> def operation ( self , name ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> return self . operations [ name ] <EOL> except Exception , e : <EOL> raise MethodNotFound ( name ) <EOL> def __gt__ ( self , other ) : <EOL> return isinstance ( other , ( Import , Types , Message ) ) <EOL> class Binding ( NamedObject ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , root , definitions ) : <EOL> """<STR_LIT>""" <EOL> NamedObject . __init__ ( self , root , definitions ) <EOL> self . operations = { } <EOL> self . type = root . get ( '<STR_LIT:type>' ) <EOL> sr = self . soaproot ( ) <EOL> if sr is None : <EOL> self . soap = None <EOL> return <EOL> soap = Facade ( '<STR_LIT>' ) <EOL> self . soap = soap <EOL> self . soap . style = sr . get ( '<STR_LIT>' , default = '<STR_LIT>' ) <EOL> self . add_operations ( self . root , definitions ) <EOL> def soaproot ( self ) : <EOL> """<STR_LIT>""" <EOL> for ns in ( soapns , soap12ns ) : <EOL> sr = self . root . getChild ( '<STR_LIT>' , ns = ns ) <EOL> if sr is not None : <EOL> return sr <EOL> return None <EOL> def add_operations ( self , root , definitions ) : <EOL> """<STR_LIT>""" <EOL> dsop = Element ( '<STR_LIT>' , ns = soapns ) <EOL> for c in root . getChildren ( '<STR_LIT>' ) : <EOL> op = Facade ( '<STR_LIT>' ) <EOL> op . name = c . get ( '<STR_LIT:name>' ) <EOL> sop = c . getChild ( '<STR_LIT>' , default = dsop ) <EOL> soap = Facade ( '<STR_LIT>' ) <EOL> soap . action = '<STR_LIT>' % sop . get ( '<STR_LIT>' , default = '<STR_LIT>' ) <EOL> soap . style = sop . get ( '<STR_LIT>' , default = self . soap . style ) <EOL> soap . input = Facade ( '<STR_LIT>' ) <EOL> soap . input . body = Facade ( '<STR_LIT>' ) <EOL> soap . input . headers = [ ] <EOL> soap . output = Facade ( '<STR_LIT>' ) <EOL> soap . output . body = Facade ( '<STR_LIT>' ) <EOL> soap . output . headers = [ ] <EOL> op . soap = soap <EOL> input = c . getChild ( '<STR_LIT:input>' ) <EOL> if input is None : <EOL> input = Element ( '<STR_LIT:input>' , ns = wsdlns ) <EOL> body = input . getChild ( '<STR_LIT:body>' ) <EOL> self . body ( definitions , soap . input . body , body ) <EOL> for header in input . getChildren ( '<STR_LIT>' ) : <EOL> self . header ( definitions , soap . input , header ) <EOL> output = c . getChild ( '<STR_LIT>' ) <EOL> if output is None : <EOL> output = Element ( '<STR_LIT>' , ns = wsdlns ) <EOL> body = output . getChild ( '<STR_LIT:body>' ) <EOL> self . body ( definitions , soap . output . body , body ) <EOL> for header in output . getChildren ( '<STR_LIT>' ) : <EOL> self . header ( definitions , soap . output , header ) <EOL> faults = [ ] <EOL> for fault in c . getChildren ( '<STR_LIT>' ) : <EOL> sf = fault . getChild ( '<STR_LIT>' ) <EOL> if sf is None : <EOL> continue <EOL> fn = fault . get ( '<STR_LIT:name>' ) <EOL> f = Facade ( '<STR_LIT>' ) <EOL> f . name = sf . get ( '<STR_LIT:name>' , default = fn ) <EOL> f . use = sf . get ( '<STR_LIT>' , default = '<STR_LIT>' ) <EOL> faults . append ( f ) <EOL> soap . faults = faults <EOL> self . operations [ op . name ] = op <EOL> def body ( self , definitions , body , root ) : <EOL> """<STR_LIT>""" <EOL> if root is None : <EOL> body . use = '<STR_LIT>' <EOL> body . namespace = definitions . tns <EOL> body . parts = ( ) <EOL> return <EOL> parts = root . get ( '<STR_LIT>' ) <EOL> if parts is None : <EOL> body . parts = ( ) <EOL> else : <EOL> body . parts = re . split ( '<STR_LIT>' , parts ) <EOL> body . use = root . get ( '<STR_LIT>' , default = '<STR_LIT>' ) <EOL> ns = root . get ( '<STR_LIT>' ) <EOL> if ns is None : <EOL> body . namespace = definitions . tns <EOL> else : <EOL> prefix = root . findPrefix ( ns , '<STR_LIT>' ) <EOL> body . namespace = ( prefix , ns ) <EOL> def header ( self , definitions , parent , root ) : <EOL> """<STR_LIT>""" <EOL> if root is None : <EOL> return <EOL> header = Facade ( '<STR_LIT>' ) <EOL> parent . headers . append ( header ) <EOL> header . use = root . get ( '<STR_LIT>' , default = '<STR_LIT>' ) <EOL> ns = root . get ( '<STR_LIT>' ) <EOL> if ns is None : <EOL> header . namespace = definitions . tns <EOL> else : <EOL> prefix = root . findPrefix ( ns , '<STR_LIT>' ) <EOL> header . namespace = ( prefix , ns ) <EOL> msg = root . get ( '<STR_LIT:message>' ) <EOL> if msg is not None : <EOL> header . message = msg <EOL> part = root . get ( '<STR_LIT>' ) <EOL> if part is not None : <EOL> header . part = part <EOL> def resolve ( self , definitions ) : <EOL> """<STR_LIT>""" <EOL> self . resolveport ( definitions ) <EOL> for op in self . operations . values ( ) : <EOL> self . resolvesoapbody ( definitions , op ) <EOL> self . resolveheaders ( definitions , op ) <EOL> self . resolvefaults ( definitions , op ) <EOL> def resolveport ( self , definitions ) : <EOL> """<STR_LIT>""" <EOL> ref = qualify ( self . type , self . root , definitions . tns ) <EOL> port_type = definitions . port_types . get ( ref ) <EOL> if port_type is None : <EOL> raise Exception ( "<STR_LIT>" % self . type ) <EOL> else : <EOL> self . type = port_type <EOL> def resolvesoapbody ( self , definitions , op ) : <EOL> """<STR_LIT>""" <EOL> ptop = self . type . operation ( op . name ) <EOL> if ptop is None : <EOL> raise Exception , "<STR_LIT>" % op . name <EOL> soap = op . soap <EOL> parts = soap . input . body . parts <EOL> if len ( parts ) : <EOL> pts = [ ] <EOL> for p in ptop . input . parts : <EOL> if p . name in parts : <EOL> pts . append ( p ) <EOL> soap . input . body . parts = pts <EOL> else : <EOL> soap . input . body . parts = ptop . input . parts <EOL> parts = soap . output . body . parts <EOL> if len ( parts ) : <EOL> pts = [ ] <EOL> for p in ptop . output . parts : <EOL> if p . name in parts : <EOL> pts . append ( p ) <EOL> soap . output . body . parts = pts <EOL> else : <EOL> soap . output . body . parts = ptop . output . parts <EOL> def resolveheaders ( self , definitions , op ) : <EOL> """<STR_LIT>""" <EOL> soap = op . soap <EOL> headers = soap . input . headers + soap . output . headers <EOL> for header in headers : <EOL> mn = header . message <EOL> ref = qualify ( mn , self . root , definitions . tns ) <EOL> message = definitions . messages . get ( ref ) <EOL> if message is None : <EOL> raise Exception , "<STR_LIT>" % mn <EOL> pn = header . part <EOL> for p in message . parts : <EOL> if p . name == pn : <EOL> header . part = p <EOL> break <EOL> if pn == header . part : <EOL> raise Exception , "<STR_LIT>" % ( ref , pn ) <EOL> def resolvefaults ( self , definitions , op ) : <EOL> """<STR_LIT>""" <EOL> ptop = self . type . operation ( op . name ) <EOL> if ptop is None : <EOL> raise Exception , "<STR_LIT>" % op . name <EOL> soap = op . soap <EOL> for fault in soap . faults : <EOL> for f in ptop . faults : <EOL> if f . name == fault . name : <EOL> fault . parts = f . message . parts <EOL> continue <EOL> if hasattr ( fault , '<STR_LIT>' ) : <EOL> continue <EOL> raise Exception , "<STR_LIT>" % ( fault . name , self . type . name ) <EOL> def operation ( self , name ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> return self . operations [ name ] <EOL> except : <EOL> raise MethodNotFound ( name ) <EOL> def __gt__ ( self , other ) : <EOL> return ( not isinstance ( other , Service ) ) <EOL> class Port ( NamedObject ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , root , definitions , service ) : <EOL> """<STR_LIT>""" <EOL> NamedObject . __init__ ( self , root , definitions ) <EOL> self . __service = service <EOL> self . binding = root . get ( '<STR_LIT>' ) <EOL> address = root . getChild ( '<STR_LIT:address>' ) <EOL> if address is None : <EOL> self . location = None <EOL> else : <EOL> self . location = address . get ( '<STR_LIT:location>' ) . encode ( '<STR_LIT:utf-8>' ) <EOL> self . methods = { } <EOL> def method ( self , name ) : <EOL> """<STR_LIT>""" <EOL> return self . methods . get ( name ) <EOL> class Service ( NamedObject ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , root , definitions ) : <EOL> """<STR_LIT>""" <EOL> NamedObject . __init__ ( self , root , definitions ) <EOL> self . ports = [ ] <EOL> for p in root . getChildren ( '<STR_LIT:port>' ) : <EOL> port = Port ( p , definitions , self ) <EOL> self . ports . append ( port ) <EOL> def port ( self , name ) : <EOL> """<STR_LIT>""" <EOL> for p in self . ports : <EOL> if p . name == name : <EOL> return p <EOL> return None <EOL> def setlocation ( self , url , names = None ) : <EOL> """<STR_LIT>""" <EOL> for p in self . ports : <EOL> for m in p . methods . values ( ) : <EOL> if names is None or m . name in names : <EOL> m . location = url <EOL> def resolve ( self , definitions ) : <EOL> """<STR_LIT>""" <EOL> filtered = [ ] <EOL> for p in self . ports : <EOL> ref = qualify ( p . binding , self . root , definitions . tns ) <EOL> binding = definitions . bindings . get ( ref ) <EOL> if binding is None : <EOL> raise Exception ( "<STR_LIT>" % p . binding ) <EOL> if binding . soap is None : <EOL> continue <EOL> p . binding = binding <EOL> filtered . append ( p ) <EOL> self . ports = filtered <EOL> def __gt__ ( self , other ) : <EOL> return True <EOL> class Factory : <EOL> """<STR_LIT>""" <EOL> tags = { <EOL> '<STR_LIT>' : Import , <EOL> '<STR_LIT>' : Types , <EOL> '<STR_LIT:message>' : Message , <EOL> '<STR_LIT>' : PortType , <EOL> '<STR_LIT>' : Binding , <EOL> '<STR_LIT>' : Service , <EOL> } <EOL> @ classmethod <EOL> def create ( cls , root , definitions ) : <EOL> """<STR_LIT>""" <EOL> fn = cls . tags . get ( root . name ) <EOL> if fn is not None : <EOL> return fn ( root , definitions ) <EOL> else : <EOL> return None </s>
