%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/web/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/web/__pycache__/soap.cpython-312.pyc

�

Ϫ�fV��n�dZddlZddlmZddlmZmZmZGd�dej�Z	Gd�d�Z
y)	z�
SOAP support for twisted.web.

Requires SOAPpy 0.10.1 or later.

Maintainer: Itamar Shtull-Trauring

Future plans:
SOAPContext support of some kind.
Pluggable method lookup policies.
�N)�defer)�client�resource�serverc�>�eZdZdZdZdZd�Zd�Zd�Zd�Z	d�Z
dd	�Zy
)�
SOAPPublisherz�Publish SOAP methods.

    By default, publish methods beginning with 'soap_'. If the method
    has an attribute 'useKeywords', it well get the arguments passed
    as keyword args.
    �zUTF-8c�"�t|d|zd�S)z�Lookup published SOAP function.

        Override in subclasses. Default behaviour - publish methods
        starting with soap_.

        @return: callable or None if not found.
        zsoap_%sN)�getattr)�self�functionNames  �2/usr/lib/python3/dist-packages/twisted/web/soap.py�lookupFunctionzSOAPPublisher.lookupFunction(s���t�Y��5�t�<�<�c��|jj�}tj|ddd�\}}}}|j|j
|j}	}}t|�r|�}t|	�r|	�}	|j|�}
|
s"|j||�tjSt|
d�r?i}|	j�D]\}}
|
|t|�<�tj |
fi|��}ntj |
g|���}|j#|j$||�|j'|j(||�tjS)zHandle a SOAP command.r	�useKeywords)�content�read�SOAPpy�parseSOAPRPC�_name�_aslist�_asdict�callabler�_methodNotFoundr�NOT_DONE_YET�hasattr�items�strr�
maybeDeferred�addCallback�
_gotResult�
addErrback�	_gotError)r�request�data�p�header�body�attrs�
methodName�args�kwargs�function�keywords�k�v�ds               r�renderzSOAPPublisher.render2s.�����#�#�%��!'�!4�!4�T�1�a��!C���6�4��#$�7�7�A�I�I�q�y�y�&�D�
��D�>��6�D��F���X�F��&�&�z�2���� � ��*�5��&�&�&��x��/���"�L�L�N�)�D�A�q�'(�H�S��V�$�)��'�'��=�H�=���'�'��8�4�8��	�
�
�d�o�o�w�
�;�	���T�^�^�W�j�9��"�"�"rc���tjtjdtjjzd|z�|j
��}|j
||d��y)Nz	%s:ClientzMethod %s not found��encoding����status)r�	buildSOAP�	faultType�NS�ENV_Tr6�
_sendResponse)rr%r+�responses    rrzSOAPPublisher._methodNotFoundRsX���#�#�����f�i�i�o�o�-�/D�z�/Q�
��]�]�	
��	
���7�H�S��9rc��t|tj�sd|i}tjd|z|i|j��}|j||�y)N�Resultz
%sResponse)�kwr6)�
isinstancer�voidTyper:r6r>)r�resultr%r+r?s     rr"zSOAPPublisher._gotResult[sO���&�&�/�/�2���'�F��#�#��z�)�6�2�T�]�]�
��	
���7�H�-rc�(�|j}t|tj�r|}n4tjdtjj
zd|z�}tj||j��}|j||d��y)Nz	%s:ServerzMethod %s failed.r5r7r8)	�valuerCrr;r<r=r:r6r>)r�failurer%r+�e�faultr?s       rr$zSOAPPublisher._gotErrorcsu���M�M���a��)�)�*��E��$�$��f�i�i�o�o�-�/B�Z�/O��E��#�#�E�D�M�M�B�����7�H�S��9rc��|j|�|j�d|jz}nd}|jd|�|jdtt	|���|j|�|j
�y)Nztext/xml; charset="%s"�text/xmlzContent-typezContent-length)�setResponseCoder6�	setHeaderr�len�write�finish)rr%r?r9�mimeTypes     rr>zSOAPPublisher._sendResponsensm������'��=�=�$�/�$�-�-�?�H�!�H����.�(�3����*�C��H�
�,>�?��
�
�h�����rN)��)�__name__�
__module__�__qualname__�__doc__�isLeafr6rr3rr"r$r>�rrrrs4����F��H�=�#�@:�.�	:�
rrc�$�eZdZdZdd�Zd�Zd�Zy)�ProxyaA Proxy for making remote SOAP calls.

    Pass the URL of the remote SOAP server to the constructor.

    Use proxy.callRemote('foobar', 1, 2) to call remote method
    'foobar' with args 1 and 2, proxy.callRemote('foobar', x=1)
    will call foobar with named argument 'x'.
    Nc�.�||_||_||_y)N)�url�	namespacer()rr]r^r(s    r�__init__zProxy.__init__�s�����"�����rc��tj|�}t|d�r|jSt	|�dk(r|dS|S)NrAr	r)rrrrArO)rrEs  r�_cbGotResultzProxy._cbGotResult�sC���$�$�V�,���6�8�$��=�=� �
��[�A�
��!�9���Mrc���tj||||j|j��}t	j
|j|dd|d���j|j�S)N)r,rB�methodr(r^�POSTrL)zcontent-type�
SOAPAction)�postdatarc�headers)	rr:r(r^r�getPager]r!ra)rrcr,r-�payloads     r�
callRemotezProxy.callRemote�sc���"�"�����;�;��n�n�
���~�~��H�H���%/�v�F�	
�
�+�d�'�'�
(�	)r)NN)rTrUrVrWr_rarjrYrrr[r[{s����
�
)rr[)rWr�twisted.internetr�twisted.webrrr�Resourcerr[rYrr�<module>rns9��
��"�1�0�]�H�%�%�]�@+)�+)r

Zerion Mini Shell 1.0