zolakt 0 Newbie Poster

Hi,

I'm having a lot of problem making a SAOP client in Python.
I have tried various methods, but non of them seems to work for me.

I have a .Net web service, available from an IIS server on another machine.
I can access it trough browser, and everything works fine.

The function I need to call is .RunTranslate.
It takes one string argument inText, and 2 custom enumeration arguments, inLang and outLang (I suppose they are serialized/deserialized as string), a returns one string value as translation.

Now, what I have tried:

1. SOAPy library
import soap
server = soap.get_proxy('http://192.168.1.72/sts/TranslatorService.asmx?wsdl','wsdl')
translation = server.RunTranslate(inText="translate this", inLang="English", outLang="German")

I get the following error:
File "/usr/lib/python2.5/site-packages/soap.py", line 263, in __init__
sys.exit(1)
NameError: global name 'sys' is not defined

I tried to make the proxy with sdl, not wsdl, with:
server = soap.get_proxy('http://192.168.1.72/sts/TranslatorService.asmx?SDL','sdl')

But then I get this error
File "/usr/lib/python2.5/site-packages/_xmlplus/dom/ext/reader/PyExpat.py", line 65, in fromStream
success = self.parser.ParseFile(stream) xml.parsers.expat.
ExpatError: mismatched tag: line 61, column 16

2. ZSI library
from ZSI import ServiceProxy
server = ServiceProxy('http://192.168.1.72/sts/TranslatorService.asmx?wsdl')
translation = server.RunTranslate(inText="translate this", inLang="English", outLang="German")

This produces the following error
File "./main.py", line 25, in translate
server = ServiceProxy('http://192.168.1.72/sts/TranslatorService.asmx?wsdl')
TypeError: 'module' object is not callable

3. Sending HTTP POST request with httplib
import httplib
httpServ = httplib.HTTPConnection("http://192.168.1.72", 80)
httpServ.connect()
httpServ.request('POST', '/sts/TranslatorService.asmx?op=RunTranslate','inText=translat+this&inLang=English&outLang=Croatian')

response = httpServ.getresponse()
if response.status == httplib.OK:
print (response.read())
httpServ.close()

The error:
File "/usr/lib/python2.5/httplib.py", line 667, in connect
socket.SOCK_STREAM):
socket.gaierror: (-3, 'Temporary failure in name resolution')

4. Sending HTTP POST request with urllib, urllib2
I don't have a code for this, I deleted it. But it produced similar errors like httplib

I'm working in Maemo5 scratchbox, which is a kind of emulator of Nokia N900 system.
I have noticed that scratchbox has Internet connection, because I can use apt-get, with no problems.
But it doesn't render HTML, because I can't open anything in its browser.
Maybe this is creating all the problems, or am I doing something completely wrong.

Any help would be greatly appreciated.