Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > .NET Web Services

Thread Tools

.NET Web Services

Jeremiah McElroy
Posts: n/a
I am attempting to connect from my local machine to a .NET web service I
found on 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):
"C:\Python22\lib\site-packages\Pythonwin\pywin\framework\" ,
line 307, in RunScript, __main__.__dict__, start_stepping=0)
File "C:\Python22\lib\site-packages\Pythonwin\pywin\debugger\",
line 60, in run
_GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
File "C:\Python22\lib\site-packages\Pythonwin\pywin\debugger\",
line 591, in run
exec cmd in globals, locals
File "C:\Documents and Settings\mcelroyj.FACILITY9.000\Desktop\" ,
line 39, in ?
result_list = b.Send( u, 'GetEEMeaning', DictRequest(word) )
File "C:\Python22\Lib\site-packages\ZSI\", line 175, in Send
File "C:\Python22\lib\", line 516, in connect
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.




#!/usr/bin/env python

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


u = '/trans/dic2.asmx?WSDL'
h = ''
n = ''
SOAPMethod = 'GetEEMeaning'
SoapAction = n + SOAPMethod
dict = {
'xmlnssi' : '',
'xmlnssd' : '',
'xmlns:soap': ''
b = Binding( url=u, host=h, port=80, ns=n, nsdict=dict,
soapaction=SOAPMethod )

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,

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

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

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Services Restful Services imlakhani Java 1 12-16-2009 03:06 PM
Start Web services as Windows Services start Anup ASP .Net 1 05-09-2006 11:44 AM
How .NET web services client handles exceptions from Java web services? John ASP .Net Web Services 4 03-31-2006 10:13 PM
What is the difference between C# windows Services and web services in Nick ASP .Net 1 09-12-2005 02:33 PM
how to implement Services Interface Tier (web services) Szymi MCSD 0 11-03-2003 10:50 AM