Am 29.01.10 17:53, schrieb Sells, Fred:
Thanks Dietz for your earlier replies that helped me avoid some dead
ends.
I'm still trying to get the basics to work with Python server-side web
service.
Since tgwebservices is not compatible with tg 2.0, I need to use either
tg1.0 or a different technique.
It turns out that the approach I thought I could use of parsing the soap
request via a generic mod_python function is not working. More
accurately it reveals that I don't have sufficient understanding of
what's really happening and really need some help. While I know python
well, my soap experience is limited to clients and I built the entire
XML request via strings and the %s operator. Now that I have to do the
server, I cannot seem to get as far as receiving the soap xml and just
parsing it -- perhaps not elegant but adequate.
I know my client side test code is good because I use it with another
vendor's web service.
I've tried this code based on an existing mod_python implementation with
Python 2.4 and Apache 2.2
The HTTP works, just to verify I don't have a really dumb error
http://192.168.204.216/python/hrapi/RetrieveDataByXMLStream?a=3&b=abcd
returns
RetrieveDataByXMLStream method (()) {'a': '3', 'b': 'abcd'}
As expected
------------server side code -------------------
The mod_python code is installed at
/var/www/python/hrapi/index.py and is shown below (edited for brevity)
def RetrieveDataByXMLStream(req, *args, **kwargs):
req.content_type = 'text/plain'
text = 'RetrieveDataByXMLStream method (%s) %s' %
( str(args), str(kwargs) )
return text
____________________________________________
I get the following error 'COMMERROR status=501, reason=Method Not
Implemented'
-----------------------Client side code------------------
class HTTPConnection(httplib.HTTPConnection):
def xrequest(self, method, url, body=None, headers={}):
print '===========================Exedute Request'
print 'headers', headers
print 'method', method
print 'url', url
print 'body', body
response = self.request(method, url, body, headers)
print 'response', response
return response
-------------------debug output on client side--------------
===========================Exedute Request
headers {'SOAPAction':
'http://www.ResourceSystem.com/EIS/RetrieveDataByXMLStream',
'Content-type': 'text/xml', 'Accept': 'text/xml'}
method POST
url /python/hrapi/test1
body
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<EISAuthHeader xmlns="http://www.ResourceSystem.com/EIS/">
<AuthorizationCode>zzzzzz(editied for
security)z</AuthorizationCode>
</EISAuthHeader>
</soap:Header>
<soap:Body>
<RetrieveDataByXMLStream xmlns="http://www.ResourceSystem.com/EIS/">
<IncomingXMLStream>
<Parameter xmlns="urn:inputparameters-schema">
<ReportName>Compressed ADL
Interface</ReportName>
<FilterList>
.... snipped for brevity ....
</FilterList>
</Parameter>
</IncomingXMLStream>
</RetrieveDataByXMLStream>
</soap:Body>
</soap:Envelope>
From what I gather, that's a problem of Apache setup, not python or
mod_python. I had this yesterday when setting up a
subversion-over-apache-service, and got the same error. Being a proud
owner of an incredible efficient GC-algorithm in my brain, the knowledge
about the concrete reason immediatly vanished. So... I suggest you start
googling for apache, method not supported & mod_python, that should get
you started.
Only after you actually have you serverside-python-code running things
get interesting.
Diez
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en.