[Zope] PyXML and SOAPpy installation for Zope
Charlie Jones
cj@charlie-jones.com
Tue, 22 Jul 2003 21:54:47 -0400
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 )
>