ϪfVndZddlZddlmZddlmZmZmZGddejZ GddZ 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)clientresourceserverc>eZdZdZdZdZdZdZdZdZ dZ d d Z y ) SOAPPublisherzPublish 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|zdS)zLookup 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.pylookupFunctionzSOAPPublisher.lookupFunction(stY5t<<c|jj}tj|ddd\}}}}|j|j |j } }}t|r|}t| r| } |j|} | s"|j||tjSt| dr?i} | jD]\} } | | t| <tj | fi| }ntj | g|}|j#|j$|||j'|j(||tjS)zHandle a SOAP command.r useKeywords)contentreadSOAPpy parseSOAPRPC_name_aslist_asdictcallabler_methodNotFoundr NOT_DONE_YEThasattritemsstrr maybeDeferred addCallback _gotResult addErrback _gotError)r requestdatapheaderbodyattrs methodNameargskwargsfunctionkeywordskvds rrenderzSOAPPublisher.render2s.##%!'!4!4T1a!C64#$77AIIqyy&D  D>6D F XF&&z2  * 5&& &x/"LLN)DAq'(HSV$)''=H=''848 doow ; T^^Wj9"""rctjtjdtjjzd|z|j }|j ||dy)Nz %s:ClientzMethod %s not foundencodingstatus)r buildSOAP faultTypeNSENV_Tr6 _sendResponse)r r%r+responses rrzSOAPPublisher._methodNotFoundRsX##   fiioo-/Dz/Q ]]   7HS9rct|tjsd|i}tjd|z|i|j}|j ||y)NResultz %sResponse)kwr6) isinstancervoidTyper:r6r>)r resultr%r+r?s rr"zSOAPPublisher._gotResult[sO&&//2'F##z)62T]]  7H-rc(|j}t|tjr|}n4tjdtjj zd|z}tj ||j}|j||dy)Nz %s:ServerzMethod %s failed.r5r7r8) valuerCrr;r<r=r:r6r>)r failurer%r+efaultr?s rr$zSOAPPublisher._gotErrorcsu MM a)) *E$$fiioo-/BZ/OE##EDMMB 7HS9rc|j||jd|jz}nd}|jd||jdtt ||j ||j y)Nztext/xml; charset="%s"text/xmlz Content-typezContent-length)setResponseCoder6 setHeaderrlenwritefinish)r r%r?r9mimeTypes rr>zSOAPPublisher._sendResponsensm' == $/$--?H!H.(3*CH ,>? hrN)) __name__ __module__ __qualname____doc__isLeafr6rr3rr"r$r>rrrrs4FH=#@:. : rrc$eZdZdZddZdZdZy)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" rctj|}t|dr |jSt |dk(r|dS|S)NrAr r)rrrrArO)r rEs r _cbGotResultzProxy._cbGotResultsC$$V, 68 $== [A  !9 Mrctj||||j|j}t j |j |dd|dj|jS)N)r,rBmethodr(r^POSTrL)z content-type SOAPAction)postdatarcheaders) rr:r(r^rgetPager]r!ra)r rcr,r-payloads r callRemotezProxy.callRemotesc"";;nn  ~~ HH%/vF  +d'' (  )r)NN)rTrUrVrWr_rarjrYrrr[r[{s  )rr[) rWrtwisted.internetr twisted.webrrrResourcerr[rYrrrns9 "10]H%%]@+)+)r