[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/SOAP - SOAPPayload.py:1.1.2.2
Stephan Richter
srichter@cbu.edu
Wed, 13 Mar 2002 11:39:34 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Publisher/SOAP
In directory cvs.zope.org:/tmp/cvs-serv1678/Zope/Publisher/SOAP
Modified Files:
Tag: srichter-OFS_Formulator-branch
SOAPPayload.py
Log Message:
- Switched to SOAPpy library.
- Made the first action in XUL work.
This checkin is primary for people that want to look at the code. I will
probably replace SOAPpy with Brian Lloyd's SOAP implementation later today,
since I have no approval to use SOAPpy in Zope 3 and Brian's stuff is
already ZPL 2.0.
=== Zope3/lib/python/Zope/Publisher/SOAP/SOAPPayload.py 1.1.2.1 => 1.1.2.2 ===
from cgi import FieldStorage, escape
from Zope.Publisher.HTTP.cgi_names import hide_key
+
+
+from SOAPpy import SOAP
import soaplib
from Zope.Publisher.HTTP.IPayload import IRequestPayload, IResponsePayload
@@ -60,9 +63,14 @@
fs = FieldStorage(fp=fp, environ=environ, keep_blank_values=1)
# Parse the request XML structure
- function, request.args = soaplib.loads(fs.value)
- print request.args
+ res = SOAP.parseSOAPRPC(fs.value)
+ function = res._name
+ request.args = []
+ for key in res._keys():
+ request.args.append(res[key])
+ request.args = tuple(request.args)
print function
+ print request.args
# Translate '.' to '/' in function to represent object traversal.
function = function.replace('.', '/')
@@ -112,12 +120,12 @@
def setBody(self, response, body):
""" """
- if isinstance(body, soaplib.Fault):
+ if isinstance(body, SOAP.faultType):
# Convert Fault object to XML-RPC response.
- body = soaplib.dumps(body, envelope=1)
+ body = SOAP.buildSOAP(body, envelope=1)
else:
try:
- body = soaplib.dumps((body,), envelope=1)
+ body = SOAP.buildSOAP(body, envelope=1)
except:
self.exception()
return
@@ -151,14 +159,14 @@
Fault = soaplib.Fault
fault_text = None
try:
- if isinstance(value, Fault):
+ if isinstance(value, SOAP.faultType):
fault_text = value
elif isinstance(value, Exception):
- fault_text = Fault(-1, "Unexpected Zope exception: " + str(value))
+ fault_text = SOAP.faultType(-1, "Unexpected Zope exception: " + str(value))
else:
- fault_text = Fault(-2, "Unexpected Zope error value: " + str(value))
+ fault_text = SOAP.faultType(-2, "Unexpected Zope error value: " + str(value))
except:
- fault_text = Fault(-3, "Unknown Zope fault type")
+ fault_text = SOAP.faultType(-3, "Unknown Zope fault type")
# Do the damage.
response.setBody(fault_text)