Convert this SOAP message to a text string.
554993
public static String messageToString(SOAPMessage soapMessage)
    {
        String strTextMessage = null;
        if (soapMessage != null)
        {
            try {

                ByteArrayOutputStream ba = new ByteArrayOutputStream();
                PrintStream os = new PrintStream(ba);

                soapMessage.writeTo(os);

                os.flush();
                ByteArrayInputStream is = new ByteArrayInputStream(ba.toByteArray());
                Reader reader = new InputStreamReader(is);
                BufferedReader br = new BufferedReader(reader);
                StringBuffer sb = new StringBuffer();
                String string = null;
                while ((string = br.readLine()) != null)
                {
                    sb.append(string);
                    sb.append('\n');
                }
                strTextMessage = sb.toString();
            } catch (SOAPException ex)  {
                ex.printStackTrace();
            } catch (IOException ex)  {
                ex.printStackTrace();
            }
        }
        return strTextMessage;
    }
25320
@Override
    public String getMessage() {
        String message = super.getMessage();

        if (message == null) {
            message = "";
        }

        if (hexdump != null) {
            return message + (message.length() > 0 ? " " : "") + "(Hexdump: "
                    + hexdump + ')';
        }

        return message;
    }
564087
def FromMessageGetSimpleElementDeclaration(message):
    '''

    '''
    assert isinstance(message, WSDLTools.Message), 'expecting WSDLTools.Message'

    if len(message.parts) == 1 and message.parts[0].element is not None:
       part = message.parts[0]
       nsuri,name = part.element
       wsdl = message.getWSDL()
       types = wsdl.types
       if types.has_key(nsuri) and types[nsuri].elements.has_key(name):
            e = types[nsuri].elements[name]
            if isinstance(e, XMLSchema.ElementDeclaration) is True and e.getAttribute('type'):
                typ = e.getAttribute('type')
                bt = BaseTypeInterpreter()
                ptype = bt.get_pythontype(typ[1], typ[0])
                return ptype

    return None
604506
def message(self) -> str:
        """"""
        ret = '{}: {}'.format(self.code, self.short_desc)
        if self.context is not None:
            specific_error_msg = self.context.format(*self.parameters)
            ret += ' ({})'.format(specific_error_msg)
        return ret
1113158
public String text() {
        try {
            connect();
            return responseCode() >= 400 ? read(connection.getErrorStream()) : read(connection.getInputStream());
        } catch (IOException e) {
            throw new HttpException("Failed URL: " + url, e);
        }finally {
            dispose();
        }
    }
690678
def text(self) -> bytes:
        """"""
        if self.condition:
            if self.code:
                return BytesFormat(b'%b %b %b') \
                    % (self.condition, self.code, self._text)
            else:
                return BytesFormat(b'%b %b') % (self.condition, self._text)
        else:
            return bytes(self._text)
786463
def to_xml(self):
        
        makeValid = make_valid_xml_value

        xml = '<xml><more>%s</more>' % (self.more)

        for message_type, message in self.console_messages:
            xml += '<%s message="%s"></%s>' % (message_type, makeValid(message), message_type)

        xml += '</xml>'

        return xml
628533
def to_s
      text = ''

      text << tag_output_string + "\n" unless tags.empty?
      text << "#{@keyword}:#{name_output_string}"
      text << "\n" + description_output_string unless (description.nil? || description.empty?)
      text << "\n" unless (rows.empty? || description.nil? || description.empty?)
      text << "\n" + parameters_output_string if parameter_row
      text << "\n" + rows_output_string unless argument_rows.empty?

      text
    end
1120389
def serialize(message):
        
        fmt = "!BBH"

        if message.token is None or message.token == "":
            tkl = 0
        else:
            tkl = len(message.token)
        tmp = (defines.VERSION << 2)
        tmp |= message.type
        tmp <<= 4
        tmp |= tkl

        values = [tmp, message.code, message.mid]

        if message.token is not None and tkl > 0:

            for b in str(message.token):
                fmt += "c"
                values.append(bytes(b, "utf-8"))

        options = Serializer.as_sorted_list(message.options)  # already sorted
        lastoptionnumber = 0
        for option in options:

            # write 4-bit option delta
            optiondelta = option.number - lastoptionnumber
            optiondeltanibble = Serializer.get_option_nibble(optiondelta)
            tmp = (optiondeltanibble << defines.OPTION_DELTA_BITS)

            # write 4-bit option length
            optionlength = option.length
            optionlengthnibble = Serializer.get_option_nibble(optionlength)
            tmp |= optionlengthnibble
            fmt += "B"
            values.append(tmp)

            # write extended option delta field (0 - 2 bytes)
            if optiondeltanibble == 13:
                fmt += "B"
                values.append(optiondelta - 13)
            elif optiondeltanibble == 14:
                fmt += "H"
                values.append(optiondelta - 269)

            # write extended option length field (0 - 2 bytes)
            if optionlengthnibble == 13:
                fmt += "B"
                values.append(optionlength - 13)
            elif optionlengthnibble == 14:
                fmt += "H"
                values.append(optionlength - 269)

            # write option value
            if optionlength > 0:
                opt_type = defines.OptionRegistry.LIST[option.number].value_type
                if opt_type == defines.INTEGER:
                    words = Serializer.int_to_words(option.value, optionlength, 8)
                    for num in range(0, optionlength):
                        fmt += "B"
                        values.append(words[num])
                elif opt_type == defines.STRING:
                    fmt += str(len(bytes(option.value, "utf-8"))) + "s"
                    values.append(bytes(option.value, "utf-8"))

                else:  # OPAQUE
                    for b in option.value:
                        fmt += "B"
                        values.append(b)

            # update last option number
            lastoptionnumber = option.number

        payload = message.payload

        if payload is not None and len(payload) > 0:
            # if payload is present and of non-zero length, it is prefixed by
            # an one-byte Payload Marker (0xFF) which indicates the end of
            # options and the start of the payload

            fmt += "B"
            values.append(defines.PAYLOAD_MARKER)

            if isinstance(payload, bytes):
                fmt += str(len(payload)) + "s"
                values.append(payload)
            else:
                fmt += str(len(bytes(payload, "utf-8"))) + "s"
                values.append(bytes(payload, "utf-8"))
            # for b in str(payload):
            #     fmt += "c"
            #     values.append(bytes(b, "utf-8"))

        datagram = None
        if values[1] is None:
            values[1] = 0
        if values[2] is None:
            values[2] = 0
        try:
            s = struct.Struct(fmt)
            datagram = ctypes.create_string_buffer(s.size)
            s.pack_into(datagram, 0, *values)
        except struct.error:
            # The .exception method will report on the exception encountered
            # and provide a traceback.
            logger.debug(fmt)
            logger.debug(values)
            logging.exception('Failed to pack structure')

        return datagram
535564
def text(self):
        
        if self.m_name == -1 or self.m_event != const.TEXT:
            return u''

        return self.sb[self.m_name]
940562
def to_text(keyring):
    """"""

    textring = {}
    for keyname in keyring:
        keytext = dns.name.to_text(keyname)
        secret = base64.encodestring(keyring[keyname])
        textring[keytext] = secret
    return textring
124190
public SOAPMessage sendForMessage() {
		final HttpResponse res = sendForResponse();
		final MimeHeaders headers = new MimeHeaders();
		for (Entry<String, List<String>> entry : res.headers().entrySet()) {
			if(StrUtil.isNotEmpty(entry.getKey())) {
				headers.setHeader(entry.getKey(), CollUtil.get(entry.getValue(), 0));
			}
		}
		try {
			return this.factory.createMessage(headers, res.bodyStream());
		} catch (IOException | SOAPException e) {
			throw new SoapRuntimeException(e);
		}
	}
958148
protected  String resource_to_string(nitro_service service)
	{
		String result = service.get_payload_formatter().resource_to_string(this);
		return result;
	}
507233
def to_string(self, indent="", newl="", addindent=""):
        '''
        
        '''
        buf = StringIO()
        self.to_xml().writexml(buf, indent=indent, addindent=addindent,
                               newl=newl)
        return buf.getvalue()
1030183
public String getAsText() {
        Enum<?> value = (Enum<?>) getValue();
        if (value == null) {
            return "";
        }

        String text = getMessagesAccessor().getMessage(messagesKeyPrefix + value.name(), (String) null);
        if (text == null) {
            return value.toString();
        } else {
            return text;
        }
    }
5113
def to_text(self):
        
        if self.items is None:
            return
        else:
            text = ''
            for item in self.items:
                text += ' - %s\n' % item.to_text()

            return text
784343
def from_raw_message(cls, rawmessage):
        """"""
        userdata_dict = Userdata(rawmessage[8:22])
        return ExtendedSend(rawmessage[2:5],
                            {'cmd1': rawmessage[6],
                             'cmd2': rawmessage[7]},
                            userdata_dict,
                            flags=rawmessage[5],
                            acknak=rawmessage[22:23])