.NET Web Services

J

Jeremiah McElroy

I am attempting to connect from my local machine to a .NET web service I
found on Xmethods.net which provides dictionary lookups. I am running
windows XP with Python 2.2.3 and win32all-152. I'm using ZSI 1.2.

When I attempt to contact the web serivce, I see the following stack trace:

Traceback (most recent call last):
File
"C:\Python22\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
line 307, in RunScript
debugger.run(codeObject, __main__.__dict__, start_stepping=0)
File "C:\Python22\lib\site-packages\Pythonwin\pywin\debugger\__init__.py",
line 60, in run
_GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
File "C:\Python22\lib\site-packages\Pythonwin\pywin\debugger\debugger.py",
line 591, in run
exec cmd in globals, locals
File "C:\Documents and Settings\mcelroyj.FACILITY9.000\Desktop\lookup.py",
line 39, in ?
result_list = b.Send( u, 'GetEEMeaning', DictRequest(word) )
File "C:\Python22\Lib\site-packages\ZSI\client.py", line 175, in Send
self.h.connect()
File "C:\Python22\lib\httplib.py", line 516, in connect
socket.SOCK_STREAM):
gaierror: (7, 'getaddrinfo failed')

The source follows. I'm fairly new to using web services in Python, and I
have only found very limited information on using them, so I'm extrapolating
what I can from the docs.

Thanks,

Jeremiah

SOURCE:

#!/usr/bin/env python

import sys
import xml
from ZSI import TC
from ZSI.client import Binding

FULL_DICT_NS = "http://www.xceer.com/trans/dic2.asmx?WSDL"

u = '/trans/dic2.asmx?WSDL'
h = 'http://www.xceer.com'
n = 'http://tempuri.org/'
SOAPMethod = 'GetEEMeaning'
SoapAction = n + SOAPMethod
dict = {
'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/'
}
b = Binding( url=u, host=h, port=80, ns=n, nsdict=dict,
soapaction=SOAPMethod )

try:
word = sys.argv[1]
except IndexError:
print 'No word given, looking up "curmudgeon"'
word = 'curmudgeon'

class DictRequest:
def __init__( self, word ):
self.englishWord = word

DictRequest.typecode = TC.Struct(DictRequest,
[TC.String('englishWord')],
'GetEEMeaning',
inline=1)

try:
result_list = b.Send( u, 'GetEEMeaning', DictRequest(word) )

print "result_list: ", result_list
except:
raise
print 'reply : ', b.reply_code
print 'reply_msg : ', b.reply_msg
print 'headers : ', b.reply_headers
print 'data : ', b.data
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top