.NET Web Services

Discussion in 'Python' started by Jeremiah McElroy, Jul 21, 2003.

  1. 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
     
    Jeremiah McElroy, Jul 21, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nick
    Replies:
    1
    Views:
    6,178
    Alvin Bruney - ASP.NET MVP
    Sep 12, 2005
  2. Anup
    Replies:
    1
    Views:
    2,808
    Mark Rae
    May 9, 2006
  3. imlakhani

    Web Services Restful Services

    imlakhani, Dec 16, 2009, in forum: Java
    Replies:
    1
    Views:
    435
    Jeffrey H. Coffield
    Dec 16, 2009
  4. va
    Replies:
    0
    Views:
    173
  5. John
    Replies:
    4
    Views:
    467
Loading...

Share This Page