Class BuilderUtil


  • public class BuilderUtil
    extends Object
    • Constructor Detail

      • BuilderUtil

        public BuilderUtil()
    • Method Detail

      • createPOXBuilder

        public static OMXMLParserWrapper createPOXBuilder​(InputStream in,
                                                          String encoding)
        Create a builder suitable for an XML message. This method uses StAXParserConfiguration.SOAP to disallow document type declarations (that potentially reference external entities).
        Parameters:
        in - the input stream containing the plain XML message
        encoding - the charset encoding of the message or null if the parser should determine the charset encoding
        Returns:
        the builder
      • getReader

        public static Reader getReader​(InputStream is,
                                       String charSetEncoding)
                                throws IOException
        Deprecated.
        Instead of using this method, you should probably pass the InputStream directly to the XML parser. If the stream is not XML, you shouldn't be using this method anyway.
        Throws:
        IOException
      • getCharSetEncoding

        public static String getCharSetEncoding​(PushbackInputStream is2,
                                                String defaultEncoding)
                                         throws IOException
        Deprecated.
        It's the role of the XML parser to determine the charset encoding and/or byte order using the algorithm described in the "Autodetection of Character Encodings" appendix of the XML spec. If you need this method, then something is wrong: probably you are using a Reader where you should use an InputStream.
        Throws:
        IOException
      • getEnvelopeNamespace

        public static String getEnvelopeNamespace​(String contentType)
      • getCharSetEncoding

        public static String getCharSetEncoding​(String contentType)
        Extracts and returns the character set encoding from the Content-type header

        Example: "Content-Type: text/xml; charset=utf-8" would return "utf-8"

        Parameters:
        contentType - a content-type (from HTTP or MIME, for instance)
        Returns:
        the character set encoding if found, or MessageContext.DEFAULT_CHAR_SET_ENCODING
      • isAttachmentsCacheEnabled

        public static boolean isAttachmentsCacheEnabled​(MessageContext msgContext)
      • createSOAPModelBuilder

        public static SOAPModelBuilder createSOAPModelBuilder​(InputStream in,
                                                              String encoding)
        Create a SOAP model builder. This method delegates to OMXMLBuilderFactory.createSOAPModelBuilder(InputStream, String) but generates additional logging if an error occurs.
        Parameters:
        in - the input stream containing the SOAP message
        encoding - the charset encoding of the SOAP message or null if the parser should determine the charset encoding
        Returns:
        the builder
      • validateSOAPVersion

        public static void validateSOAPVersion​(String soapNamespaceURIFromTransport,
                                               SOAPEnvelope envelope)
      • validateCharSetEncoding

        public static void validateCharSetEncoding​(String charsetEncodingFromTransport,
                                                   String charsetEncodingFromXML,
                                                   String soapNamespaceURI)
                                            throws AxisFault
        Throws:
        AxisFault