
1oQc           @   s  d  Z  d d l Z d d l m Z d d l m Z m Z m Z m Z m	 Z	 m
 Z
 m Z d d l m Z m Z m Z m Z m Z d d l m Z m Z m Z d f  d     YZ d	 f  d
     YZ d 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      YZ! d! e f d"     YZ" d# e f d$     YZ# d% f  d&     YZ$ d' f  d(     YZ% d) f  d*     YZ& d+ f  d,     YZ' d- f  d.     YZ( d/ f  d0     YZ) d1 e) f d2     YZ* d3 f  d4     YZ+ d5 f  d6     YZ, d7 f  d8     YZ- d9 f  d:     YZ. d; f  d<     YZ/ d= f  d>     YZ0 d? f  d@     YZ1 dA f  dB     YZ2 dC f  dD     YZ3 dE e4 f dF     YZ5 dG   Z6 dH   Z7 dI   Z8 dJ   Z9 dK   Z: dL   Z; dM   Z< dN   Z= e> f   dO  Z? e> f   dP  Z@ dQ f  dR     YZA dS f  dT     YZB dU eB f dV     YZC dW   ZD d S(X   s   $Id$iN(   t   StringIO(   t   OASISt   XMLNSt   WSAt   WSA_LISTt	   WSAW_LISTt	   WSRF_V1_2t   WSRF(   t
   Collectiont   CollectionNSt   DOMt   ElementProxyt   basejoin(   t	   XMLSchemat   SchemaReadert   WSDLToolsAdaptert
   WSDLReaderc           B   s5   e  Z d  Z d d  Z d   Z d   Z d   Z RS(   s;   A WSDLReader creates WSDL instances from urls and xml data.c         C   sY   t  j |  } t   } | r* | | _ n t | d  rH | j | _ n  | j |  | S(   s3   Return a WSDL instance loaded from a stream object.t   name(   R
   t   loadDocumentt   WSDLt   locationt   hasattrR   t   load(   t   selft   streamR   t   documentt   wsdl(    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   loadFromStream   s    	c         C   s2   t  j |  } t   } | | _ | j |  | S(   s1   Return a WSDL instance loaded from the given url.(   R
   t   loadFromURLR   R   R   (   R   t   urlR   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR   %   s
    		c         C   s   |  j  t |   S(   s1   Return a WSDL instance loaded from an xml string.(   R   R    (   R   t   data(    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   loadFromString-   s    c         C   s4   t  | d  } z |  j |  } Wd | j   X| S(   s2   Return a WSDL instance loaded from the given file.t   rbN(   t   openR   t   close(   R   t   filenamet   fileR   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   loadFromFile1   s
    N(   t   __name__t
   __module__t   __doc__t   NoneR   R   R   R%   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR      s
   		R   c           B   s   e  Z d  Z d d d  Z d   Z d Z d d d  Z d d d  Z d d d  Z	 d d d	  Z
 d
   Z d   Z d   Z d d  Z RS(   s   A WSDL object models a WSDL service description. WSDL objects
       may be created manually or loaded from an xml representation
       using a WSDLReader instance.i   c         C   s   | p	 d |  _  d |  _ d  |  _ d  |  _ d  |  _ t |   |  _ t |   |  _ t |   |  _	 t |   |  _
 t |   |  _ t |   |  _ g  |  _ | |  _ d  S(   Ns   urn:this-document.wsdlt    (   t   targetNamespacet   documentationR)   R   R   R   R	   t   servicest   messagest	   portTypest   bindingsR   t   importst   Typest   typest
   extensionst   strict(   R   R+   R5   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   __init__@   s    					c         C   s#   |  j  d  k	 r |  j  j   n  d  S(   N(   R   R)   t   unlink(   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   __del__O   s    s   1.1R*   c         C   sT   | |  j  k r" t d |   n  t | |  } | rC | | _ n  | |  j  | <| S(   Ns   Duplicate service element: %s(   R-   t	   WSDLErrort   ServiceR+   (   R   R   R,   R+   t   item(    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt
   addServiceU   s    c         C   sT   | |  j  k r" t d |   n  t | |  } | rC | | _ n  | |  j  | <| S(   Ns   Duplicate message element: %s.(   R.   R9   t   MessageR+   (   R   R   R,   R+   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt
   addMessage`   s    c         C   sP   | |  j  k r t d   n  t | |  } | r? | | _ n  | |  j  | <| S(   Ns    Duplicate portType element: name(   R/   R9   t   PortTypeR+   (   R   R   R,   R+   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   addPortTypek   s    c         C   sW   | |  j  k r" t d |   n  t | | |  } | rF | | _ n  | |  j  | <| S(   Ns   Duplicate binding element: %s(   R0   R9   t   BindingR+   (   R   R   t   typeR,   R+   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt
   addBindingv   s    c         C   s    t  | |  } | |  j | <| S(   N(   t   ImportElementR1   (   R   t	   namespaceR   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt	   addImport   s    c         C   si  t  j |  j  } t  j | d  |  _ t  j |  j d
  } | j d
 d |  j  | j t	 j
 d |  | j t	 j
 d d  | j t	 j
 d d  | j t	 j
 d |  j  |  j r | j d
 d	 |  j  n  x |  j D] } | j   q Wx |  j D] } | j   q Wx |  j D] } | j   qWx |  j D] } | j   q3Wx |  j D] } | j   qQWd
 S(   s	   Generate a DOM representation of the WSDL instance.
        Not dealing with generating XML Schema, thus the targetNamespace
        of all XML Schema elements or types used by WSDL message parts
        needs to be specified via import information items.
        s   wsdl:definitionsR+   s
   xmlns:wsdls	   xmlns:xsds    http://www.w3.org/1999/XMLSchemas
   xmlns:soaps%   http://schemas.xmlsoap.org/wsdl/soap/s	   xmlns:tnsR   N(   R
   t
   GetWSDLUrit   versiont   createDocumentR   t
   getElementR)   t   setAttributeNSR+   R   t   BASER   R1   t   toDomR.   R/   R0   R-   (   R   t   namespaceURIt   childR;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM      s(    	c         C   s  | |  _  t j | d d  d   } | d  k r< t d   n  t j | j  |  _ t j |  j  } t j	 | d d  d   |  _
 t j	 | d d  d   |  _ t |  |  _ g  } |  j } t } x | rgt } x t j | d |  D]x } t j	 | d  } | d  k	 rt | |  } n  | | k rMt } |  j | | |  | j |  q | j |  q Wd  } q Wxt j | d  d   D]} t j	 | d  }	 | j }
 t j | j |  s,|
 d k rt j	 | d  } t d |  j | j  } | j t |   |  } |  j j |  q~|  j j |  q~q~|
 d	 k rt j	 | d  } t |  } |  j | | |	  } t j | d
 |  } | j  |  q~q~|
 d k rt j	 | d  } t |  } |  j! | | |	  } | j  |  q~q~|
 d k rt j	 | d  } t j	 | d d d  } | d  k r:t d |   n  t" | |  } t |  } |  j# | | | |	  } t j | d |  } | j  |  | j$ t% |   q~q~|
 d k r"t j	 | d  } t |  } |  j& | | |	  } t j | d |  } | j  |  | j$ t% |   q~q~|
 d k r~t |  |  j _ t j	 | d  } | rh| j' d  n  | pt|  j } t d |  } xt t j | d  d   D]] } | j d k r| j t |   |  } | j( |  |  j j |  q|  j j) |  qWq~q~q~Wd  S(   Nt   definitionss   Missing <definitions> element.R+   R   t   importR   t   schemat   base_urlt   messaget   partt   portTypet   bindingRB   t   defaults&   Missing type attribute for binding %s.t	   operationt   servicet   portR3   s   base-location(*   R   R
   RJ   R)   R9   t   WSDLUriToVersionRN   RH   RG   t   getAttrR+   R   t   GetDocumentationR,   R   t   Truet   Falset   getElementsR   t   _importt   appendt   removeChildt	   localNamet
   nsUriMatchR   R1   t   loadFromNodeR   R3   t	   addSchemaR4   R>   R   R@   t
   ParseQNameRC   t   load_ext   GetExtensionsR<   t   removeAttributet
   setBaseUrlt   addExtension(   R   R   RP   t   NS_WSDLt   importedt   base_locationt   do_itt   elementR   R+   Re   t   tnst   readerRR   R   t   docsRT   t   partst   ptypeRB   RW   t
   operationsRZ   t   portsR;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR      s    				
		c         C   s  t  j | d d d	 } t  j | d d d	 } | d	 k sH | d	 k rW t d   n  | r t | |  } | j d	 d |  n  |  j | |  } d | _ t  j |  } z| j	 d  d k r | j
 d  d } t  j | |  }	 n	 | j }	 |	 d	 k rt d |   n  t  j |	  }
 |
 | k r3d	 S|	 j d
 k rN|	 j } n	 |	 g } | j } | j |  x| D]} | j | j k rqtn  t  j | | d  } | j |  | j d |  |	 j } xJ | j   D]< } | d t  j k r| | j d  } | j |  qqW| j d k r]| j d	 d  } t | |  } | j d |  qt| j d k rt| j d |  qtqtWWd	 | j   X| S(   s  Algo take <import> element's children, clone them,
        and add them to the main document.  Support for relative
        locations is a bit complicated.  The orig document context
        is lost, so we need to store base location in DOM elements
        representing <types>, by creating a special temporary
        "base-location" attribute,  and <import>, by resolving
        the relative "location" and storing it as "location".

        document -- document we are loading
        element -- DOM Element representing <import>
        base_location -- location of document from which this
            <import> was gleaned.
        RE   RX   R   s7   Invalid import element (missing namespace or location).i   t   #is'   Import target element not found for: %sNRP   R+   i    RQ   R3   s   base-location(   R
   R]   R)   R9   R   RK   RF   t   _loadedR   t   findt   splitt   getElementByIdt   documentElementt   findTargetNSRe   t
   childNodest
   parentNodeRd   t   nodeTypet   ELEMENT_NODEt
   importNodet   appendChildt   setAttributet   _attrsNSt   keyst   NS_XMLNSt	   cloneNodet   setAttributeNodet   getAttributeNSR7   (   R   R   Rs   Rq   RE   R   t   obimportt	   importdoct   idrefRp   t   imported_tnst   imported_nodest   parentt   nodeRO   t   attrsNSt   attrkeyt   attrt	   rlocationt	   alocation(    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRb   *  s\    					N(   R&   R'   R(   R)   R6   R8   RH   R<   R>   R@   RC   RF   RM   R   Rb   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR   ;   s   			$	t   Elementc           B   s/   e  Z d  Z d d d  Z d   Z d   Z RS(   s@   A class that provides common functions for WSDL element classes.R*   c         C   s   | |  _  | |  _ g  |  _ d  S(   N(   R   R,   R4   (   R   R   R,   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6   x  s    		c         C   s&   t  j |   | _ |  j j |  d  S(   N(   t   weakreft   refR   R4   Rc   (   R   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRn   }  s    c         C   s>   |  } x1 t  | t  r | Sy | j   } Wq	 Pq	 Xq	 d S(   s;   Return the WSDL object that contains this information item.N(   t
   isinstanceR   R   R)   (   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getWSDL  s    N(   R&   R'   R(   R)   R6   Rn   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR   v  s   	RD   c           B   s    e  Z d    Z d   Z d Z RS(   c         C   s   | |  _  | |  _ d  S(   N(   RE   R   (   R   RE   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    	c         C   sx   |  j    } t d  t j | j d    } | j t j | j  d  } | j	 d  d |  j
  | j	 d  d |  j  d  S(   NRQ   RE   R   (   R   R   R)   R
   RJ   R   t   createAppendElementRG   RH   RK   RE   R   (   R   R   t   ept   epc(    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM     s
    N(   R&   R'   R6   RM   R)   R|   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRD     s   		R2   c           B   s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C   s   | j  S(   N(   R+   (   R   t   k(    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   <lambda>  s    c         C   s&   t  j |  |  d |  _ g  |  _ d  S(   NR*   (   R   R6   R,   R4   (   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    	c         C   s   | j  } | |  | <| S(   N(   R+   (   R   RR   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRh     s    	
c         C   s   |  j  j |  d  S(   N(   R4   Rc   (   R   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRn     s    (   R&   R'   RX   R6   Rh   Rn   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR2     s   			R=   c           B   s5   e  Z d  d  Z d d d  Z d   Z d   Z RS(   R*   c         C   s&   t  j |  | |  t |   |  _ d  S(   N(   R   R6   R   Rw   (   R   R   R,   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    c         C   s|   | |  j  k r" t d |   n  | d  k rM | d  k rM t d |   n  t |  } | | _ | | _ | |  j  | <| S(   Ns"   Duplicate message part element: %ss.   Missing type or element attribute for part: %s(   Rw   R9   R)   t   MessagePartRs   RB   (   R   R   RB   Rs   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   addPart  s    		c         C   s   x | D] } t  j | d  } t |  } | |  j | <t  j | d d d  } t  j | d d d  } | d  k r | d  k r t d |   n  | d  k	 r t | |  | _ n  | d  k	 r t | |  | _ q q Wd  S(   NR   Rs   RX   RB   s)   No type or element attribute for part: %s(	   R
   R]   R   Rw   R)   R9   t   ParseTypeRefRB   Rs   (   R   t   elementsRs   R   RU   t   elemreft   typeref(    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s    c         C   s   |  j    } t d  t j | j d    } | j t j | j  d  } | j	 d  d |  j
  x$ |  j D] } | j | j    qh Wd  S(   NRT   R   (   R   R   R)   R
   RJ   R   R   RG   RH   RK   R   Rw   RM   t   _getNode(   R   R   R   R   RU   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM     s    N(   R&   R'   R6   R)   R   R   RM   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR=     s   	(R   c           B   s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C   s)   t  j |  | d  d  |  _ d  |  _ d  S(   NR*   (   R   R6   R)   Rs   RB   (   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    	c         C   s=   |  j    } |  j \ } } | j j | i   } | j |  S(   N(   R   RB   R3   t   get(   R   R   t   nsuriR   RR   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getTypeDefinition  s    c         C   s=   |  j    } |  j \ } } | j j | i   } | j |  S(   N(   R   Rs   R3   R   (   R   R   R   R   RR   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getElementDeclaration
  s    c         C   s   |  j    } t d |  } | j t j | j  d  } | j d d |  j  |  j	 d k	 r |  j	 \ } } | j
 |  } | j d d d | | f  nM |  j d k	 r |  j \ } } | j
 |  } | j d d d | | f  n  d S(   s!   node -- node representing messageRU   R   Rs   s   %s:%sRB   N(   R   R   R)   R   R
   RG   RH   RK   R   Rs   t	   getPrefixRB   (   R   R   R   R   R   t   nsR   t   prefix(    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM     s     (   R&   R'   R6   R   R   RM   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s   				R?   c           B   sM   e  Z d  Z d d  Z d   Z d   Z d d d  Z d   Z d   Z	 RS(	   s
  PortType has a anyAttribute, thus must provide for an extensible
       mechanism for supporting such attributes.  ResourceProperties is
       specified in WS-ResourceProperties.   wsa:Action is specified in
       WS-Address.

       Instance Data:
           name -- name attribute
           resourceProperties -- optional. wsr:ResourceProperties attribute,
              value is a QName this is Parsed into a (namespaceURI, name)
              that represents a Global Element Declaration.
           operations
    R*   c         C   s/   t  j |  | |  t |   |  _ d  |  _ d  S(   N(   R   R6   R   Ry   R)   t   resourceProperties(   R   R   R,   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6   /  s    c         C   s   |  j  p |  j   j  S(   N(   R+   R   (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getTargetNamespace7  s    c         C   s   |  j  S(   N(   R   (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getResourceProperties:  s    c         C   s#   t  | | |  } | |  j | <| S(   N(   t	   OperationRy   (   R   R   R,   t   parameterOrderR;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   addOperation=  s    c         C   sU  t  j | d  |  _ t |  |  _ t  j | d  |  _ xS t j j D]E } t  j	 | d |  rF t  j | d |  } t
 | |  |  _ qF qF Wt  j |  j   j  } t  j | d |  } x| D]} t  j | d  } t |  } t  j | d d d  } | d  k	 r| j d  } n  |  j | | |  }	 t  j | d d  d   }
 |
 d  k	 rt  j |
 d  } t |
  } t  j |
 d	  } t
 | |
  } x7 t t D]+ } t  j |
 d
 | j d   } | rPqqW|	 j | | | |  n  t  j | d d  d   }
 |
 d  k	 rt  j |
 d  } t |
  } t  j |
 d	  } t
 | |
  } x7 t t D]+ } t  j |
 d
 | j d   } | rVPqVqVW|	 j | | | |  n  x t  j | d d   D] }
 t  j |
 d  } t |
  } t  j |
 d	  } t
 | |
  } x7 t t D]+ } t  j |
 d
 | j d   } | rPqqW|	 j | | | |  qWq Wd  S(   NR   R+   t   ResourcePropertiesRY   R   RX   t    t   inputRT   t   Actiont   outputt   fault(   R
   R]   R   R^   R,   R+   R   t
   PROPERTIESt   XSD_LISTt   hasAttrRi   R   RG   R   RH   Ra   R)   R~   R   RJ   R   R   t   ADDRESSt   setInputt	   setOutputt   addFault(   R   Rs   R   t   rprefRo   R   R   Rv   t   param_orderRY   R;   t   msgrefRT   R   t   action(    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR   B  s`    c         C   s   |  j    } t d  t j | j d    } | j t j | j  d  } | j	 d  d |  j
  |  j r |  j \ } } | j |  } | j	 t j j d d | | f  n  x$ |  j D] } | j | j    q Wd  S(   NRV   R   R   s   %s:%s(   R   R   R)   R
   RJ   R   R   RG   RH   RK   R   R   R   R   R   t   LATESTRy   RM   R   (   R   R   R   R   R   R   R   t   op(    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM   y  s    	N(
   R&   R'   R(   R6   R   R   R)   R   R   RM   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR?   !  s   			7R   c           B   s   e  Z d  d d  Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d  d d
  Z d  d  d d  Z d  d  d d  Z d   Z RS(   R*   c         C   sA   t  j |  | |  | |  _ t |   |  _ d  |  _ d  |  _ d  S(   N(   R   R6   R   R   t   faultsR)   R   R   (   R   R   R,   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s
    		c         C   s   |  j    j    j    j    S(   s4   Return the WSDL object that contains this Operation.(   R   (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s    c         C   s   |  j    j    S(   N(   R   (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getPortType  s    c         C   s
   t  |   S(   s   wsa:Action attribute(   t   GetWSAActionInput(   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getInputAction  s    c         C   s6   |  j  d  k r d  S|  j   j   } | j |  j  j S(   N(   R   R)   R   R   R.   RT   (   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getInputMessage  s    c         C   s
   t  |   S(   s   wsa:Action attribute(   t   GetWSAActionOutput(   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getOutputAction  s    c         C   s6   |  j  d  k r d  S|  j   j   } | j |  j  j S(   N(   R   R)   R   R   R.   RT   (   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getOutputMessage  s    c         C   s   t  |  |  S(   s   wsa:Action attribute(   t   GetWSAActionFault(   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getFaultAction  s    c         C   s'   |  j    j   } | j |  j | j S(   N(   R   R   R.   R   RT   (   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getFaultMessage  s    c         C   sK   | |  j  k r" t d |   n  t d | | | |  } | |  j  | <| S(   Ns   Duplicate fault element: %sR   (   R   R9   t   MessageRole(   R   RT   R   R,   R   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s    c         C   s7   t  d | | | |  |  _ t j |   |  j _ |  j S(   NR   (   R   R   R   R   R   (   R   RT   R   R,   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s    c         C   s7   t  d | | | |  |  _ t j |   |  j _ |  j S(   NR   (   R   R   R   R   R   (   R   RT   R   R,   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s    c         C   s   |  j    } t d  |  } | j t j | j  d  } | j d  d |  j  | j	   } |  j
 rw |  j
 j |  n  |  j r |  j j |  n  x |  j D] } | j |  q Wd  S(   NRY   R   (   R   R   R)   R   R
   RG   RH   RK   R   R   R   RM   R   R   (   R   R   R   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM     s    		N(   R&   R'   R)   R6   R   R   R   R   R   R   R   R   R   R   R   RM   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s   									R   c           B   s5   e  Z d  d  d d  Z d   Z d   Z d   Z RS(   R*   c         C   s2   t  j |  | |  | |  _ | |  _ | |  _ d  S(   N(   R   R6   RT   RB   R   (   R   RB   RT   R   R,   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    		c         C   s>   |  } x1 t  | t  r | Sy | j   } Wq	 Pq	 Xq	 d S(   s;   Return the WSDL object that contains this information item.N(   R   R   R   R)   (   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s    c         C   s   |  j    } | j |  j S(   sh   Return the WSDL object that represents the attribute message
        (namespaceURI, name) tuple
        (   R   R.   RT   (   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt
   getMessage  s    c         C   s  |  j    } t d  |  } | j t j | j  |  j  } t |  j	 t
  r t |  j	  d k r |  j	 \ } } | j |  } | j d  d d | | f  n | j d  d |  j	  |  j r | j t j d |  j  n  |  j r | j d  d |  j  n  d  S(   Ni   RT   s   %s:%sR   R   (   R   R   R)   R   R
   RG   RH   RB   R   RT   t
   basestringt   lenR   RK   R   R   R   R   (   R   R   R   R   R   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM     s    !( 		N(   R&   R'   R)   R6   R   R   RM   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s   		RA   c           B   sV   e  Z d  d  Z d   Z d   Z d   Z d  d  Z d   Z d   Z d   Z	 RS(	   R*   c         C   s/   t  j |  | |  t |   |  _ | |  _ d  S(   N(   R   R6   R   Ry   RB   (   R   R   RB   R,   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    c         C   s   |  j    j |  j S(   s8   Return the PortType object associated with this binding.(   R   R/   RB   (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s    c         C   s+   x$ |  j  D] } t | |  r
 | Sq
 Wd  S(   N(   R4   R   R)   (   R   t   kindR;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   findBinding  s    c         C   s)   g  |  j  D] } t | |  r
 | ^ q
 S(   N(   R4   R   (   R   R   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   findBindings  s    c         C   s    t  | |  } | |  j | <| S(   N(   t   OperationBindingRy   (   R   R   R,   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   addOperationBinding  s    c         C   s  x| D]} t  j | d  } t |  } |  j | |  } | j t |   t  j | d d  d   } | d  k	 r t d  } t |  | _	 | | _
 | j t |   t j |  | _ n  t  j | d d  d   } | d  k	 r0t d  } t |  | _	 | | _ | j t |   t j |  | _ n  x t  j | d d   D]h } t  j | d  } t d |  } t |  | _	 | | j | <| j t |   t j |  | _ qFWq Wd  S(   NR   R   R   R   (   R
   R]   R^   R   Rj   Rk   RJ   R)   t   MessageRoleBindingR,   R   R   R   R   R   Ra   R   (   R   R   Rs   R   Rv   t	   opbindingR;   t   mbinding(    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR   !  s4    		c   	      C   s   x | D] } | j  | j } } | t j k r | d k r t j | d d d  } t j | d d d } t | |  } |  j |  q q | t j k r | d k r t j | d  } t	 |  } |  j |  q q |  j |  q Wd  S(   NRW   t	   transportRX   t   styleR   t   verb(
   RN   Re   R
   t   NS_SOAP_BINDING_ALLR]   R)   t   SoapBindingRn   t   NS_HTTP_BINDING_ALLt   HttpBinding(	   R   R   t   eR   R   R   R   t   obR   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRj   A  s    c   
      C   s   |  j    } t d  t j | j d    } | j t j | j  d  } | j	 d  d |  j
  |  j \ } } | j |  } | j	 d  d d | | f  | j   } x |  j D] } | j |  q Wx |  j D] }	 |	 j |  q Wd  S(   NRW   R   RB   s   %s:%s(   R   R   R)   R
   RJ   R   R   RG   RH   RK   R   RB   R   R   R4   RM   Ry   (
   R   R   R   R   R   R   R   R   t   extt
   op_binding(    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM   R  s    (
   R&   R'   R6   R   R   R   R   R   Rj   RM   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRA     s   					 	R   c           B   se   e  Z d  d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d	   Z
 d
   Z RS(   R*   c         C   s8   t  j |  | |  d  |  _ d  |  _ t |   |  _ d  S(   N(   R   R6   R)   R   R   R   R   (   R   R   R,   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6   d  s    		c         C   s   |  j    j    S(   s:   Return the parent Binding object of the operation binding.(   R   (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt
   getBindingn  s    c         C   s   |  j    j   j |  j S(   s;   Return the abstract Operation associated with this binding.(   R   R   Ry   R   (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getOperationr  s    c         C   s+   x$ |  j  D] } t | |  r
 | Sq
 Wd  S(   N(   R4   R   R)   (   R   R   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR   v  s    c         C   s)   g  |  j  D] } t | |  r
 | ^ q
 S(   N(   R4   R   (   R   R   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR   |  s    c         C   sJ   |  j  d  k r6 t d  |  _  t j |   |  j  _ n  |  j  j |  | S(   NR   (   R   R)   R   R   R   R   Rn   (   R   RW   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   addInputBinding  s
    c         C   sJ   |  j  d  k r6 t d  |  _  t j |   |  j  _ n  |  j  j |  | S(   NR   (   R   R)   R   R   R   R   Rn   (   R   RW   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   addOutputBinding  s
    c         C   sA   |  j  | d   } | d  k r0 t d |  } n  | j |  | S(   NR   (   R   R)   R   Rn   (   R   R   RW   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   addFaultBinding  s
    c   	      C   s   x | D] } | j  | j } } | t j k r | d k r t j | d d d  } t j | d d d  } t | |  } |  j |  q q | t j k r | d k r t j | d  } t	 |  } |  j |  q q |  j |  q Wd  S(   NRY   t
   soapActionRX   R   R   (
   RN   Re   R
   R   R]   R)   t   SoapOperationBindingRn   R   t   HttpOperationBinding(	   R   R   R   R   R   t
   soapactionR   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRj     s    c         C   s   |  j    } t d  |  } | j t j | j  d  } | j d  d |  j  | j	   } x |  j
 D] } | j |  qe W|  j r |  j j |  n  |  j r |  j j |  n  x |  j D] } | j |  q Wd  S(   NRY   R   (   R   R   R)   R   R
   RG   RH   RK   R   R   R4   RM   R   R   R   (   R   R   R   R   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM     s    		(   R&   R'   R6   R   R   R   R   R   R   R   Rj   RM   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR   c  s   
								R   c           B   s;   e  Z d  d  d  Z d   Z d   Z d   Z d   Z RS(   R*   c         C   s    t  j |  | |  | |  _ d  S(   N(   R   R6   RB   (   R   RB   R   R,   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    c         C   s+   x$ |  j  D] } t | |  r
 | Sq
 Wd  S(   N(   R4   R   R)   (   R   R   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s    c         C   s)   g  |  j  D] } t | |  r
 | ^ q
 S(   N(   R4   R   (   R   R   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s    c         C   s
  x| D]} | j  | j } } | t j k r | d k r t j | d d d  } t j | d d d  } t j | d d d  } t j | d d d  } | d  k r t d   n  t | | | |  }	 |  j |	  q q | t j k r| d k rt j | d d d  } t j | d d d  } t j | d	 d d  } t j | d d d  } | d  k sq| d  k rt d
   n  t	 | | | |  }	 |  j |	  q q | t j k r~| d k r~t j | d d d  } t j | d d d  } t j | d  }
 t j | d  } t j | d  } | d k r>t
 } n t } t |
 |  }
 | |
 | | | |  }	 |  j |	  q q | t j k r| d k rt   }	 |  j |	  q q | t j k r| d k rt   }	 |  j |	  q q | t j k r6| d k r6t   }	 |  j |	  |	 j t |   q q | t j k r| d k rt j | d d d  } t j | d d d  } t | |  }	 |  j |	  q q | t j k r| d k rt j | d d d  } t |  }	 |  j |	  q q |  j |  q Wd  S(   Nt   bodyt   encodingStyleRX   RE   Rw   t   uses"   Invalid soap:body binding element.R   R   s#   Invalid soap:fault binding element.t   headert   headerfaultRT   RU   t   urlReplacementt
   urlEncodedt   multipartRelatedt   contentRB   t   mimeXml(   s   headerR   (   RN   Re   R
   R   R]   R)   R9   t   SoapBodyBindingRn   t   SoapFaultBindingt   SoapHeaderBindingt   SoapHeaderFaultBindingRi   R   t   HttpUrlReplacementBindingt   HttpUrlEncodedBindingt   NS_MIME_BINDING_ALLt   MimeMultipartRelatedBindingRj   Rk   t   MimeContentBindingt   MimeXmlBinding(   R   R   R   R   R   t   encstyleRE   Rw   R   R   RT   RU   t   _classRB   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRj     s~    					c         C   sv   |  j    } t d  |  } | j t j | j  |  j  } | j   } x' |  j	 D] } | rR | j
 |  qR qR Wd  S(   N(   R   R   R)   R   R
   RG   RH   RB   R   R4   RM   (   R   R   R   R   R   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM     s    !(   R&   R'   R6   R   R   Rj   RM   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s
   			NR:   c           B   sD   e  Z d  d  Z d   Z d  d  Z d   Z d   Z d   Z RS(   R*   c         C   s&   t  j |  | |  t |   |  _ d  S(   N(   R   R6   R   Rz   (   R   R   R,   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    c         C   s   |  j    j    S(   N(   R   (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR   "  s    c         C   s#   t  | | |  } | |  j | <| S(   N(   t   PortRz   (   R   R   RW   R,   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   addPort%  s    c         C   s   x | D] } t  j | d d d  } t |  } t  j | d d d  } | d  k sa | d  k rp t d   n  t | |  } |  j | | |  } | j t |   q Wd  S(   NR   RX   RW   s   Invalid port element.(	   R
   R]   R)   R^   R9   Ri   R  Rj   Rk   (   R   R   Rs   R   Rv   RW   R[   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR   *  s    c         C   s"   x | D] } |  j  |  q Wd  S(   N(   Rn   (   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRj   7  s    c         C   s   |  j    } t d  t j | j d    } | j t j | j  d  } | j	 d  d |  j
  | j   } x |  j D] } | j |  qt Wd  S(   NRZ   R   (   R   R   R)   R
   RJ   R   R   RG   RH   RK   R   R   Rz   RM   (   R   R   R   R   R   R[   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM   ;  s    (   R&   R'   R6   R   R  R   Rj   RM   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR:     s   			R  c           B   sJ   e  Z d  d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   R*   c         C   s    t  j |  | |  | |  _ d  S(   N(   R   R6   RW   (   R   R   RW   R,   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6   G  s    c         C   s   |  j    j    S(   s4   Return the Service object associated with this port.(   R   (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt
   getServiceN  s    c         C   s    |  j    j   } | j |  j S(   s:   Return the Binding object that is referenced by this port.(   R  R   R0   RW   (   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR   R  s    c         C   s0   |  j    j   } | j |  j } | j | j S(   s;   Return the PortType object that is referenced by this port.(   R  R   R0   RW   R/   RB   (   R   R   RW   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR   W  s    c         C   sF   x3 |  j  D]( } t | t  s. t | t  r
 | Sq
 Wt d   d S(   si   A convenience method to obtain the extension element used
           as the address binding for the port.s!   No address binding found in port.N(   R4   R   t   SoapAddressBindingt   HttpAddressBindingR9   (   R   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getAddressBinding]  s    c         C   s   x | D] } | j  | j } } | t j k rr | d k rr t j | d d d  } t |  } |  j |  q q | t j k r | d k r t j | d d d  } t	 |  } |  j |  q q |  j |  q Wd  S(   Nt   addressR   RX   (
   RN   Re   R
   R   R]   R)   R  Rn   R   R  (   R   R   R   R   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRj   h  s    c   	      C   s   |  j    } t d  |  } | j t j | j  d  } | j d  d |  j  |  j	 \ } } | j
 |  } | j d  d d | | f  | j   } x |  j D] } | j |  q Wd  S(   NR[   R   RW   s   %s:%s(   R   R   R)   R   R
   RG   RH   RK   R   RW   R   R   R4   RM   (	   R   R   R   R   R   R   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM   x  s    (	   R&   R'   R6   R  R   R   R  Rj   RM   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR  F  s   					R   c           B   s&   e  Z d  d  Z d   Z d   Z RS(   t   rpcc         C   s   | |  _  | |  _ d  S(   N(   R   R   (   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    	c         C   s   |  j    j   S(   N(   R   R   (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s    c         C   s   |  j    } t d  |  } | j t j | j  d  } |  j r[ | j d  d |  j  n  |  j	 r} | j d  d |  j	  n  d  S(   NRW   R   R   (
   R   R   R)   R   R
   t   GetWSDLSoapBindingUriRH   R   RK   R   (   R   R   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM     s    		(   R&   R'   R6   R   RM   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s   	R  c           B   s#   e  Z d    Z d   Z d   Z RS(   c         C   s   | |  _  d  S(   N(   R   (   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    c         C   s   |  j    j   S(   N(   R   R   (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s    c         C   sS   |  j    } t d  |  } | j t j | j  d  } | j d  d |  j  d  S(   NR  R   (	   R   R   R)   R   R
   R  RH   RK   R   (   R   R   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM     s    (   R&   R'   R6   R   RM   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR    s   		R   c           B   s)   e  Z d d d   Z d   Z d   Z RS(   c         C   s   | |  _  | |  _ d  S(   N(   R   R   (   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    	c         C   s   |  j    j   S(   N(   R   R   (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s    c         C   s   |  j    } t d  |  } | j t j | j  d  } |  j r[ | j d  d |  j  n  |  j	 r} | j d  d |  j	  n  d  S(   NRY   R   R   (
   R   R   R)   R   R
   R  RH   R   RK   R   (   R   R   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM     s    		N(   R&   R'   R)   R6   R   RM   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s   	R  c           B   s,   e  Z d d d d   Z d   Z d   Z RS(   c         C   sz   | d k r t  d |   n  | |  _ | |  _ t |  t d  t d  f k rd | j   } n  | |  _ | |  _ d  S(   Nt   literalt   encodeds   Invalid use attribute value: %sR*   u    (   s   literalR  (   R9   R   RE   RB   R~   Rw   R   (   R   R   RE   R   Rw   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    		$	c         C   s   |  j    j   S(   N(   R   R   (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s    c         C   si   |  j    } t d  |  } | j t j | j  d  } | j d  d |  j  | j d  d |  j	  d  S(   NR   R   RE   (
   R   R   R)   R   R
   R  RH   RK   R   RE   (   R   R   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM     s
    N(   R&   R'   R)   R6   R   RM   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR    s   	R  c           B   s)   e  Z d d d   Z d   Z d   Z RS(   c         C   sG   | d k r t  d |   n  | |  _ | |  _ | |  _ | |  _ d  S(   NR  R  s   Invalid use attribute value: %s(   s   literals   encoded(   R9   R   RE   R   R   (   R   R   R   RE   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    			c         C   s   |  j    j   S(   N(   R   R   (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s    c         C   s   |  j    } t d  |  } | j t j | j  d  } | j d  d |  j  | j d  d |  j	  |  j
 d  k	 r | j d  d |  j
  n  |  j d  k	 r | j d  d |  j  n  d  S(   NR   R   R   RE   R   (   R   R   R)   R   R
   R  RH   RK   R   R   RE   R   (   R   R   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRM     s    N(   R&   R'   R)   R6   R   RM   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR    s   
	R  c           B   s   e  Z d d d   Z d Z RS(   c         C   sP   | d k r t  d |   n  | |  _ | |  _ | |  _ | |  _ | |  _ d  S(   NR  R  s   Invalid use attribute value: %s(   s   literals   encoded(   R9   R   RE   RT   RU   R   (   R   RT   RU   R   RE   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    				R   N(   R&   R'   R)   R6   t   tagname(    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR    s   R  c           B   s   e  Z d  Z RS(   R   (   R&   R'   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR    s   R   c           B   s   e  Z d    Z RS(   c         C   s   | |  _  d  S(   N(   R   (   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    (   R&   R'   R6   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s   R  c           B   s   e  Z d    Z RS(   c         C   s   | |  _  d  S(   N(   R   (   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    (   R&   R'   R6   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR    s   R   c           B   s   e  Z d    Z RS(   c         C   s   | |  _  d  S(   N(   R   (   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6   	  s    (   R&   R'   R6   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s   R  c           B   s   e  Z RS(    (   R&   R'   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR    s   R  c           B   s   e  Z RS(    (   R&   R'   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR    s   R	  c           B   s   e  Z d d d   Z RS(   c         C   s   | |  _  | |  _ d  S(   N(   RU   RB   (   R   RU   RB   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    	N(   R&   R'   R)   R6   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR	    s   R
  c           B   s   e  Z d d   Z RS(   c         C   s   | |  _  d  S(   N(   RU   (   R   RU   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    N(   R&   R'   R)   R6   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR
    s   R  c           B   s   e  Z d    Z d   Z RS(   c         C   s   g  |  _  d  S(   N(   Rw   (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6   !  s    c         C   s\   xU | D]M } | j  | j } } | t j k r | d k r |  j j t    q q q Wd  S(   NRU   (   RN   Re   R
   R  Rw   Rc   t   MimePartBinding(   R   R   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRj   $  s
    (   R&   R'   R6   Rj   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s   	R  c           B   s   e  Z d    Z d   Z RS(   c         C   s   g  |  _  d  S(   N(   t   items(   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6   -  s    c         C   s  x| D]} | j  | j } } | t j k r | d k r t j | d d d  } t j | d d d  } t | |  } |  j j |  q q | t j k r | d k r t j | d d d  } t	 |  } |  j j |  q q | t j
 k r | d k r t j | d d d  } t j | d d d  }	 t j | d	 d d  }
 t j | d
 d d  } | d  k r{t d   n  t | |	 | |
  } |  j j |  q q q Wd  S(   NR   RU   RX   RB   R   R   R   RE   Rw   R   s"   Invalid soap:body binding element.(   RN   Re   R
   R  R]   R)   R	  R  Rc   R
  R   R9   R  (   R   R   R   R   R   RU   RB   R   R  RE   Rw   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRj   0  s0    (   R&   R'   R6   Rj   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR  ,  s   	R9   c           B   s   e  Z RS(    (   R&   R'   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR9   N  s   c         C   s'   |  j  |  r d  S|  j | |  d  S(   N(   t   hasNSPrefixt   declareNSPrefix(   t   writerR   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   DeclareNSPrefixR  s    c         C   s[   |  j  d d  } t |  d k r7 t j |  |  f St j | d |  } | | d f S(   Nt   :i   i    (   R~   R   R
   R   t   findNamespaceURI(   t   valueRs   Rw   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR   X  s
    c         C   sj   |  j  d d  } t |  d k rG t j | d |  } | d } n t j |  } | d } | | f S(   NR  i   i   i    i(   R~   R   R
   R   R   (   R!  Rs   t   namerefR   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRi   `  s    
c         C   s5   t  j |  d d  d   } | d  k	 r1 t  j |  Sd S(   NR,   R*   (   R
   RJ   R)   t   getElementText(   Rs   t   docnode(    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR^   k  s    c         C   s8   g  t  j |  d  d   D] } | j t  j k r | ^ q S(   N(   R
   Ra   R)   RN   Ro   (   Rs   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyRk   r  s    c         C   s'   |  j  | j } | d k	 r  | St j S(   sU   Find wsa:Action attribute, and return value or WSA.FAULT
       for the default.
    N(   R   R   R)   R   t   FAULT(   RY   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR   w  s    c         C   s   |  j  j } | d k	 r | S|  j   } | j   } | j } |  j  j } | s_ |  j d } n  | j d  r d | | | f Sd | | | f S(   s;   Find wsa:Action attribute, and return value or the default.t   Requestt   /s   %s%s/%ss   %s/%s/%sN(   R   R   R)   R   R   R   t   endswith(   RY   R   RV   R+   t   ptNamet   msgName(    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s    	c         C   s   |  j  j } | d k	 r | S|  j   j   } |  j   j } |  j  j } | s_ |  j d } n  | j d  r d | | | f Sd | | | f S(   s;   Find wsa:Action attribute, and return value or the default.t   ResponseR'  s   %s%s/%ss   %s/%s/%sN(   R   R   R)   R   R   R   R(  (   RY   R   R+   R)  R*  (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR     s    c         C   s   t  | |  rn g  } | \ } } g  |  j D]? } t | d  r+ t j | | j  r+ | j | k r+ | ^ q+ Sg  |  j D] } t  | |  rx | ^ qx S(   NR   (   R   R4   R   R
   Rf   RN   R   (   t   objectR   t   t_typet   resultRN   R   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   FindExtensions  s    c         C   s   t  | |  ri | \ } } xr |  j D]= } t | d  r% t j | | j  r% | j | k r% | Sq% Wn' x$ |  j D] } t  | |  rs | Sqs Wd  S(   NR   (   R   R4   R   R
   Rf   RN   R   R)   (   R,  R   R-  RN   R   R;   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   FindExtension  s    t   SOAPCallInfoc           B   s   e  Z d  Z d   Z e j Z d Z d Z	 d Z
 d Z d Z d Z d Z d d d  Z d d d  Z d d d  Z d d d	  Z d d d
  Z d   Z d   Z d   Z d   Z d   Z RS(   s   SOAPCallInfo captures the important binding information about a
       SOAP operation, in a structure that is easier to work with than
       raw WSDL structures.c         C   s:   | |  _  g  |  _ g  |  _ g  |  _ g  |  _ d  |  _ d  S(   N(   t
   methodNamet	   inheaderst
   outheaderst   inparamst	   outparamsR)   t   retval(   R   R2  (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    					R*   R  R  i    c         C   s)   t  | | | |  } |  j j |  | S(   s4   Add an input parameter description to the call info.(   t   ParameterInfoR5  Rc   (   R   R   RB   RE   t   element_typet	   parameter(    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   addInParameter  s    c         C   s)   t  | | | |  } |  j j |  | S(   s5   Add an output parameter description to the call info.(   R8  R6  Rc   (   R   R   RB   RE   R9  R:  (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   addOutParameter  s    c         C   s"   t  | | | |  } | |  _ | S(   s7   Set the return parameter description for the call info.(   R8  R7  (   R   R   RB   RE   R9  R:  (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   setReturnParameter  s    	c         C   s;   t  | | | |  } | r' d | _ n  |  j j |  | S(   s6   Add an input SOAP header description to the call info.i   (   t
   HeaderInfot   mustUnderstandR3  Rc   (   R   R   RB   RE   R9  R?  t
   headerinfo(    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   addInHeaderInfo  s
    c         C   s;   t  | | | |  } | r' d | _ n  |  j j |  | S(   s7   Add an output SOAP header description to the call info.i   (   R>  R?  R4  Rc   (   R   R   RB   RE   R9  R?  R@  (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   addOutHeaderInfo  s
    c         C   s   |  j  S(   s5   Return a sequence of the in parameters of the method.(   R5  (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getInParameters  s    c         C   s   |  j  S(   s6   Return a sequence of the out parameters of the method.(   R6  (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getOutParameters  s    c         C   s   |  j  S(   s7   Return param info about the return value of the method.(   R7  (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getReturnParameter  s    c         C   s   |  j  S(   s2   Return a sequence of the in headers of the method.(   R3  (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getInHeaders   s    c         C   s   |  j  S(   s3   Return a sequence of the out headers of the method.(   R4  (   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   getOutHeaders  s    N(   R&   R'   R(   R6   R
   t   NS_SOAP_ENCR   R,   R)   R   R   RE   R   R   R   R;  R<  R=  RA  RB  RC  RD  RE  RF  RG  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR1    s,   						R8  c           B   s/   e  Z d  Z d d d  Z d Z d Z d Z RS(   s>   A ParameterInfo object captures parameter binding information.i    c         C   s@   | r d |  _  n  | d  k	 r* | |  _ n  | |  _ | |  _ d  S(   Ni   (   R9  R)   RE   R   RB   (   R   R   RB   RE   R9  (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    	N(   R&   R'   R(   R)   R6   R9  RE   RX   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR8  	  s
   R>  c           B   s&   e  Z d  Z d d  Z d Z d Z RS(   s=   A HeaderInfo object captures SOAP header binding information.c         C   s   t  j |  | | | |  d  S(   N(   R8  R6   (   R   R   RB   RE   R9  (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR6     s    i    N(   R&   R'   R(   R)   R6   R?  t   actor(    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyR>    s   c         C   s  |  j    j   } |  j   } | j   } | j | } | j | } | j } t |  } |  j   }	 t |	 t	  s t
 d   n  |	 j | _ | j t  }
 |
 d k r t
 d   n  |
 j | _ |
 j p d | _ | j t  } | d k	 r| j | _ | j p| j | _ n  | j } | j d k	 r| | j j } | j } | j t  } | d k	 rqt
 d   qxv | j t  D]e } | | j j | j } | j | j | j p| j | j d | j rd pd } | j  | _  qW| j t!  } | d k rt
 d   n  | j  | _  | j | _ | j" | _" | j d k	 rxg  } x7 | j D] } | j# | j |  qWWn | j j$   } xE | D]: } | j% | j | j p| j d | j rd pd qWn  | j& d k	 ry | | j& j } Wnd t' k
 rXt( j) r$t* d	 | j& j   qY| j+ | j& j  } d
 Gd Gd GHd G| j& j GHn X| j& } | j t  } | d k	 rt
 d   qxv | j t  D]e } | | j j | j } | j, | j | j p| j | j d | j rd pd } | j  | _  qW| j t!  } | d k r/t
 d   n  | j  | _  | j | _ | j" | _" | j d k	 rg  } x7 | j D] } | j# | j |  qrWn | j j$   } | rxE | D]: } | j- | j | j p| j d | j rd pd qWqn  | S(   s;   Return a SOAPCallInfo given a WSDL port and operation name.s   Unsupported binding type.s   Missing soap:binding element.R   s    Mime bindings are not supported.R9  i   i    s   Missing soap:body binding.s3   Recieved message not defined in the WSDL schema: %ss   Warning:s0   Recieved message not defined in the WSDL schema.s
   Adding it.s   Message:N(.   R  R   R   R   Ry   R.   R1  R  R   R  t
   ValueErrorR   R   R   R)   R   R   R   R   R   R   RT   R  R   R  Rw   RU   RA  R   Rs   RB   RE   R   R  R   Rc   t   valuesR;  R   t   KeyErrorR   R5   t   RuntimeErrorR>   RB  R<  (   R[   R   R   RW   RV   RY   R   R.   t   callinfot   addrbindingt   soapbindingt   soap_op_bindingR   RT   t   msgrolet   mimeR;   RU   R   R   Rw   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   callInfoFromWSDL!  s    							 (E   t   identR   t	   cStringIOR    t
   NamespacesR   R   R   R   R   R   R   t   UtilityR   R	   R
   R   R   R   R   R   R   R   R   RD   R2   R=   R   R?   R   R   RA   R   R   R:   R  R   R  R   R  R  R  R  R   R  R   R  R  R	  R
  R  R  t	   ExceptionR9   R  R   Ri   R^   Rk   R   R   R   RB   R/  R0  R1  R8  R>  RT  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/WSDLTools.pyt   <module>
   sh   4(( <F'hM/^Sg)A"						
		O	