Class CommonsHTTPSender

  • All Implemented Interfaces:
    java.io.Serializable, Handler

    public class CommonsHTTPSender
    extends BasicHandler
    This class uses Jakarta Commons's HttpClient to call a SOAP server.
    Author:
    Davanum Srinivas (dims@yahoo.com) History: By Chandra Talluri Modifications done for maintaining sessions. Cookies needed to be set on HttpState not on MessageContext, since ttpMethodBase overwrites the cookies from HttpState. Also we need to setCookiePolicy on HttpState to CookiePolicy.COMPATIBILITY else it is defaulting to RFC2109Spec and adding Version information to it and tomcat server not recognizing it
    See Also:
    Serialized Form
    • Field Detail

      • log

        protected static org.apache.commons.logging.Log log
        Field log
      • connectionManager

        protected org.apache.commons.httpclient.HttpConnectionManager connectionManager
    • Constructor Detail

      • CommonsHTTPSender

        public CommonsHTTPSender()
    • Method Detail

      • initialize

        protected void initialize()
      • invoke

        public void invoke​(MessageContext msgContext)
                    throws AxisFault
        invoke creates a socket connection, sends the request SOAP message and then reads the response SOAP message back from the SOAP server
        Parameters:
        msgContext - the messsage context
        Throws:
        AxisFault
      • handleCookie

        public void handleCookie​(java.lang.String cookieName,
                                 java.lang.String cookie,
                                 MessageContext msgContext)
        little helper function for cookies. fills up the message context with a string or an array of strings (if there are more than one Set-Cookie)
        Parameters:
        cookieName -
        setCookieName -
        cookie -
        msgContext -
      • getHostConfiguration

        protected org.apache.commons.httpclient.HostConfiguration getHostConfiguration​(org.apache.commons.httpclient.HttpClient client,
                                                                                       MessageContext context,
                                                                                       java.net.URL targetURL)
      • isHostInNonProxyList

        protected boolean isHostInNonProxyList​(java.lang.String host,
                                               java.lang.String nonProxyHosts)
        Check if the specified host is in the list of non proxy hosts.
        Parameters:
        host - host name
        nonProxyHosts - string containing the list of non proxy hosts
        Returns:
        true/false
      • match

        protected static boolean match​(java.lang.String pattern,
                                       java.lang.String str,
                                       boolean isCaseSensitive)
        Matches a string against a pattern. The pattern contains two special characters: '*' which means zero or more characters,
        Parameters:
        pattern - the (non-null) pattern to match against
        str - the (non-null) string that must be matched against the pattern
        isCaseSensitive -
        Returns:
        true when the string matches against the pattern, false otherwise.