Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
URL错误:<;urlopen错误[Errno 111]连接被拒绝>;python_Python_Suds - Fatal编程技术网

URL错误:<;urlopen错误[Errno 111]连接被拒绝>;python

URL错误:<;urlopen错误[Errno 111]连接被拒绝>;python,python,suds,Python,Suds,我有一个简单的sudswebservice客户端,它已经工作了一段时间了。然而,现在每当我运行它时,我都会得到“urllib2.urleror:”。请注意,我可以成功ping远程主机,也可以在远程主机端口上telnet。我可以检查哪些方面来排除故障?下面是我的代码片段: from suds.client import Client from suds.wsse import * security = Security() token = UsernameToken('user', 'pass')

我有一个简单的sudswebservice客户端,它已经工作了一段时间了。然而,现在每当我运行它时,我都会得到“urllib2.urleror:”。请注意,我可以成功ping远程主机,也可以在远程主机端口上telnet。我可以检查哪些方面来排除故障?下面是我的代码片段:

from suds.client import Client
from suds.wsse import *
security = Security()
token = UsernameToken('user', 'pass')
token.setnonce()
token.setcreated()
security.tokens.append(token)

def func():
    someVar = '2222222'
    try:
        url ='http://IP:Port/SomeWebServices/service?wsdl'
        client = Client(url)
        return client.service.SomeMeth(someVat)
    except Exception,x:
        raise x

if __name__ == '__main__':
    response = func()
    print response['responseCode']
    print response['balance']
也许你可以试试:

    url ="your?wsdl"

    client = Client(url,cache=None)

    client.set_options(location=url)  // new line

    return client.service.SomeMeth(someVat)

@用户3473526。我没有回答你的问题。我刚刚编辑了这个答案。@EdmundChi很荣幸you@user3473526我只是尽力了。