ó
21ŽLc           @   s#  d  Z  d d l m Z d d l Td d l m Z d d l m Z d d l m	 Z	 d d l
 m Z m Z d d l m Z m Z d d	 l m Z m Z d d
 l m Z d d l m Z m Z m Z d d l m Z m Z d d l m Z d d l Z d d l Z e e  ƒ Z! d* Z# d+ Z$ d, Z% d e f d „  ƒ  YZ& d e& f d „  ƒ  YZ' d e& f d „  ƒ  YZ( d e& f d „  ƒ  YZ) d e& f d „  ƒ  YZ* d e' f d „  ƒ  YZ+ d e' f d „  ƒ  YZ, d  e' f d! „  ƒ  YZ- d" e' f d# „  ƒ  YZ. d$ e' f d% „  ƒ  YZ/ d& e' f d' „  ƒ  YZ0 d( d- d) „  ƒ  YZ1 d S(.   sš   
The I{wsdl} module provides an objectification of the WSDL.
The primary class is I{Definitions} as it represends the root element
found in the document.
iÿÿÿÿ(   t	   getLogger(   t   *(   t   splitPrefix(   t   Element(   t   Document(   t   RPCt   Encoded(   t   qualifyt	   Namespace(   t   Schemat   SchemaCollection(   t   ElementQuery(   t   Objectt   Facadet   Metadata(   t   DocumentReadert   DefinitionsReader(   t   urljoinNs    http://schemas.xmlsoap.org/wsdl/s%   http://schemas.xmlsoap.org/wsdl/soap/s'   http://schemas.xmlsoap.org/wsdl/soap12/t   WObjectc           B   s#   e  Z d  Z d d „ Z d „  Z RS(   si   
    Base object for wsdl types.
    @ivar root: The XML I{root} element.
    @type root: L{Element}
    c         C   sM   t  j |  ƒ | |  _ t ƒ  } d g | _ t d t ƒ | _ | |  j _	 d S(   s®   
        @param root: An XML root element.
        @type root: L{Element}
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        t   roott   qnameN(
   R   t   __init__R   R   t   excludest   dictt   reprt   wrapperst   __metadata__t	   __print__(   t   selfR   t   definitionst   pmd(    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR   3   s    		c         C   s   d S(   s�   
        Resolve named references to other WSDL objects.
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        N(    (   R   R   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyt   resolveA   s    N(   t   __name__t
   __module__t   __doc__t   NoneR   R   (    (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR   ,   s   t   NamedObjectc           B   s   e  Z d  Z d „  Z RS(   s¾   
    A B{named} WSDL object.
    @ivar name: The name of the object.
    @type name: str
    @ivar qname: The I{qualified} name of the object.
    @type qname: (name, I{namespace-uri}).
    c         C   s[   t  j |  | | ƒ | j d ƒ |  _ |  j | j d f |  _ |  j j } t | j	 d <d S(   s®   
        @param root: An XML root element.
        @type root: L{Element}
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        t   namei   R   N(
   R   R   t   getR%   t   tnsR   R   R   R   R   (   R   R   R   R   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR   S   s
    (   R    R!   R"   R   (    (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR$   J   s   t   Definitionsc           B   sn   e  Z d  Z d Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z RS(   s  
    Represents the I{root} container of the WSDL objects as defined
    by <wsdl:definitions/>
    @ivar id: The object id.
    @type id: str
    @ivar options: An options dictionary.
    @type options: L{options.Options}
    @ivar url: The URL used to load the object.
    @type url: str
    @ivar tns: The target namespace for the WSDL.
    @type tns: str
    @ivar schema: The collective WSDL schema object.
    @type schema: L{SchemaCollection}
    @ivar children: The raw list of child objects.
    @type children: [L{WObject},...]
    @ivar imports: The list of L{Import} children.
    @type imports: [L{Import},...]
    @ivar messages: The dictionary of L{Message} children key'd by I{qname}
    @type messages: [L{Message},...]
    @ivar port_types: The dictionary of L{PortType} children key'd by I{qname}
    @type port_types: [L{PortType},...]
    @ivar bindings: The dictionary of L{Binding} children key'd by I{qname}
    @type bindings: [L{Binding},...]
    @ivar service: The service object.
    @type service: L{Service}
    R   c         C   sx  t  j d | ƒ t | ƒ } | j | ƒ } | j ƒ  } t j |  | ƒ t |  ƒ |  _ | |  _	 | |  _
 |  j | ƒ |  _ g  |  _ d |  _ g  |  _ g  |  _ i  |  _ i  |  _ i  |  _ g  |  _ |  j |  j ƒ |  j j ƒ  |  j j } | j j d ƒ | j j d ƒ t | j d <|  j ƒ  |  j ƒ  |  j  ƒ  |  j! ƒ  x |  j D] } |  j" | ƒ qJWt  j d | |  ƒ d S(   s    
        @param url: A URL to the WSDL.
        @type url: str
        @param options: An options dictionary.
        @type options: L{options.Options}
        s   reading wsdl at: %s ...t   childrent   wsdlt   schemas   wsdl at '%s' loaded:
%sN(#   t   logt   debugR   t   openR   R   R   t   objidt   idt   optionst   urlt   mktnsR'   t   typesR#   R+   R)   t   importst   messagest
   port_typest   bindingst   servicest   add_childrent   sortR   R   R   t   appendR   R   t   open_importsR   t   build_schemat   set_wrappedt   add_methods(   R   R2   R1   t   readert   dR   R   t   s(    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR      s<    										



c         C   sM   | j  d ƒ } | j | ƒ } | d k rC t j d | ƒ d } n  | | f S(   s!    Get/create the target namespace t   targetNamespaces'   warning: tns (%s), not mapped to prefixR'   N(   R&   t
   findPrefixR#   R,   R-   (   R   R   R'   t   prefix(    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR3   ¥   s    	c         C   s3  x,| j  d t ƒ D]} t j | |  ƒ } | d k r= q n  |  j j | ƒ t | t ƒ rr |  j	 j | ƒ q n  t | t
 ƒ r— |  j j | ƒ q n  t | t ƒ r¼ | |  j | j <q n  t | t ƒ rá | |  j | j <q n  t | t ƒ r| |  j | j <q n  t | t ƒ r |  j j | ƒ q q q Wd S(   s%    Add child objects using the factory t   nsN(   t   getChildrent   wsdlnst   Factoryt   createR#   R)   R<   t
   isinstancet   ImportR5   t   TypesR4   t   MessageR6   R   t   PortTypeR7   t   BindingR8   t   ServiceR9   (   R   R   t   ct   child(    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR:   ®   s.     c         C   s%   x |  j  D] } | j |  ƒ q
 Wd S(   s    Import the I{imported} WSDLs. N(   R5   t   load(   R   t   imp(    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR=   Ç   s    c         C   s%   x |  j  D] } | j |  ƒ q
 Wd S(   s)    Tell all children to resolve themselves N(   R)   R   (   R   RS   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR   Ì   s    c         C   s/  t  |  ƒ } xo g  |  j D] } | j ƒ  r | ^ q D]E } x< | j ƒ  D]. } t | |  j |  j | ƒ } | j | ƒ qH Wq5 Wt | ƒ sÊ t	 j
 |  j d ƒ } t | |  j |  j | ƒ } | j | ƒ n  | j |  j ƒ |  _ xF g  |  j D] } | j ƒ  rì | j ƒ  ^ qì D] } |  j j | ƒ qW|  j S(   s;    Process L{Types} objects and create the schema collection s   types/schema(   R
   R4   t   localt   contentsR	   R2   R1   t   addt   lenR   t	   buildPathR   RU   R+   t   importedt   merge(   R   t	   containert   tR   R+   RC   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR>   Ñ   s    /5c         C   su  i t  |  ƒ d 6t |  ƒ d 6t |  ƒ d 6} xA| j D]6} | j } | j j } | j j j j ƒ  } xg  | D] } | j ^ qq D]å } t	 d ƒ }	 | |	 _ | j
 |	 _
 t	 d ƒ |	 _ | j | ƒ } | j |	 _ d j | j j | j j j j f ƒ }
 | j |
 ƒ |	 j _ d j | j j | j j j j f ƒ }
 | j |
 ƒ |	 j _ | j | ƒ } |	 | j | <q„ Wq7 Wd S(   s    Build method view for service s   document/literals   rpc/literals   rpc/encodedt   Methodt   bindingt   /N(   R   R   R   t   portsRa   t   typet
   operationst   valuesR%   R   t   locationt	   operationt   soapt   joint   stylet   inputt   bodyt   useR&   t   outputt   methods(   R   t   serviceR8   t   pRa   t   ptypeRe   t   opR%   t   mt   key(    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR@   á   s*    	#	''c         C   s  x|  j  j ƒ  D]ü } xó | j j ƒ  D]â } xÙ | j j j | j j j f D]¹ } t | _ t	 | j
 ƒ d k ru qK n  xŒ | j
 D]� } | j d k rš q n  t | j ƒ } | j |  j ƒ } | d k rÙ t | j ƒ ‚ n  | j ƒ  } | j ƒ  r÷ q n  t | _ q WqK Wq& Wq Wd S(   s%    set (wrapped|bare) flag on messages i   N(   R8   Rf   Re   Ri   Rl   Rm   Ro   t   Falset   wrappedRZ   t   partst   elementR#   R   t   executeR+   t   TypeNotFoundt   refR   t   builtint   True(   R   t   bRt   Rm   Rr   t   queryt   ptt   resolved(    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR?   ú   s"    %	c         C   s@   d } |  j  j ƒ  } x$ | D] } | | k r | | =q q W| S(   NR1   (   s   options(   t   __dict__t   copy(   R   t   nopicklet   statet   k(    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyt   __getstate__  s    c         C   s   d |  j  S(   Ns   Definitions (id=%s)(   R0   (   R   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyt   __repr__  s    (   R    R!   R"   t   TagR   R3   R:   R=   R   R>   R@   R?   R‰   RŠ   (    (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR(   a   s   	&									RM   c           B   s;   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s  
    Represents the <wsdl:import/>.
    @ivar location: The value of the I{location} attribute.
    @type location: str
    @ivar ns: The value of the I{namespace} attribute.
    @type ns: str
    @ivar imported: The imported object.
    @type imported: L{Definitions}
    c         C   s]   t  j |  | | ƒ | j d ƒ |  _ | j d ƒ |  _ d |  _ |  j j } t	 | j
 d <d S(   s®   
        @param root: An XML root element.
        @type root: L{Element}
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        Rg   t	   namespaceR\   N(   R   R   R&   Rg   RG   R#   R\   R   R   R   R   (   R   R   R   R   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR   %  s    	c         C   sÁ   |  j  } t j d | ƒ d | k r: t | j | ƒ } n  | j } t | | ƒ } | j j t j	 t
 ƒ r~ |  j | | ƒ d S| j j t j	 t j ƒ r­ |  j | | ƒ d St d | ƒ ‚ d S(   s$    Load the object by opening the URL s   importing (%s)s   ://Ns   document at "%s" is unknown(   Rg   R,   R-   R   R2   R1   R(   R   t   matchR‹   RI   t   import_definitionsR	   R   t   xsdnst   import_schemat	   Exception(   R   R   R2   R1   RB   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRU   3  s    		c         C   sh   | j  | j  7_  | j j | j ƒ | j j | j ƒ | j j | j ƒ | |  _ t j d | ƒ d S(   s    import/merge wsdl definitions s   imported (WSDL):
%sN(   R4   R6   t   updateR7   R8   R\   R,   R-   (   R   R   RB   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRŽ   C  s    	c         C   sh   t  | j ƒ s1 t j | ƒ } | j j | ƒ n | j d } | j j | j ƒ t j d | j ƒ d S(   s#    import schema as <types/> content iÿÿÿÿs   imported (XSD):
%sN(   RZ   R4   RN   RK   R<   R   R,   R-   (   R   R   RB   R4   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR�   L  s    c         C   s   t  S(   N(   Rw   (   R   t   other(    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyt   __gt__V  s    (   R    R!   R"   R   RU   RŽ   R�   R”   (    (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRM     s   						
RN   c           B   sS   e  Z d  Z e d „  ƒ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(   s.   
    Represents <types><schema/></types>.
    c         C   s/   t  d d t ƒ} | j j | ƒ t | | ƒ S(   NR4   RG   (   R   RI   R   t   insertRN   (   t   clsR   R   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRK   _  s    c         C   s    t  j |  | | ƒ | |  _ d S(   s®   
        @param root: An XML root element.
        @type root: L{Element}
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        N(   R   R   R   (   R   R   R   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR   e  s    c         C   s   |  j  j d t j ƒ S(   NR+   (   R   RH   R   R�   (   R   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRX   o  s    c         C   s
   |  j  j S(   N(   R   R+   (   R   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR+   r  s    c         C   s   |  j  j d  k S(   N(   R   R+   R#   (   R   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRW   u  s    c         C   s   |  j  ƒ  S(   N(   RW   (   R   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR\   x  s    c         C   s   t  | t ƒ S(   N(   RL   RM   (   R   R“   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR”   {  s    (   R    R!   R"   t   classmethodRK   R   RX   R+   RW   R\   R”   (    (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRN   Z  s   	
				t   Partc           B   s    e  Z d  Z d „  Z d „  Z RS(   sI  
    Represents <message><part/></message>.
    @ivar element: The value of the {element} attribute.
        Stored as a I{qref} as converted by L{suds.xsd.qualify}.
    @type element: str
    @ivar type: The value of the {type} attribute.
        Stored as a I{qref} as converted by L{suds.xsd.qualify}.
    @type type: str
    c         C   sw   t  j |  | | ƒ t ƒ  } t d t d t ƒ | _ | |  j _ | j } |  j	 d | ƒ |  _
 |  j	 d | ƒ |  _ d S(   s®   
        @param root: An XML root element.
        @type root: L{Element}
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        Rz   Rd   N(   R$   R   R   R   R   R   R   R   R'   t   _Part__getrefRz   Rd   (   R   R   R   R   R'   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR   Š  s    		c         C   s9   |  j  j | ƒ } | d k r" | St | |  j  | ƒ Sd S(   s0    Get the qualified value of attribute named 'a'.N(   R   R&   R#   R   (   R   t   aR'   RC   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyt   __getref™  s    (   R    R!   R"   R   R™   (    (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR˜     s   		RO   c           B   s    e  Z d  Z d „  Z d „  Z RS(   si   
    Represents <message/>.
    @ivar parts: A list of message parts.
    @type parts: [I{Part},...]
    c         C   sY   t  j |  | | ƒ g  |  _ x6 | j d ƒ D]% } t | | ƒ } |  j j | ƒ q, Wd S(   s®   
        @param root: An XML root element.
        @type root: L{Element}
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        t   partN(   R$   R   Ry   RH   R˜   R<   (   R   R   R   Rr   Rœ   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR   ©  s
    	c         C   s   t  | t t f ƒ S(   N(   RL   RM   RN   (   R   R“   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR”   ¶  s    (   R    R!   R"   R   R”   (    (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRO   ¢  s   	RP   c           B   s2   e  Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   sr   
    Represents <portType/>.
    @ivar operations: A list of contained operations.
    @type operations: list
    c   
      C   sL  t  j |  | | ƒ i  |  _ x)| j d ƒ D]} t d ƒ } | j d ƒ | _ | j | _ | j d ƒ } | d	 k rƒ d	 | _
 n | j d ƒ | _
 | j d ƒ } | d	 k r¼ d	 | _ n | j d ƒ | _ g  } xT | j d ƒ D]C } t d ƒ }	 | j d ƒ |	 _ | j d ƒ |	 _ | j |	 ƒ qä W| | _ | |  j | j <q, Wd	 S(
   s®   
        @param root: An XML root element.
        @type root: L{Element}
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        Rh   t	   OperationR%   Rl   t   messageRo   t   faultt   FaultN(   R$   R   Re   RH   R   R&   R%   R'   t   getChildR#   Rl   Ro   Rž   R<   t   faults(
   R   R   R   RS   Rt   Rl   Ro   R¢   RŸ   t   f(    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR   Á  s,    		c         C   s‹  x„|  j  j ƒ  D]s} | j d k r@ t t d ƒ | ƒ | _ nX t | j |  j | j ƒ } | j	 j
 | ƒ } | d k r� t d | j ƒ ‚ n	 | | _ | j d k rÂ t t d ƒ | ƒ | _ nX t | j |  j | j ƒ } | j	 j
 | ƒ } | d k rt d | j ƒ ‚ n	 | | _ xf | j D][ } t | j |  j | j ƒ } | j	 j
 | ƒ } | d k rvt d | j ‚ n  | | _ q$Wq Wd S(   s�   
        Resolve named references to other WSDL objects.
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        s   no-inputs   msg '%s', not-founds	   no-outputN(   Re   Rf   Rl   R#   RO   R   R   R   R'   R6   R&   R‘   Ro   R¢   Rž   (   R   R   Rt   t   qreft   msgR£   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR   á  s*    		c         C   s5   y |  j  | SWn t k
 r0 } t | ƒ ‚ n Xd S(   s÷   
        Shortcut used to get a contained operation by name.
        @param name: An operation name.
        @type name: str
        @return: The named operation.
        @rtype: Operation
        @raise L{MethodNotFound}: When not found.
        N(   Re   R‘   t   MethodNotFound(   R   R%   t   e(    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRh     s    	c         C   s   t  | t t t f ƒ S(   N(   RL   RM   RN   RO   (   R   R“   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR”     s    (   R    R!   R"   R   R   Rh   R”   (    (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRP   º  s
   	 	 	RQ   c           B   sz   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z RS(   sp   
    Represents <binding/>
    @ivar operations: A list of contained operations.
    @type operations: list
    c         C   s­   t  j |  | | ƒ i  |  _ | j d ƒ |  _ |  j ƒ  } | d k rf d |  _ t j	 d |  j
 ƒ d St d ƒ } | |  _ | j d d d ƒ|  j _ |  j |  j | ƒ d S(   s®   
        @param root: An XML root element.
        @type root: L{Element}
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        Rd   s    binding: "%s" not a soap bindingNRi   Rk   t   defaultt   document(   R$   R   Re   R&   Rd   t   soaprootR#   Ri   R,   R-   R%   R   Rk   t   add_operationsR   (   R   R   R   t   srRi   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR     s    			c         C   sC   x< t  t f D]. } |  j j d d | ƒ} | d k	 r | Sq Wd S(   s    get the soap:binding Ra   RG   N(   t   soapnst   soap12nsR   R¡   R#   (   R   RG   R¬   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRª   .  s
    c         C   sÎ  t  d d t ƒ} xµ| j d ƒ D]¤} t d ƒ } | j d ƒ | _ | j d d | ƒ} t d ƒ } d | j d d d	 ƒ| _ | j d
 d |  j j	 ƒ| _	 t d ƒ | _
 t d ƒ | j
 _ g  | j
 _ t d ƒ | _ t d ƒ | j _ g  | j _ | | _ | j d ƒ } | d k r4t  d d t ƒ} n  | j d ƒ }	 |  j | | j
 j |	 ƒ x- | j d ƒ D] }
 |  j | | j
 |
 ƒ qlW| j d ƒ } | d k r¼t  d d t ƒ} n  | j d ƒ }	 |  j | | j j |	 ƒ x- | j d ƒ D] }
 |  j | | j |
 ƒ qôWg  } x� | j d ƒ D] } | j d ƒ } | d k rQq*n  | j d ƒ } t d ƒ } | j d d | ƒ| _ | j d d d ƒ| _ | j | ƒ q*W| | _ | |  j | j <q" Wd S(   s    Add <operation/> children Rh   RG   R�   R%   R¨   Ri   s   "%s"t
   soapActiont    Rk   t   Inputt   Bodyt   OutputRl   Rm   t   headerRo   RŸ   R    Rn   t   literalN(   R   R­   RH   R   R&   R%   R¡   t   actionRi   Rk   Rl   Rm   t   headersRo   R#   RI   R´   Rn   R<   R¢   Re   (   R   R   R   t   dsopRS   Rt   t   sopRi   Rl   Rm   R´   Ro   R¢   RŸ   t   sft   fnR£   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR«   6  sR    		c         C   sÑ   | d k r. d | _ | j | _ d	 | _ d S| j d ƒ } | d k rU d
 | _ n t j d | ƒ | _ | j d d d ƒ| _ | j d ƒ } | d k r¬ | j | _ n! | j | d ƒ } | | f | _ d S(   s&    add the input/output body properties Rµ   NRy   s   [\s,]Rn   R¨   RŒ   t   b0(    (    (	   R#   Rn   R'   RŒ   Ry   R&   t   ret   splitRE   (   R   R   Rm   R   Ry   RG   RF   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRm   b  s    		c   	      C   sá   | d k r d St d ƒ } | j j | ƒ | j d d d ƒ| _ | j d ƒ } | d k rn | j | _ n! | j | d ƒ } | | f | _ | j d ƒ } | d k	 r¶ | | _	 n  | j d	 ƒ } | d k	 rÝ | | _
 n  d S(
   s(    add the input/output header properties Nt   HeaderRn   R¨   Rµ   RŒ   t   h0Rž   Rœ   (   R#   R   R·   R<   R&   Rn   R'   RŒ   RE   Rž   Rœ   (	   R   R   t   parentR   R´   RG   RF   R¥   Rœ   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR´   v  s     c         C   s[   |  j  | ƒ xG |  j j ƒ  D]6 } |  j | | ƒ |  j | | ƒ |  j | | ƒ q Wd S(   s3  
        Resolve named references to other WSDL objects.  This includes
        cross-linking information (from) the portType (to) the I{soap}
        protocol information on the binding for each operation.
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        N(   t   resolveportRe   Rf   t   resolvesoapbodyt   resolveheaderst   resolvefaults(   R   R   Rt   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR   Š  s
    c         C   s\   t  |  j |  j | j ƒ } | j j | ƒ } | d k rO t d |  j ƒ ‚ n	 | |  _ d S(   sŠ   
        Resolve port_type reference.
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        s   portType '%s', not-foundN(   R   Rd   R   R'   R7   R&   R#   R‘   (   R   R   R}   t	   port_type(    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRÂ   ˜  s
    c         C   s=  |  j  j | j ƒ } | d k r4 t d | j ‚ n  | j } | j j j } t	 | ƒ r¦ g  } x3 | j j D]% } | j | k rk | j
 | ƒ qk qk W| | j j _ n | j j | j j _ | j j j } t	 | ƒ r$g  } x3 | j j D]% } | j | k ré | j
 | ƒ qé qé W| | j j _ n | j j | j j _ d S(   s  
        Resolve soap body I{message} parts by 
        cross-referencing with operation defined in port type.
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        @param op: An I{operation} object.
        @type op: I{operation}
        s&   operation '%s' not defined in portTypeN(   Rd   Rh   R%   R#   R‘   Ri   Rl   Rm   Ry   RZ   R<   Ro   (   R   R   Rt   t   ptopRi   Ry   t   ptsRr   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRÃ   ¥  s*    		c         C   sá   | j  } | j j | j j } x» | D]³ } | j } t | |  j | j ƒ } | j j	 | ƒ } | d k r{ t d | ‚ n  | j }	 x- | j D]" }
 |
 j |	 k rŽ |
 | _ PqŽ qŽ W|	 | j k r& t d | |	 f ‚ q& q& Wd S(   sâ   
        Resolve soap header I{message} references.
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        @param op: An I{operation} object.
        @type op: I{operation}
        s   message'%s', not-founds$   message '%s' has not part named '%s'N(   Ri   Rl   R·   Ro   Rž   R   R   R'   R6   R&   R#   R‘   Rœ   Ry   R%   (   R   R   Rt   Ri   R·   R´   t   mnR}   Rž   t   pnRr   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRÄ   Æ  s     				c         C   sÁ   |  j  j | j ƒ } | d k r4 t d | j ‚ n  | j } x} | j D]r } x8 | j D]- } | j | j k rW | j j | _ qW qW qW Wt	 | d ƒ r� qG n  t d | j |  j  j f ‚ qG Wd S(   s"  
        Resolve soap fault I{message} references by
        cross-referencing with operation defined in port type.
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        @param op: An I{operation} object.
        @type op: I{operation}
        s&   operation '%s' not defined in portTypeRy   s'   fault '%s' not defined in portType '%s'N(
   Rd   Rh   R%   R#   R‘   Ri   R¢   Rž   Ry   t   hasattr(   R   R   Rt   RÇ   Ri   RŸ   R£   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRÅ   ß  s    		
c         C   s)   y |  j  | SWn t | ƒ ‚ n Xd S(   s÷   
        Shortcut used to get a contained operation by name.
        @param name: An operation name.
        @type name: str
        @return: The named operation.
        @rtype: Operation
        @raise L{MethodNotFound}: When not found.
        N(   Re   R¦   (   R   R%   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRh   ÷  s    	c         C   s   t  | t ƒ S(   N(   RL   RR   (   R   R“   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR”     s    (   R    R!   R"   R   Rª   R«   Rm   R´   R   RÂ   RÃ   RÄ   RÅ   Rh   R”   (    (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRQ     s   			,					!			t   Portc           B   s    e  Z d  Z d „  Z d „  Z RS(   sâ   
    Represents a service port.
    @ivar service: A service.
    @type service: L{Service}
    @ivar binding: A binding name.
    @type binding: str
    @ivar location: The service location (url).
    @type location: str
    c         C   s}   t  j |  | | ƒ | |  _ | j d ƒ |  _ | j d ƒ } | d k rU d |  _ n | j d ƒ j d ƒ |  _ i  |  _	 d S(   sú   
        @param root: An XML root element.
        @type root: L{Element}
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        @param service: A service object.
        @type service: L{Service}
        Ra   t   addressRg   s   utf-8N(
   R$   R   t   _Port__serviceR&   Ra   R¡   R#   Rg   t   encodeRp   (   R   R   R   Rq   RÍ   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR     s    		c         C   s   |  j  j | ƒ S(   sÄ   
        Get a method defined in this portType by name.
        @param name: A method name.
        @type name: str
        @return: The requested method object.
        @rtype: I{Method}
        (   Rp   R&   (   R   R%   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyt   method'  s    (   R    R!   R"   R   RÐ   (    (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRÌ   	  s   		RR   c           B   s>   e  Z d  Z d „  Z d „  Z d d „ Z d „  Z d „  Z RS(   s¶   
    Represents <service/>.
    @ivar port: The contained ports.
    @type port: [Port,..]
    @ivar methods: The contained methods for all ports.
    @type methods: [Method,..]
    c         C   s\   t  j |  | | ƒ g  |  _ x9 | j d ƒ D]( } t | | |  ƒ } |  j j | ƒ q, Wd S(   s®   
        @param root: An XML root element.
        @type root: L{Element}
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        t   portN(   R$   R   Rc   RH   RÌ   R<   (   R   R   R   Rr   RÑ   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR   ;  s
    	c         C   s+   x$ |  j  D] } | j | k r
 | Sq
 Wd S(   s�   
        Locate a port by name.
        @param name: A port name.
        @type name: str
        @return: The port object.
        @rtype: L{Port} 
        N(   Rc   R%   R#   (   R   R%   Rr   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRÑ   H  s    c         C   sY   xR |  j  D]G } x> | j j ƒ  D]- } | d k sA | j | k r  | | _ q  q  Wq
 Wd S(   sá   
        Override the invocation location (url) for service method.
        @param url: A url location.
        @type url: A url.
        @param names:  A list of method names.  None=ALL
        @type names: [str,..]
        N(   Rc   Rp   Rf   R#   R%   Rg   (   R   R2   t   namesRr   Ru   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyt   setlocationU  s    c         C   s´   g  } xž |  j  D]“ } t | j |  j | j ƒ } | j j | ƒ } | d k re t d | j ƒ ‚ n  | j	 d k r� t
 j d | j ƒ q n  | | _ | j | ƒ q W| |  _  d S(   sÐ   
        Resolve named references to other WSDL objects.
        Ports without soap bindings are discarded.
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        s   binding '%s', not-founds$   binding "%s" - not a soap, discardedN(   Rc   R   Ra   R   R'   R8   R&   R#   R‘   Ri   R,   R-   R%   R<   (   R   R   t   filteredRr   R}   Ra   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR   b  s    	c         C   s   t  S(   N(   R   (   R   R“   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyR”   v  s    N(	   R    R!   R"   R   RÑ   R#   RÓ   R   R”   (    (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRR   2  s   			RJ   c           B   sM   e  Z d  Z i e d 6e d 6e d 6e d 6e d 6e d 6Z	 e
 d „  ƒ Z RS(   ss   
    Simple WSDL object factory.
    @cvar tags: Dictionary of tag->constructor mappings.
    @type tags: dict
    t   importR4   Rž   t   portTypeRa   Rq   c         C   s6   |  j  j | j ƒ } | d k	 r. | | | ƒ Sd Sd S(   s$  
        Create an object based on the root tag name.
        @param root: An XML root element.
        @type root: L{Element}
        @param definitions: A definitions object.
        @type definitions: L{Definitions}
        @return: The created object.
        @rtype: L{WObject} 
        N(   t   tagsR&   R%   R#   (   R–   R   R   R»   (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRK   ‹  s    (   R    R!   R"   RM   RN   RO   RP   RQ   RR   R×   R—   RK   (    (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyRJ   z  s   
(   Ns    http://schemas.xmlsoap.org/wsdl/(   Ns%   http://schemas.xmlsoap.org/wsdl/soap/(   Ns'   http://schemas.xmlsoap.org/wsdl/soap12/(    (2   R"   t   loggingR    t   sudst   suds.saxR   t   suds.sax.elementR   t   suds.bindings.documentR   t   suds.bindings.rpcR   R   t   suds.xsdR   R   t   suds.xsd.schemaR	   R
   t   suds.xsd.queryR   t   suds.sudsobjectR   R   R   t   suds.readerR   R   t   urlparseR   R½   t	   soaparrayR    R,   R#   RI   R­   R®   R   R$   R(   RM   RN   R˜   RO   RP   RQ   RÌ   RR   RJ   (    (    (    sC   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/wsdl.pyt   <module>   s:   
¹@%#Yö)H