This is the application code for handling the message. Once the
message is received the application can retrieve the soap part, the
attachment part if there are any, or any other information from the
message.
173714
public void processThisMessage()
    {
        Utility.getLogger().info("On message called in receiving process");
        try {
            BaseMessage messageIn = this.getMessage();
            if (messageIn != null)
            {
                BaseMessage messageReply = this.createReplyMessage(messageIn);
                this.moveScreenParamsToMessage(messageReply);
                // Step 2 - Get the body part of the message
                this.getTransport().setupReplyMessage(messageReply, messageIn, MessageInfoTypeModel.REPLY, MessageTypeModel.MESSAGE_IN);
            
                this.getTransport().processIncomingMessage(messageReply, null);
            }
        } catch(Exception ex) {
            ex.printStackTrace();
            Debug.print(ex, "Error in processing or replying to a message");
        }
    }
36773
def Handle_Receive(self, msg):
        

        msg = self.Check_Message(msg)
        msg_type = msg['type']

        f_name = "Handle_{0}".format(msg_type)
        try:
            f = getattr(self, f_name)
        except AttributeError:
            f = self.Handle_ERROR(msg)
        reply = f(msg)

        return reply
451951
public boolean handleRequest(MessageContext messageContext) throws WebServiceClientException {
        try {
            logRequest("Sending SOAP request", messageContext, false);
        } catch (SoapEnvelopeException e) {
            log.warn("Unable to write SOAP request to logger", e);
        } catch (TransformerException e) {
            log.warn("Unable to write SOAP request to logger", e);
        }
        
        return true;
    }
1043543
@FFDCIgnore(IOException.class)
    public boolean processWithWholeMessageHandler(DATA_TYPE dt) throws CharacterCodingException {
        if ((appTextMessageHandler != null) && (dt == DATA_TYPE.TEXT)) {

            Class<?> clazz = appTextMessageHandlerClass;

            if (clazz.equals(String.class)) {
                String message = convertMessageToString();

                // call the application's MessageHandler.onMessage(<String> x) method
                connLink.setReadLinkStatus(READ_LINK_STATUS.ON_READ_THREAD);
                ((MessageHandler.Whole<String>) appTextMessageHandler).onMessage(message);
                return true;
            }

            else if (clazz.equals(Reader.class)) {
                Reader message = convertMessageToReader();

                // call the application's MessageHandler.onMessage(<Reader> x) method
                connLink.setReadLinkStatus(READ_LINK_STATUS.ON_READ_THREAD);
                ((MessageHandler.Whole<Reader>) appTextMessageHandler).onMessage(message);
                return true;
            }
        }

        if ((appBinaryMessageHandler != null) && (dt == DATA_TYPE.BINARY)) {
            Class<?> clazz = appBinaryMessageHandlerClass;

            if (clazz.equals(ByteBuffer.class)) {
                ByteBuffer message = convertMessageToByteBuffer();

                // call the application's MessageHandler.onMessage(<ByteBuffer> x) method
                connLink.setReadLinkStatus(READ_LINK_STATUS.ON_READ_THREAD);
                ((MessageHandler.Whole<ByteBuffer>) appBinaryMessageHandler).onMessage(message);
                return true;
            }

            else if (clazz.equals(byte[].class)) {
                byte[] message = convertPayloadToByteArray();

                // call the application's MessageHandler.onMessage(<byte[]> x) method
                connLink.setReadLinkStatus(READ_LINK_STATUS.ON_READ_THREAD);
                ((MessageHandler.Whole<byte[]>) appBinaryMessageHandler).onMessage(message);
                return true;
            }

            else if (clazz.equals(InputStream.class)) {
                InputStream message = convertMessageToInputStream();

                // call the application's MessageHandler.onMessage(<InputStream> x) method
                connLink.setReadLinkStatus(READ_LINK_STATUS.ON_READ_THREAD);
                ((MessageHandler.Whole<InputStream>) appBinaryMessageHandler).onMessage(message);
                return true;
            }
        }
        if ((appPongMessageHandler != null) && (dt == DATA_TYPE.PONG)) {
            Class<?> clazz = appPongMessageHandlerClass;
            if (clazz.equals(PongMessage.class)) {
                ByteBuffer message = convertMessageToByteBuffer(true);
                PongMessage msg = new PongMessageImpl(message);

                // call the application's MessageHandler.onMessage(<Reader> x) method
                connLink.setReadLinkStatus(READ_LINK_STATUS.ON_READ_THREAD);
                ((MessageHandler.Whole<PongMessage>) appPongMessageHandler).onMessage(msg);
                return true;
            }
        }

        // if the generic type for this MessageHandler.Whole equals one of the configured decoder generic types, then use that decoder
        // clazz: is the generic class that the MessageHandler.Whole specifies
        // then go through the decoders that also have been specified with this same (or assignable) generic class.
        // in other words, let me see if I have any decoders<X> to use with this  MessageHandler<X>.
        if ((appTextMessageHandler != null) && (dt == DATA_TYPE.TEXT)) {

            Class<?> clazz = appTextMessageHandlerClass;
            ArrayList<Decoder> dcList = findDecoderFromAppDecoderType(clazz, dt);

            if (dcList != null && dcList.size() > 0) {
                Decoder firstDecoder = dcList.get(0);
                if (firstDecoder instanceof Decoder.Text) {
                    String message = convertMessageToString();
                    //user might have declared multiple decoders of same type for this endpoint. In this case, check
                    //decoder list and find the first decoder in the list which has implemented willDecode(..) to return
                    //'true'
                    Decoder dc = findWillDecodeDecoder(dcList, message);
                    if (dc != null) {
                        try {
                            dc.init(endpointConfig);
                            Object appObj = ((Decoder.Text) dc).decode(message);
                            connLink.setReadLinkStatus(READ_LINK_STATUS.ON_READ_THREAD);
                            ((MessageHandler.Whole) appTextMessageHandler).onMessage(appObj);
                            return true;
                        } catch (DecodeException e) {
                            connLink.callOnError(e, true);
                            return true;
                        }
                    }
                } else if (firstDecoder instanceof Decoder.TextStream) {
                    Reader message = convertMessageToReader();
                    try {
                        //WebSocket API does not support willDecode() method for Decoder.BinaryStream type. Hence, even if
                        //user has declared multiple same type of decoder, just pick the first one in the list and use it.

                        firstDecoder.init(endpointConfig);
                        Object appObj = ((Decoder.TextStream) firstDecoder).decode(message);
                        connLink.setReadLinkStatus(READ_LINK_STATUS.ON_READ_THREAD);
                        ((MessageHandler.Whole) appTextMessageHandler).onMessage(appObj);
                        return true;
                    } catch (DecodeException e) {
                        connLink.callOnError(e, true);
                        return true;
                    } catch (IOException e) {
                        if (tc.isDebugEnabled()) {
                            Tr.debug(tc, "IOException calling onMessage on class " + clazz.getName() + " while decoding Decoder.TextStream type "
                                         + ((Decoder.TextStream) firstDecoder).toString()
                                         + "Exception is: " + e.getMessage());
                        }
                        //Since IOexception has occurred, there is no point in attempting to read message TextStream to convert into
                        //message string to pass as first param to form DecodeException. Hence passing just a error message
                        //"IOException decoding BinaryStream" as first parameter here
                        String msg = Tr.formatMessage(tc,
                                                      "decoder.ioexception",
                                                      appTextMessageHandler.getClass().getName(), firstDecoder.getClass().getName());

                        DecodeException de = new DecodeException(msg, e.getMessage(), e);
                        connLink.callOnError(de, true);
                        return true;
                    }
                }
            }
        }

        if ((appBinaryMessageHandler != null) && (dt == DATA_TYPE.BINARY)) {
            Class<?> clazz = appBinaryMessageHandlerClass;
            ArrayList<Decoder> dcList = findDecoderFromAppDecoderType(clazz, dt);

            if (dcList != null && dcList.size() > 0) {
                Decoder firstDecoder = dcList.get(0);
                if (firstDecoder instanceof Decoder.Binary) {
                    // Decode the given bytes into an object of type T
                    ByteBuffer message = convertMessageToByteBuffer();
                    //user might have declared multiple decoders of same type for this endpoint. In this case, check
                    //decoder list and find the first decoder in the list which has implemented willDecode(..) to return
                    //'true'
                    Decoder dc = findWillDecodeDecoder(dcList, message);
                    if (dc != null) {
                        try {
                            dc.init(endpointConfig);
                            Object appObj = ((Decoder.Binary) dc).decode(message);
                            connLink.setReadLinkStatus(READ_LINK_STATUS.ON_READ_THREAD);
                            ((MessageHandler.Whole) appBinaryMessageHandler).onMessage(appObj);
                            return true;
                        } catch (DecodeException e) {
                            connLink.callOnError(e, true);
                            return true;
                        }
                    } else {
                        if (tc.isDebugEnabled()) {
                            Tr.debug(tc, "willDecode returned false");
                        }
                        return true;
                    }
                } else if (firstDecoder instanceof Decoder.BinaryStream) {
                    InputStream message = convertMessageToInputStream();
                    try {
                        //WebSocket API does not support willDecode() method for Decoder.BinaryStream type. Hence, even if
                        //user has declared multiple same type of decoder, just pick the first one in the list and use it.
                        firstDecoder.init(endpointConfig);
                        Object appObj = ((Decoder.BinaryStream) firstDecoder).decode(message);
                        connLink.setReadLinkStatus(READ_LINK_STATUS.ON_READ_THREAD);
                        ((MessageHandler.Whole) appBinaryMessageHandler).onMessage(appObj);
                        return true;
                    } catch (DecodeException e) {
                        connLink.callOnError(e, true);
                        return true;
                    } catch (IOException e) {
                        // do NOT allow instrumented FFDC to be used here
                        if (tc.isDebugEnabled()) {
                            Tr.debug(tc, "IOException calling onMessage on class " + clazz.getName() + " while decoding Decoder.BinaryStream type "
                                         + ((Decoder.BinaryStream) firstDecoder).toString()
                                         + "Exception is: " + e.getMessage());
                        }
                        //Since IOexception has occurred, there is no point in attempting to read message BinaryStream to convert into
                        //message string to pass as first param to form DecodeException. Hence passing just a error message
                        //"IOException decoding BinaryStream" as first parameter here
                        String msg = Tr.formatMessage(tc,
                                                      "decoder.ioexception",
                                                      appBinaryMessageHandler.getClass().getName(), ((Decoder.BinaryStream) firstDecoder).getClass().getName());
                        DecodeException de = new DecodeException(msg, e.getMessage(), e);
                        connLink.callOnError(de, true);
                        return true;
                    }
                }
            }
        }
        return false;
    }
464119
@Override
    public void processMessage() {
        if (overwrite)
            storage.setArray(key, payload);
        else if (!storage.arrayExists(key))
            storage.setArray(key, payload);
    }
259729
protected void setSOAPRequestObjects(SOAPMessageContext context,
                                         List<SOAPElement> params) {
        // Extract the SOAP Message
        SOAPMessage message = context.getMessage();

        // Get the envelope body
        SOAPBody body;
        try {
            body = message.getSOAPBody();
        } catch (SOAPException e) {
            throw CXFUtility.getFault(e);
        }

        try {
            body.removeContents();
            for (SOAPElement p : params) {
                body.addChildElement(p);
            }
        } catch (Exception e) {
            logger.error("Problem changing SOAP message contents", e);
            throw CXFUtility.getFault(e);
        }
    }
1049125
private void getContent(Query query, Message message, int row) throws MessagingException, IOException {
	StringBuffer body = new StringBuffer();
	Struct cids = new StructImpl();
	query.setAtEL(CIDS, row, cids);
	if (message.isMimeType("text/plain")) {
	    String content = getConent(message);
	    query.setAtEL(TEXT_BODY, row, content);
	    body.append(content);
	}
	else if (message.isMimeType("text/html")) {
	    String content = getConent(message);
	    query.setAtEL(HTML_BODY, row, content);
	    body.append(content);
	}
	else {
	    Object content = message.getContent();
	    if (content instanceof MimeMultipart) {
		Array attachments = new ArrayImpl();
		Array attachmentFiles = new ArrayImpl();
		getMultiPart(query, row, attachments, attachmentFiles, cids, (MimeMultipart) content, body);

		if (attachments.size() > 0) {
		    try {
			query.setAtEL(ATTACHMENTS, row, ListUtil.arrayToList(attachments, "\t"));
		    }
		    catch (PageException pageexception) {}
		}
		if (attachmentFiles.size() > 0) {
		    try {
			query.setAtEL(ATTACHMENT_FILES, row, ListUtil.arrayToList(attachmentFiles, "\t"));
		    }
		    catch (PageException pageexception1) {}
		}

	    }
	}
	query.setAtEL(BODY, row, body.toString());
    }
679976
def handle_message(self, msg):
        
        # log messages received so that no one else has to
        if self._logger.isEnabledFor(logging.DEBUG):
            self._logger.debug(
                "received from {}: {}"
                .format(self.bind_address_string, repr(str(msg))))

        if msg.mtype == Message.INFORM:
            return self.handle_inform(msg)
        elif msg.mtype == Message.REPLY:
            return self.handle_reply(msg)
        elif msg.mtype == Message.REQUEST:
            return self.handle_request(msg)
        else:
            self._logger.error("Unexpected message type from server ['%s']."
                               % (msg,))
1021773
protected BodyPart handlePart(MimePart part) throws IOException, MessagingException {
        String contentType = parseContentType(part.getContentType());

        if (part.isMimeType("multipart/*")) {
            return handleMultiPart((Multipart) part.getContent());
        } else if (part.isMimeType("text/*")) {
            return handleTextPart(part, contentType);
        } else if (part.isMimeType("image/*")) {
            return handleImageBinaryPart(part, contentType);
        } else if (part.isMimeType("application/*")) {
            return handleApplicationContentPart(part, contentType);
        } else {
            return handleBinaryPart(part, contentType);
        }
    }
82094
def ReceiveSOAP(self, readerclass=None, **kw):
        '''
        '''
        if self.ps: return self.ps
        if not self.IsSOAP():
            raise TypeError(
                'Response is "%s", not "text/xml"' % self.reply_headers.type)
        if len(self.data) == 0:
            raise TypeError('Received empty response')

        self.ps = ParsedSoap(self.data, 
                        readerclass=readerclass or self.readerclass, 
                        encodingStyle=kw.get('encodingStyle'))

        if self.sig_handler is not None:
            self.sig_handler.verify(self.ps)

        return self.ps
1206036
def use_soap(self, request, destination="", soap_headers=None, sign=False,
                 **kwargs):
        
        headers = [("content-type", "application/soap+xml")]

        soap_message = make_soap_enveloped_saml_thingy(request, soap_headers)

        logger.debug("SOAP message: %s", soap_message)

        if sign and self.sec:
            _signed = self.sec.sign_statement(soap_message,
                                              class_name=class_name(request),
                                              node_id=request.id)
            soap_message = _signed

        return {"url": destination, "method": "POST",
                "data": soap_message, "headers": headers}
388570
public String app() {
    if (d1 < 0) {
      // No stack or detail is present
      return asg.length() > 0 ? asg : null;
    } else if (d1 == 0) {
      // Application portion is empty
      return null;
    } else {
      // Application is present along with stack, detail, or sequence
      return substr(asg, 0, d1);
    }
  }
356041
function onMessage(userId, msg) {
  // check if it's a message for current dialog
  if (isMessageForCurrentDialog(userId, msg.dialog_id)){
    console.log("Message for this dialog");

    dialogsMessages.push(msg);

    // read message if current dialog is on screen
    if (msg.markable === 1 && userId != currentUser.id) {
      sendReadStatus(userId, msg.id, msg.dialog_id);
    }

    // сheck if it's an attachment
    //
    var messageAttachmentFileId = null;
    if (msg.extension.hasOwnProperty("attachments")) {
      if(msg.extension.attachments.length > 0) {
        messageAttachmentFileId = msg.extension.attachments[0].id;
      }
    }

    showMessage(userId, msg, messageAttachmentFileId);
  }
  // Here we process the regular messages
  //
  updateDialogsList(msg.dialog_id, msg.body);
}
753992
public static SoapAttachment from(Attachment attachment) {
        SoapAttachment soapAttachment = new SoapAttachment();

        String contentId = attachment.getContentId();
        if (contentId.startsWith("<") && contentId.endsWith(">")) {
            contentId = contentId.substring(1, contentId.length() - 1);
        }
        soapAttachment.setContentId(contentId);
        soapAttachment.setContentType(attachment.getContentType());

        if (attachment.getContentType().startsWith("text")) {
            try {
                soapAttachment.setContent(FileUtils.readToString(attachment.getInputStream()).trim());
            } catch (IOException e) {
                throw new CitrusRuntimeException("Failed to read SOAP attachment content", e);
            }
        } else {
            // Binary content
            soapAttachment.setDataHandler(attachment.getDataHandler());
        }

        soapAttachment.setCharsetName(Citrus.CITRUS_FILE_ENCODING);

        return soapAttachment;
    }
825808
public boolean handleResponse(MessageContext messageContext) throws WebServiceClientException {
        try {
            logResponse("Received SOAP response", messageContext, true);
        } catch (SoapEnvelopeException e) {
            log.warn("Unable to write SOAP response to logger", e);
        } catch (TransformerException e) {
            log.warn("Unable to write SOAP response to logger", e);
        }
        
        return true;
    }
557429
private void parseSoap12Fault(Document soapMessage, PrintWriter logger)
            throws Exception {
        Element envelope = soapMessage.getDocumentElement();
        Element code = DomUtils.getElementByTagNameNS(envelope,
                SOAP_12_NAMESPACE, "Code");
        String value = DomUtils.getElementByTagNameNS(code, SOAP_12_NAMESPACE,
                "Value").getTextContent();
        String msg = "SOAP Fault received - [code:" + value + "]";
        Element subCode = DomUtils.getElementByTagNameNS(code,
                SOAP_12_NAMESPACE, "Subcode");
        if (subCode != null) {
            value = DomUtils.getElementByTagNameNS(subCode, SOAP_12_NAMESPACE,
                    "Value").getTextContent();
            msg += "[subcode:" + value + "]";
        }
        Element reason = DomUtils.getElementByTagNameNS(envelope,
                SOAP_12_NAMESPACE, "Reason");
        Element text = DomUtils.getElementByTagNameNS(reason,
                SOAP_12_NAMESPACE, "Text");
        if (text != null) {
            value = text.getTextContent();
            msg += "[reason:" + value + "]";
        }

        logger.println(msg);
    }
685171
@Override
    public Object handle(Message msg) throws Exception {
        if(req_handler != null)
            return req_handler.handle(msg);
        return null;
    }