PyXML and SOAPpy installation for Zope
I am trying to create some External Methods in Zope to access some simple web services. I have both these packages working under the default Python installation on my server, but I don't have a clue on how to get them to install in the python setup for Zope. I'm not even sure if they will work under Zope, so I'm seeking some advice. The last thing I want to do is screw up my Zope installation. If anyone can offer some help that would be great. Here's my current config info.... charlie ------------------------- Zope Version (Zope 2.6.1 (binary release, python 2.1, linux2-x86), python 2.1.3, linux2) Python Version 2.1.3 (#1, Sep 19 2002, 13:15:46) [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] System Platform linux2 SOFTWARE_HOME /usr/local/Zope-2.6.1-linux2-x86/lib/python ZOPE_HOME /usr/local/Zope-2.6.1-linux2-x86 INSTANCE_HOME /usr/local/Zope-2.6.1-linux2-x86 CLIENT_HOME /usr/local/Zope-2.6.1-linux2-x86/var
On Tue, Jul 22, 2003 at 02:23:46PM -0400, Charlie Jones wrote:
I am trying to create some External Methods in Zope to access some simple web services. I have both these packages working under the default Python installation on my server, but I don't have a clue on how to get them to install in the python setup for Zope.
You should be able to install them in the zope SOFTWARE_HOME and then import and use them as usual (for python programs) from your External Methods. If you installed a binary version of Zope that comes with its own python executable, you could do this to install the software: cd some_distutils_compatible_python_package /usr/local/Zope-2.6.1-linux2-x86/bin/python setup.py install If you are running some other python executable, you can add command line arguments to the above 'install' command to direct it to install the software into the Zope SOFTWARE_HOME. Or you could let it install in that python's default library -- it's all the same as far as being importable into an External Method. -- Fred Yankowski fred@ontosys.com tel: +1.630.879.1312 OntoSys, Inc PGP keyID: 7B449345 fax: +1.630.879.1370 www.ontosys.com 38W242 Deerpath Rd, Batavia, IL 60510-9461, USA
Ok..the suggestions below seem to have worked for installing the libs. I can now run the test scripts that came with SOAPpy with the Zope python interpreter. Now I am trying create some External Methods based off of these test scripts. I am running into a problem. I think it's related to the import statements I am using. Here's the imports I'm doing for the methods, these are taken directly from the test scripts that run fine against the Zope python interpreter: import os, re import sys from SOAPpy import SOAPProxy When I try to access the external methods I get the following error from Zope: Error Type: ImportError Error Value: cannot import name SOAPProxy Other than the import statements above, the only other references to SOAPProxy are in the following form: server = SOAPProxy(SoapEndpointURL, http_proxy=proxy) The parameter variables are set before this statement. As I mentioned before, running the test scripts against the Zope version of python works fine. Does Zope handle importing differently than python? Here's the method code I created in the Extensions directory. Creating the External Methods works fine, it's just when I try to access them via dtml. -------------------------------------------------- import os, re import sys from SOAPpy import SOAPProxy def getTemp(zip): try: proxy_url=os.environ['http_proxy'] phost, pport = re.search('http://([^:]+):([0-9]+)',proxy_url).group(1,2) proxy = "%s:%s" % (phost, pport) except: proxy = None SoapEndpointURL = 'http://services.xmethods.net:80/soap/servlet/rpcrouter' MethodNamespaceURI = 'urn:xmethods-Temperature' # Do it inline ala SOAP::LITE, also specify the actually ns server = SOAPProxy(SoapEndpointURL, http_proxy=proxy) result = server._ns('ns1', MethodNamespaceURI).getTemp(zipcode=zip) def translate(to, phrase): try: proxy_url=os.environ['http_proxy'] phost, pport = re.search('http://([^:]+):([0-9]+)', proxy_url).group(1,2) proxy = "%s:%s" % (phost, pport) except: proxy = None server = SOAPProxy("http://services.xmethods.com:80/perl/ soaplite.cgi",http_proxy=proxy) babel = server._ns('urn:xmethodsBabelFish#BabelFish') result = babel.BabelFish(translationmode = to,sourcedata = phrase) On Tuesday, July 22, 2003, at 03:41 PM, Fred Yankowski wrote:
On Tue, Jul 22, 2003 at 02:23:46PM -0400, Charlie Jones wrote:
I am trying to create some External Methods in Zope to access some simple web services. I have both these packages working under the default Python installation on my server, but I don't have a clue on how to get them to install in the python setup for Zope.
You should be able to install them in the zope SOFTWARE_HOME and then import and use them as usual (for python programs) from your External Methods. If you installed a binary version of Zope that comes with its own python executable, you could do this to install the software:
cd some_distutils_compatible_python_package /usr/local/Zope-2.6.1-linux2-x86/bin/python setup.py install
If you are running some other python executable, you can add command line arguments to the above 'install' command to direct it to install the software into the Zope SOFTWARE_HOME. Or you could let it install in that python's default library -- it's all the same as far as being importable into an External Method.
-- Fred Yankowski fred@ontosys.com tel: +1.630.879.1312 OntoSys, Inc PGP keyID: 7B449345 fax: +1.630.879.1370 www.ontosys.com 38W242 Deerpath Rd, Batavia, IL 60510-9461, USA
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
I have it working...aside from not having my methods returning anything <blush>...I restarted Zope, and that seemed to fix something. thanks for all your help. On Tuesday, July 22, 2003, at 04:57 PM, Charlie Jones wrote:
Ok..the suggestions below seem to have worked for installing the libs. I can now run the test scripts that came with SOAPpy with the Zope python interpreter. Now I am trying create some External Methods based off of these test scripts. I am running into a problem. I think it's related to the import statements I am using.
Here's the imports I'm doing for the methods, these are taken directly from the test scripts that run fine against the Zope python interpreter: import os, re import sys from SOAPpy import SOAPProxy
When I try to access the external methods I get the following error from Zope: Error Type: ImportError Error Value: cannot import name SOAPProxy
Other than the import statements above, the only other references to SOAPProxy are in the following form: server = SOAPProxy(SoapEndpointURL, http_proxy=proxy)
The parameter variables are set before this statement. As I mentioned before, running the test scripts against the Zope version of python works fine. Does Zope handle importing differently than python?
Here's the method code I created in the Extensions directory. Creating the External Methods works fine, it's just when I try to access them via dtml. -------------------------------------------------- import os, re import sys from SOAPpy import SOAPProxy
def getTemp(zip): try: proxy_url=os.environ['http_proxy'] phost, pport = re.search('http://([^:]+):([0-9]+)',proxy_url).group(1,2) proxy = "%s:%s" % (phost, pport) except: proxy = None
SoapEndpointURL = 'http://services.xmethods.net:80/soap/servlet/rpcrouter' MethodNamespaceURI = 'urn:xmethods-Temperature'
# Do it inline ala SOAP::LITE, also specify the actually ns
server = SOAPProxy(SoapEndpointURL, http_proxy=proxy) result = server._ns('ns1', MethodNamespaceURI).getTemp(zipcode=zip)
def translate(to, phrase): try: proxy_url=os.environ['http_proxy'] phost, pport = re.search('http://([^:]+):([0-9]+)', proxy_url).group(1,2) proxy = "%s:%s" % (phost, pport) except: proxy = None
server = SOAPProxy("http://services.xmethods.com:80/perl/ soaplite.cgi",http_proxy=proxy) babel = server._ns('urn:xmethodsBabelFish#BabelFish')
result = babel.BabelFish(translationmode = to,sourcedata = phrase)
On Tuesday, July 22, 2003, at 03:41 PM, Fred Yankowski wrote:
On Tue, Jul 22, 2003 at 02:23:46PM -0400, Charlie Jones wrote:
I am trying to create some External Methods in Zope to access some simple web services. I have both these packages working under the default Python installation on my server, but I don't have a clue on how to get them to install in the python setup for Zope.
You should be able to install them in the zope SOFTWARE_HOME and then import and use them as usual (for python programs) from your External Methods. If you installed a binary version of Zope that comes with its own python executable, you could do this to install the software:
cd some_distutils_compatible_python_package /usr/local/Zope-2.6.1-linux2-x86/bin/python setup.py install
If you are running some other python executable, you can add command line arguments to the above 'install' command to direct it to install the software into the Zope SOFTWARE_HOME. Or you could let it install in that python's default library -- it's all the same as far as being importable into an External Method.
-- Fred Yankowski fred@ontosys.com tel: +1.630.879.1312 OntoSys, Inc PGP keyID: 7B449345 fax: +1.630.879.1370 www.ontosys.com 38W242 Deerpath Rd, Batavia, IL 60510-9461, USA
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists -http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
----- Original Message ----- From: "Charlie Jones" <charlie.jones@cadence-technologies.com> To: <zope@zope.org> Sent: Tuesday, July 22, 2003 8:23 PM Subject: [Zope] PyXML and SOAPpy installation for Zope
I am trying to create some External Methods in Zope to access some simple web services. I have both these packages working under the default Python installation on my server, but I don't have a clue on how to get them to install in the python setup for Zope.
I'm not even sure if they will work under Zope, so I'm seeking some advice. The last thing I want to do is screw up my Zope installation. If anyone can offer some help that would be great.
Don't worry if you only need a SOAP client used by your Zope site. An SOAP client as external method won't screw your installation, even if (very) buggy. You can event turn it into a Python product. In the other hand, serving WSDL/SOAP with Zope is tricky. This certainly requires to patch the ZServer. Don't play with this if you're newbie. --Gilles
participants (4)
-
Charlie Jones -
Charlie Jones -
Fred Yankowski -
Gilles Lenfant