[Zope-Checkins] CVS: Zope3 - test_soap.py:1.1.2.1 test_xmlrpc.py:1.1.2.1 z3.py:1.1.2.18.2.2
Stephan Richter
srichter@cbu.edu
Wed, 13 Mar 2002 05:57:58 -0500
Update of /cvs-repository/Zope3
In directory cvs.zope.org:/tmp/cvs-serv11175
Modified Files:
Tag: srichter-OFS_Formulator-branch
z3.py
Added Files:
Tag: srichter-OFS_Formulator-branch
test_soap.py test_xmlrpc.py
Log Message:
- Added some more tests. Won;t do more, since Publisher is being redesigned
later this week. I will wait until then.
- Added preliminary SOAP support, so we can test Mozilla's SOAP
capabilities. Unfortunately, soaplib is very old; I will look into using
SOAPpy instead. It seems fairly complete.
=== Added File Zope3/test_soap.py ===
from Zope.Publisher.SOAP import soaplib
server = soaplib.Server('http://physics.cbu.edu:8082/loaded/methods;view')
server.setLimit(1004)
print server.getLimit()
print server.objectIds()
=== Added File Zope3/test_xmlrpc.py ===
import xmlrpclib
import string, httplib
from base64 import encodestring
# This is the Basic Auth Transport class of Amos' XMLRPC HowTo
# see http://www.zope.org/Members/Amos/XML-RPC
class BasicAuthTransport(xmlrpclib.Transport):
def __init__(self, username=None, password=None):
self.username=username
self.password=password
def request(self, host, handler, request_body):
# issue XML-RPC request
h = httplib.HTTP(host)
h.putrequest("POST", handler)
# required by HTTP/1.1
h.putheader("Host", host)
# required by XML-RPC
h.putheader("User-Agent", self.user_agent)
h.putheader("Content-Type", "text/xml")
h.putheader("Content-Length", str(len(request_body)))
# basic auth
if self.username is not None and self.password is not None:
h.putheader("AUTHORIZATION", "Basic %s" % string.replace(
encodestring("%s:%s" % (self.username, self.password)),
"\012", ""))
h.endheaders()
if request_body:
h.send(request_body)
errcode, errmsg, headers = h.getreply()
if errcode != 200:
raise xmlrpclib.ProtocolError(
host + handler,
errcode, errmsg,
headers
)
return self.parse_response(h.getfile())
server = xmlrpclib.Server('http://physics.cbu.edu:8081/loaded/methods;view')
server.setLimit(3004)
print server.getLimit()
print server.objectIds()
=== Zope3/z3.py 1.1.2.18.2.1 => 1.1.2.18.2.2 ===
XMLRPCResponsePayload
+from Zope.Server.PublisherServers import PublisherSOAPServer
+from Zope.App.ZopePublication.SOAP.SOAPPublication import SOAPPublication
+from Zope.Publisher.SOAP.SOAPPayload import SOAPRequestPayload, \
+ SOAPResponsePayload
+
+
from Zope.App.Security.SimpleSecurityPolicies import \
PermissiveSecurityPolicy
from Zope.App.Security.SecurityManager import setSecurityPolicy
@@ -94,6 +100,13 @@
xmlrpc_response_payload = XMLRPCResponsePayload()
PublisherXMLRPCServer(xmlrpc_request_payload, xmlrpc_response_payload,
'', 8081, task_dispatcher=td, verbose=1, hit_log=hit_log)
+
+# SOAP Server
+soap_publication = SOAPPublication(DB)
+soap_request_payload = SOAPRequestPayload(soap_publication)
+soap_response_payload = SOAPResponsePayload()
+PublisherSOAPServer(soap_request_payload, soap_response_payload,
+ '', 8082, task_dispatcher=td, verbose=1, hit_log=hit_log)
try:
asyncore.loop()