Class PayloadUtils


  • public final class PayloadUtils
    extends Object
    Utils for setting content as the message payload in the message context
    • Method Detail

      • setContent

        public static void setContent​(org.apache.axis2.context.MessageContext messageContext,
                                      InputStream inputStream,
                                      String contentType)
                               throws ContentBuilderException
        Builds content according to the content type and set in the message body
        Parameters:
        messageContext - Axis2 Message Context
        inputStream - Content to be built as an input stream
        contentType - Content Type of the content to be set in the payload
        Throws:
        ContentBuilderException - if failed to build the content
      • handleSpecialProperties

        public static void handleSpecialProperties​(String contentType,
                                                   org.apache.axis2.context.MessageContext axis2MessageCtx)
        Changes the content type and handles other headers
        Parameters:
        contentType - ContentType to be set in header
        axis2MessageCtx - Axis2 Message Context
      • preparePayload

        public static void preparePayload​(org.apache.axis2.context.MessageContext messageContext,
                                          String xmlString)
                                   throws ContentBuilderException
        Converts the XML String to XML Element and sets in message context
        Parameters:
        messageContext - Axis2 Message Context
        xmlString - XML String to be set in the body
        Throws:
        ContentBuilderException
      • setPayloadInEnvelope

        public static void setPayloadInEnvelope​(org.apache.axis2.context.MessageContext axis2MsgCtx,
                                                org.apache.axiom.om.OMElement payload)
                                         throws ContentBuilderException
        Sets the OMElement in the message context
        Parameters:
        axis2MsgCtx - Axis2 Message Context
        payload - OMElement to be set in the body
        Throws:
        ContentBuilderException - if failed to set payload