Send soap message. @param soapenv: A soap envelope to send. @type soapenv: L{Document} @return: The reply to the sent message. @rtype: I{builtin} or I{subclass of} L{Object}
(self, soapenv)
| 623 | return result |
| 624 | |
| 625 | def send(self, soapenv): |
| 626 | """ |
| 627 | Send soap message. |
| 628 | @param soapenv: A soap envelope to send. |
| 629 | @type soapenv: L{Document} |
| 630 | @return: The reply to the sent message. |
| 631 | @rtype: I{builtin} or I{subclass of} L{Object} |
| 632 | """ |
| 633 | result = None |
| 634 | location = self.location() |
| 635 | binding = self.method.binding.input |
| 636 | transport = self.options.transport |
| 637 | retxml = self.options.retxml |
| 638 | prettyxml = self.options.prettyxml |
| 639 | log.debug('sending to (%s)\nmessage:\n%s', location, soapenv) |
| 640 | try: |
| 641 | self.last_sent(soapenv) |
| 642 | plugins = PluginContainer(self.options.plugins) |
| 643 | plugins.message.marshalled(envelope=soapenv.root()) |
| 644 | if prettyxml: |
| 645 | soapenv = soapenv.str() |
| 646 | else: |
| 647 | soapenv = soapenv.plain() |
| 648 | soapenv = soapenv.encode('utf-8') |
| 649 | plugins.message.sending(envelope=soapenv) |
| 650 | request = Request(location, soapenv) |
| 651 | request.headers = self.headers() |
| 652 | reply = transport.send(request) |
| 653 | ctx = plugins.message.received(reply=reply.message) |
| 654 | reply.message = ctx.reply |
| 655 | if retxml: |
| 656 | result = reply.message |
| 657 | else: |
| 658 | result = self.succeeded(binding, reply.message) |
| 659 | except TransportError as e: |
| 660 | if e.httpcode in (202, 204): |
| 661 | result = None |
| 662 | else: |
| 663 | log.error(self.last_sent()) |
| 664 | result = self.failed(binding, e) |
| 665 | return result |
| 666 | |
| 667 | def headers(self): |
| 668 | """ |