
=Pc           @   s  d  Z  d d k Z d d k i Z d d k l Z d d k Td d k l Z l Z d d k	 l
 Z
 d d k l Z d d k l Z d d	 k l Z d d
 k l Z d d k l Z d d k l Z d d k l Z d d k l Z d d k l Z d d k l Z d d k l Z d d k l  Z  d d k! l! Z! d d k" l# Z# d d k$ l% Z% e% e&  Z' d e( f d     YZ) d d& d     YZ d d' d     YZ* d d( d     YZ+ d d) d     YZ, d  d* d!     YZ- d" d+ d#     YZ. d$ e. f d%     YZ/ d S(,   sX   
The I{2nd generation} service proxy provides access to web services.
See I{README.txt}
iN(   t	   CookieJar(   t   *(   t   TransportErrort   Request(   t   HttpAuthenticated(   t	   FileCache(   t   ServiceDefinition(   t
   sudsobject(   t   Factory(   t   Object(   t   PathResolver(   t   Builder(   t   Definitions(   t   Document(   t   Parser(   t   Options(   t   Unskin(   t   urlparse(   t   deepcopy(   t	   getLoggert   Clientc           B   s   e  Z d  Z e d    Z e d    Z e d    Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z d   Z RS(   s   
    A lightweight web services client.
    I{(2nd generation)} API.
    @ivar wsdl: The WSDL object.
    @type wsdl:L{Definitions}
    @ivar service: The service proxy used to invoke operations.
    @type service: L{Service}
    @ivar factory: The factory used to create objects.
    @type factory: L{Factory}
    @ivar sd: The service definition
    @type sd: L{ServiceDefinition}
    @ivar messages: The last sent/received messages.
    @type messages: str[2]
    c         C   s   t  i |  S(   s  
        Extract the I{items} from a suds object much like the
        items() method works on I{dict}.
        @param sobject: A suds object
        @type sobject: L{Object}
        @return: A list of items contained in I{sobject}.
        @rtype: [(key, value),...]
        (   R   t   items(   t   clst   sobject(    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR   >   s    
c         C   s   t  i |  S(   s   
        Convert a sudsobject into a dictionary.
        @param sobject: A suds object
        @type sobject: L{Object}
        @return: A python dictionary containing the
            items contained in I{sobject}.
        @rtype: dict
        (   R   t   asdict(   R   R   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt   dictJ   s    
c         C   s   | i  S(   s   
        Extract the metadata from a suds object.
        @param sobject: A suds object
        @type sobject: L{Object}
        @return: The object's metadata
        @rtype: L{sudsobject.Metadata}
        (   t   __metadata__(   R   R   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt   metadataV   s    	c         K   s   t    } t   | _ | |  _ t d d  | _ |  i |   t | |  |  _ t	 |  i  |  _
 t |  |  i i  |  _ g  |  _ x6 |  i i D]( } t |  i |  } |  i i |  q Wt d d d d  |  _ d S(   s   
        @param url: The URL for the WSDL.
        @type url: str
        @param kwargs: keyword arguments.
        @see: L{Options}
        t   daysi   t   txt   rxN(   R   R   t	   transportt   optionsR   t   cachet   set_optionsR   t   wsdlR   t   factoryt   ServiceSelectort   servicest   servicet   sdR   t   appendR   t   Nonet   messages(   t   selft   urlt   kwargsR    t   sR(   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt   __init__a   s    			 c         K   s    t  |  i  } | i |  d S(   sa   
        Set options.
        @param kwargs: keyword arguments.
        @see: L{Options}
        N(   R   R    t   update(   R,   R.   t   p(    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR"   v   s    c         C   so   |  i  i } | i | d  } | d j o | i | |  d S| d | j o t d | | f   n d S(   s  
        Add I{static} mapping of an XML namespace prefix to a namespace.
        This is useful for cases when a wsdl and referenced schemas make heavy
        use of namespaces and those namespaces are subject to changed.
        @param prefix: An XML namespace prefix.
        @type prefix: str
        @param uri: An XML namespace URI.
        @type uri: str
        @raise Exception: when prefix is already mapped.
        Ni   s   "%s" already mapped as "%s"(   R#   t   roott   resolvePrefixR*   t	   addPrefixt	   Exception(   R,   t   prefixt   uriR3   t   mapped(    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt
   add_prefix   s    c         C   s   |  i  i d  S(   s|   
        Get last sent I{soap} message.
        @return: The last sent I{soap} message.
        @rtype: L{Document}
        R   (   R+   t   get(   R,   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt	   last_sent   s    c         C   s   |  i  i d  S(   s   
        Get last received I{soap} message.
        @return: The last received I{soap} message.
        @rtype: L{Document}
        R   (   R+   R;   (   R,   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt   last_received   s    c         C   s   d t  f d     Y} |   } t   | _ t | i  } t |  i  } | i t |   |  i | _ |  i | _ t | |  i i	  | _
 |  i | _ | S(   s   
        Get a shallow clone of this object.
        @note: THIS METHOD NOT YET WORKING CORRECTLY OR SUPPORTED !!
        @return: A shallow clone.
        @rtype: L{Client}
        t   Uninitializedc           B   s   e  Z d    Z RS(   c         S   s   d  S(   N(    (   R,   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR0      s    (   t   __name__t
   __module__R0   (    (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR>      s   (   R   R   R    R   R1   R   R#   R$   R%   R&   R'   R(   (   R,   R>   t   clonet   cpt   mp(    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyRA      s    	c         C   s
   t  |   S(   N(   t   unicode(   R,   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt   __str__   s    c         C   s   d g } t  i i   } | i d  | i d t  i  | i d | d | d f  x( |  i D] } | i d t |   qb Wd i |  S(	   Ns   
s'   Suds ( https://fedorahosted.org/suds/ )s     version: %ss    %s  build: %si    i   s   

%st    (   t   sudst	   __build__t   splitR)   t   __version__R(   RD   t   join(   R,   R/   t   buildR(   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt   __unicode__   s    	
 (   R?   R@   t   __doc__t   classmethodR   R   R   R0   R"   R:   R<   R=   RA   RE   RM   (    (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR   /   s   								R   c           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   s   
    A factory for instantiating types defined in the wsdl
    @ivar resolver: A schema type resolver.
    @type resolver: L{PathResolver}
    @ivar builder: A schema object builder.
    @type builder: L{Builder}
    c         C   s.   | |  _  t |  |  _ t |  i  |  _ d S(   sW   
        @param wsdl: A schema object.
        @type wsdl: L{wsdl.Definitions}
        N(   R#   R
   t   resolverR   t   builder(   R,   R#   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR0      s    	c         C   s  t  i   } | i   |  i i |  } | d j o t |   n | i   oF t i	 |  } x | i
   D]" \ } } t | | i | i  qn WnT y |  i i |  } Wn: t j
 o. } t i d | d t t | |   n X| i   t  i i d | |  | S(   s   
        create a WSDL type by name
        @param name: The name of a type defined in the WSDL.
        @type name: str
        @return: The requested object.
        @rtype: L{Object}
        s   create '%s' failedt   exc_infos   %s created: %sN(   t   metricst   Timert   startRP   t   findR*   t   TypeNotFoundt   enumt   InstFactoryt   objectt   childrent   setattrt   nameRQ   RL   R6   t   logt   errort   Truet
   BuildErrort   stopt   debug(   R,   R]   t   timert   typet   resultt   et   a(    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt   create   s$    
 
c         C   s   t  |  i |  |  _ d S(   sk   
        Set the path separator.
        @param ps: The new path separator.
        @type ps: char
        N(   R
   R#   RP   (   R,   t   ps(    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt	   separator   s    (   R?   R@   RN   R0   Ri   Rk   (    (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR      s   			R%   c           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   s  
    The B{service} selector is used to select a web service.
    In most cases, the wsdl only defines (1) service in which access
    by subscript is passed through to a L{PortSelector}.  This is also the
    behavior when a I{default} service has been specified.  In cases
    where multiple services have been defined and no default has been
    specified, the service is found by name (or index) and a L{PortSelector}
    for the service is returned.  In all cases, attribute access is
    forwarded to the L{PortSelector} for either the I{first} service or the
    I{default} service (when specified).
    @ivar __client: A suds client.
    @type __client: L{Client}
    @ivar __services: A list of I{wsdl} services.
    @type __services: list
    c         C   s   | |  _  | |  _ d S(   s   
        @param client: A suds client.
        @type client: L{Client}
        @param services: A list of I{wsdl} services.
        @type services: list
        N(   t   _ServiceSelector__clientt   _ServiceSelector__services(   R,   t   clientR&   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR0     s    	c         C   s?   |  i    } | d j o |  i d  } n | } t | |  S(   s9  
        Request to access an attribute is forwarded to the
        L{PortSelector} for either the I{first} service or the
        I{default} service (when specified).
        @param name: The name of a method.
        @type name: str
        @return: A L{PortSelector}.
        @rtype: L{PortSelector}. 
        i    N(   t   _ServiceSelector__dsR*   t   _ServiceSelector__findt   getattr(   R,   R]   t   defaultt   port(    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt   __getattr__  s
    
c         C   sc   t  |  i  d j o |  i d  } | | S|  i   } | d j	 o | } | | S|  i |  S(   s  
        Provides selection of the I{service} by name (string) or 
        index (integer).  In cases where only (1) service is defined
        or a I{default} has been specified, the request is forwarded
        to the L{PortSelector}.
        @param name: The name (or index) of a service.
        @type name: (int|str)
        @return: A L{PortSelector} for the specified service.
        @rtype: L{PortSelector}. 
        i   i    N(   t   lenRm   Rp   Ro   R*   (   R,   R]   Rs   Rr   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt   __getitem__&  s    		c         C   s   d } t |  i  p t d  n t | t  oA y |  i | } | i } Wq t j
 o t d |  q Xn0 x, |  i D]! } | | i j o | } Pq~ q~ W| d j o t |  n t	 |  i
 | i |  S(   s   
        Find a I{service} by name (string) or index (integer).
        @param name: The name (or index) of a service.
        @type name: (int|str)
        @return: A L{PortSelector} for the found service.
        @rtype: L{PortSelector}. 
        s   No services defineds   at [%d]N(   R*   Ru   Rm   R6   t
   isinstancet   intR]   t
   IndexErrort   ServiceNotFoundt   PortSelectorRl   t   ports(   R,   R]   R'   R/   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt   __find:  s"    
 	c         C   s2   |  i  i i } | d j o d S|  i |  Sd S(   s   
        Get the I{default} service if defined in the I{options}.
        @return: A L{PortSelector} for the I{default} service.
        @rtype: L{PortSelector}. 
        N(   Rl   R    R'   R*   Rp   (   R,   t   ds(    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt   __dsT  s    (   R?   R@   RN   R0   Rt   Rv   Rp   Ro   (    (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR%      s   	
			R{   c           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   sv  
    The B{port} selector is used to select a I{web service} B{port}.
    In cases where multiple ports have been defined and no default has been
    specified, the port is found by name (or index) and a L{MethodSelector}
    for the port is returned.  In all cases, attribute access is
    forwarded to the L{MethodSelector} for either the I{first} port or the
    I{default} port (when specified).
    @ivar __client: A suds client.
    @type __client: L{Client}
    @ivar __ports: A list of I{service} ports.
    @type __ports: list
    @ivar __qn: The I{qualified} name of the port (used for logging).
    @type __qn: str
    c         C   s   | |  _  | |  _ | |  _ d S(   s   
        @param client: A suds client.
        @type client: L{Client}
        @param ports: A list of I{service} ports.
        @type ports: list
        @param qn: The name of the service.
        @type qn: str
        N(   t   _PortSelector__clientt   _PortSelector__portst   _PortSelector__qn(   R,   Rn   R|   t   qn(    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR0   p  s    			c         C   s?   |  i    } | d j o |  i d  } n | } t | |  S(   s9  
        Request to access an attribute is forwarded to the
        L{MethodSelector} for either the I{first} port or the
        I{default} port (when specified).
        @param name: The name of a method.
        @type name: str
        @return: A L{MethodSelector}.
        @rtype: L{MethodSelector}. 
        i    N(   t   _PortSelector__dpR*   t   _PortSelector__findRq   (   R,   R]   Rr   t   m(    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyRt   }  s
    
c         C   s/   |  i    } | d j o |  i |  S| Sd S(   s  
        Provides selection of the I{port} by name (string) or 
        index (integer).  In cases where only (1) port is defined
        or a I{default} has been specified, the request is forwarded
        to the L{MethodSelector}.
        @param name: The name (or index) of a port.
        @type name: (int|str)
        @return: A L{MethodSelector} for the specified port.
        @rtype: L{MethodSelector}. 
        N(   R   R*   R   (   R,   R]   Rr   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyRv     s    c         C   s  d } t |  i  p t d |  i  n t | t  oG d |  i | f } y |  i | } Wq t j
 o t |  q XnH d i	 |  i | f  } x, |  i D]! } | | i
 j o | } Pq q W| d j o t |  n d i	 |  i | i
 f  } t |  i | i |  S(   s   
        Find a I{port} by name (string) or index (integer).
        @param name: The name (or index) of a port.
        @type name: (int|str)
        @return: A L{MethodSelector} for the found port.
        @rtype: L{MethodSelector}. 
        s   No ports defined: %ss   %s[%d]t   .N(   R*   Ru   R   R6   R   Rw   Rx   Ry   t   PortNotFoundRK   R]   t   MethodSelectorR   t   methods(   R,   R]   Rs   R   R2   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR}     s&    
 	c         C   s2   |  i  i i } | d j o d S|  i |  Sd S(   s   
        Get the I{default} port if defined in the I{options}.
        @return: A L{MethodSelector} for the I{default} port.
        @rtype: L{MethodSelector}. 
        N(   R   R    Rs   R*   R   (   R,   t   dp(    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt   __dp  s    (   R?   R@   RN   R0   Rt   Rv   R   R   (    (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR{   a  s   				R   c           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   s,  
    The B{method} selector is used to select a B{method} by name.
    @ivar __client: A suds client.
    @type __client: L{Client}
    @ivar __methods: A dictionary of methods.
    @type __methods: dict
    @ivar __qn: The I{qualified} name of the method (used for logging).
    @type __qn: str
    c         C   s   | |  _  | |  _ | |  _ d S(   s   
        @param client: A suds client.
        @type client: L{Client}
        @param methods: A dictionary of methods.
        @type methods: dict
        @param qn: The I{qualified} name of the port.
        @type qn: str
        N(   t   _MethodSelector__clientt   _MethodSelector__methodst   _MethodSelector__qn(   R,   Rn   R   R   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR0     s    			c         C   s   |  | S(   s   
        Get a method by name and return it in an I{execution wrapper}.
        @param name: The name of a method.
        @type name: str
        @return: An I{execution wrapper} for the specified method name.
        @rtype: L{Method}
        (    (   R,   R]   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyRt     s    c         C   sT   |  i  i |  } | d j o% d i |  i | f  } t |  n t |  i |  S(   s   
        Get a method by name and return it in an I{execution wrapper}.
        @param name: The name of a method.
        @type name: str
        @return: An I{execution wrapper} for the specified method name.
        @rtype: L{Method}
        R   N(   R   R;   R*   RK   R   t   MethodNotFoundt   MethodR   (   R,   R]   R   R   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyRv     s
    (   R?   R@   RN   R0   Rt   Rv   (    (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR     s   			
R   c           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   s   
    The I{method} (namespace) object.
    @ivar client: A client object.
    @type client: L{Client}
    @ivar method: A I{wsdl} method.
    @type I{wsdl} Method.
    c         C   s   | |  _  | |  _ d S(   s   
        @param client: A client object.
        @type client: L{Client}
        @param method: A I{raw} method.
        @type I{raw} Method.
        N(   Rn   t   method(   R,   Rn   R   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR0     s    	c         O   s|   |  i  |  } | |  i |  i  } |  i   p7 y | i | |  SWqx t j
 o } d | f SXn | i | |  Sd S(   s$   
        Invoke the method.
        i  N(   t   clientclassRn   R   t   faultst   invoket   WebFault(   R,   t   argsR.   R   Rn   Rg   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt   __call__  s    c         C   s   |  i  i i S(   s    get faults option (   Rn   R    R   (   R,   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR     s    c         C   s   t  i |  o t  St Sd S(   s    get soap client class N(   t	   SimClientt
   simulationt
   SoapClient(   R,   R.   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR     s    (   R?   R@   RN   R0   R   R   R   (    (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR     s
   	
		R   c           B   se   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d
 d  Z d
 d	  Z RS(   sb  
    A lightweight soap based web client B{**not intended for external use}
    @ivar service: The target method.
    @type service: L{Service}
    @ivar method: A target method.
    @type method: L{Method}
    @ivar options: A dictonary of options.
    @type options: dict
    @ivar cookiejar: A cookie jar.
    @type cookiejar: libcookie.CookieJar
    c         C   s.   | |  _  | |  _ | i |  _ t   |  _ d S(   s   
        @param client: A suds client.
        @type client: L{Client}
        @param method: A target method.
        @type method: L{Method}
        N(   Rn   R   R    R    t	   cookiejar(   R,   Rn   R   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR0   2  s    		c         C   s   t  i   } | i   d } |  i i i } |  i | _ | i |  i | |  } | i	   t  i
 i d |  i i |  | i   |  i |  } | i	   t  i
 i d |  i i |  | S(   sm  
        Send the required soap message to invoke the specified method
        @param args: A list of args for the method invoked.
        @type args: list
        @param kwargs: Named (keyword) args for the method invoked.
        @type kwargs: dict
        @return: The result of the method invocation.
        @rtype: I{builtin}|I{subclass of} L{Object}
        s   message for '%s' created: %ss   method '%s' invoked: %sN(   RS   RT   RU   R*   R   t   bindingt   inputR    t   get_messageRb   R^   Rc   R]   t   send(   R,   R   R.   Rd   Rf   R   t   msg(    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR   >  s"    


	

	c   
      C   s  d } |  i   } |  i i i } |  i i } |  i i } t i	 d | |  ys |  i
 t |   t | t |   } |  i   | _ | i |  } | o | i } n |  i | | i  } WnT t j
 oH }	 |	 i d j o
 d } qt i |  i
    |  i | |	  } n X| S(   s   
        Send soap message.
        @param msg: A soap message to send.
        @type msg: basestring
        @return: The reply to the sent message.
        @rtype: I{builtin} or I{subclass of} L{Object}
        s   sending to (%s)
message:
%si   i   N(   i   i   (   R*   t   locationR   R   R   R    R   t   retxmlR^   Rc   R<   R   R   t   strt   headersR   t   messaget	   succeededR   t   httpcodeR_   t   failed(
   R,   R   Rf   R   R   R   R   t   requestt   replyRg   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR   Z  s(    
c         C   sL   |  i  i i } h d d 6| d 6} t | |  i i  } t i d |  | S(   s   
        Get http headers or the http/https request.
        @return: A dictionary of header/values.
        @rtype: dict
        s   text/xmls   Content-Typet
   SOAPActions   headers = %s(   R   t   soapt   actionR   R    R   R^   Rc   (   R,   R   t   stockRf   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR   y  s
    c         C   s   t  i d |  t |  d j oH | i |  i |  \ } } |  i |  |  i i o | Sd | f Sn |  i i o d Sd Sd S(   s  
        Request succeeded, process the reply
        @param binding: The binding to be used to process the reply.
        @type binding: L{bindings.binding.Binding}
        @return: The method result.
        @rtype: I{builtin}, L{Object}
        @raise WebFault: On server.
        s   http succeeded:
%si    i   N(   i   N(	   R^   Rc   Ru   t	   get_replyR   R=   R    R   R*   (   R,   R   R   t   rR2   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR     s    	c         C   s   | i  t |  } } | i i   } t i d |  | d j oN t |  d j o- | i |  \ } } |  i |  | | f S| d f Sn |  i
 i o t | | f   n | d f Sd S(   s  
        Request failed, process reply based on reason
        @param binding: The binding to be used to process the reply.
        @type binding: L{suds.bindings.binding.Binding}
        @param error: The http error message
        @type error: L{transport.TransportError}
        s   http failed:
%si  i    N(   R   t   tostrt   fpt   readR^   Rc   Ru   t	   get_faultR=   R*   R    R   R6   (   R,   R   R_   t   statust   reasonR   R   R2   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR     s    c         C   s%   t  |  i  } | i d |  i i  S(   NR   (   R   R    R;   R   R   (   R,   R2   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR     s    c         C   s;   d } |  i  i } | d  j o | i |  S| | | <d  S(   NR   (   Rn   R+   R*   R;   (   R,   t   dt   keyR+   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR<     s
    c         C   s;   d } |  i  i } | d  j o | i |  S| | | <d  S(   NR   (   Rn   R+   R*   R;   (   R,   R   R   R+   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR=     s
    N(   R?   R@   RN   R0   R   R   R   R   R   R   R*   R<   R=   (    (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR   %  s   							R   c           B   s>   e  Z d  Z d Z e d    Z d   Z d   Z d   Z RS(   s<   
    Loopback client used for message/reply simulation.
    t   __injectc         C   s   | i  t i  S(   s;    get whether loopback has been specified in the I{kwargs}. (   t   has_keyR   t   injkey(   R   R.   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR     s    c         C   s   | |  i  } | i d  } | i d  } | i d  } | d j oL | d j	 o |  i | | |  S| d j	 o |  i |  St d   n t   i d |  } |  i |  S(   sp  
        Send the required soap message to invoke the specified method
        @param args: A list of args for the method invoked.
        @type args: list
        @param kwargs: Named (keyword) args for the method invoked.
        @type kwargs: dict
        @return: The result of the method invocation.
        @rtype: I{builtin} or I{subclass of} L{Object}
        R   R   t   faults$   (reply|fault) expected when msg=Nonet   stringN(	   R   R;   R*   t   _SimClient__replyt   _SimClient__faultR6   R   t   parseR   (   R,   R   R.   R   R   R   R   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR     s    
c         C   sn   |  i  i i } |  i | _ | i |  i  | |  } t i d |  |  i  i i } |  i | _ |  i | |  S(   s    simulate the reply s#   inject (simulated) send message:
%s(	   R   R   R   R    R   R^   Rc   t   outputR   (   R,   R   R   R.   R   R   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt   __reply  s    c         C   s]   |  i  i i } |  i | _ |  i i o- | i |  \ } } |  i |  d | f Sd Sd S(   s    simulate the (fault) reply i  N(   i  N(   R   R   R   R    R   R   R=   R*   (   R,   R   R   R   R2   (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt   __fault  s    (	   R?   R@   RN   R   RO   R   R   R   R   (    (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyR     s   		
(    (    (    (    (    (    (0   RN   RG   t   suds.metricsRS   t	   cookielibR    t   suds.transportR   R   t   suds.transport.httpsR   t   suds.transport.cacheR   t   suds.servicedefinitionR   R   R   RY   R	   t   suds.resolverR
   t   suds.builderR   t	   suds.wsdlR   t   suds.sax.documentR   t   suds.sax.parserR   t   suds.optionsR   t   suds.propertiesR   R   t   copyR   t   loggingR   R?   R^   RZ   R   R%   R{   R   R   R   R   (    (    (    sJ   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.pyt   <module>   s<   
6fg0-