Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

.NET Web Services

 
 
Jeremiah McElroy
Guest
Posts: n/a
 
      07-21-2003
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 = {
'xmlnssi' : 'http://www.w3.org/2001/XMLSchema-instance',
'xmlnssd' : '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



 
Reply With Quote
 
 
 
Reply

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 vs.net? 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



Advertisments