MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / get_reply

Method get_reply

suds/bindings/binding.py:130–168  ·  view source on GitHub ↗

Process the I{reply} for the specified I{method} by sax parsing the I{reply} and then unmarshalling into python object(s). @param method: The name of the invoked method. @type method: str @param reply: The reply XML received after invoking the specified

(self, method, reply)

Source from the content-addressed store, hash-verified

128 return Document(env)
129
130 def get_reply(self, method, reply):
131 """
132 Process the I{reply} for the specified I{method} by sax parsing the
133 I{reply} and then unmarshalling into python object(s).
134 @param method: The name of the invoked method.
135 @type method: str
136 @param reply: The reply XML received after invoking the specified
137 method.
138 @type reply: str
139 @return: The unmarshalled reply. The returned value is an L{Object}
140 for a I{list} depending on whether the service returns a single
141 object or a collection.
142 @rtype: tuple ( L{Element}, L{Object} )
143 """
144 reply = self.replyfilter(reply)
145 sax = Parser()
146 replyroot = sax.parse(string=reply)
147 plugins = PluginContainer(self.options().plugins)
148 plugins.message.parsed(reply=replyroot)
149 soapenv = replyroot.getChild('Envelope')
150 soapenv.promotePrefixes()
151 soapbody = soapenv.getChild('Body')
152 self.detect_fault(soapbody)
153 soapbody = self.multiref.process(soapbody)
154 nodes = self.replycontent(method, soapbody)
155 rtypes = self.returned_types(method)
156 if len(rtypes) > 1:
157 result = self.replycomposite(rtypes, nodes)
158 return (replyroot, result)
159 if len(rtypes) == 1:
160 if rtypes[0].unbounded():
161 result = self.replylist(rtypes[0], nodes)
162 return (replyroot, result)
163 if len(nodes):
164 unmarshaller = self.unmarshaller()
165 resolved = rtypes[0].resolve(nobuiltin=True)
166 result = unmarshaller.process(nodes[0], resolved)
167 return (replyroot, result)
168 return (replyroot, None)
169
170 def detect_fault(self, body):
171 """

Callers 1

succeededMethod · 0.80

Calls 15

parseMethod · 0.95
optionsMethod · 0.95
detect_faultMethod · 0.95
replycontentMethod · 0.95
returned_typesMethod · 0.95
replycompositeMethod · 0.95
replylistMethod · 0.95
unmarshallerMethod · 0.95
ParserClass · 0.90
PluginContainerClass · 0.90
getChildMethod · 0.80
promotePrefixesMethod · 0.80

Tested by

no test coverage detected