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

Method headercontent

suds/bindings/binding.py:355–395  ·  view source on GitHub ↗

Get the content for the soap I{Header} node. @param method: A service method. @type method: I{service.Method} @return: The xml content for the @rtype: [L{Element},..]

(self, method)

Source from the content-addressed store, hash-verified

353 raise Exception('not implemented')
354
355 def headercontent(self, method):
356 """
357 Get the content for the soap I{Header} node.
358 @param method: A service method.
359 @type method: I{service.Method}
360 @return: The xml content for the <body/>
361 @rtype: [L{Element},..]
362 """
363 n = 0
364 content = []
365 wsse = self.options().wsse
366 if wsse is not None:
367 content.append(wsse.xml())
368 headers = self.options().soapheaders
369 if not isinstance(headers, (tuple, list, dict)):
370 headers = (headers,)
371 if len(headers) == 0:
372 return content
373 pts = self.headpart_types(method)
374 if isinstance(headers, (tuple, list)):
375 for header in headers:
376 if isinstance(header, Element):
377 content.append(deepcopy(header))
378 continue
379 if len(pts) == n:
380 break
381 h = self.mkheader(method, pts[n], header)
382 ns = pts[n][1].namespace('ns0')
383 h.setPrefix(ns[0], ns[1])
384 content.append(h)
385 n += 1
386 else:
387 for pt in pts:
388 header = headers.get(pt[0])
389 if header is None:
390 continue
391 h = self.mkheader(method, pt, header)
392 ns = pt[1].namespace('ns0')
393 h.setPrefix(ns[0], ns[1])
394 content.append(h)
395 return content
396
397 def replycontent(self, method, body):
398 """

Callers 1

get_messageMethod · 0.95

Calls 8

optionsMethod · 0.95
headpart_typesMethod · 0.95
mkheaderMethod · 0.95
setPrefixMethod · 0.80
appendMethod · 0.45
xmlMethod · 0.45
namespaceMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected