Web 服务通信期间 URLOpen 错误

发布于 2024-12-19 08:50:16 字数 1065 浏览 2 评论 0原文

我必须开发一个通过 python 与 Web 服务通信的应用程序。由于某些原因,我必须在 Windows 服务器计算机上运行此代码(我对此没有太多经验,通常我们使用基于 uint 的系统)。

由于一些沟通问题,我与 api 提供者的沟通不是直接的。因此,我必须将我的问题邮寄给另一个人,然后他用母语将我的消息通过电子邮件发送给他们,因此我无法从提供商那里获得太多支持。

我的问题是,我使用 suds 作为 Web 服务客户端。 Cleint 似乎成功从服务器获取 WSDL 定义,如下所示:

from suds.client import Client

class SomeClass(Client):
    def __init__(self):
        Client.__init__(url)

def myFunc():
    f = SomeClass()
    print f

服务(运输)tns="..."

前缀 (1) ns0 = ....

端口 (2):

    (运输肥皂) 

         方法 (4) 

             获取余额()

...

所以我可以看到 suds 可以到达目标 Web 服务并获取 WSDL 文件。但是,当我调用如下方法时:

def myFunc():
    f = SomeClass()    
    f.GetBalance()


Urllib2.URLError <urlopen error [Errno 10060] A connection attempt
failed because the connected party did not properly respond after a
period of time, or established connection failed because connected
host has failed to respond>

我看不出出了什么问题?

I had to developed an application which will communicate with a Web service via python. I have to run this code on a Windows server machine for some reasons (which i am not much experianced with, notmally we use uint based systems).

My communication with the api provider is not directly because of some communication issies. So i have to mail my problems to another person and he email them my message in the native language, so i could not get much support from the provider because of that.

My problem is, i use suds for web service client. Cleint semmed to succeed to get WSDL definition from the serveer like:

from suds.client import Client

class SomeClass(Client):
    def __init__(self):
        Client.__init__(url)

def myFunc():
    f = SomeClass()
    print f

Service ( transport ) tns="..."

Prefixes (1) ns0 = ....

Ports (2):

    (TransportSoap) 

         Methods (4) 

             GetBalance()

...

So i can see that suds can reach target web service and get the WSDL file. However when i call a method like:

def myFunc():
    f = SomeClass()    
    f.GetBalance()


Urllib2.URLError <urlopen error [Errno 10060] A connection attempt
failed because the connected party did not properly respond after a
period of time, or established connection failed because connected
host has failed to respond>

I could not see what is wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心清如水 2024-12-26 08:50:16

经过一番基于 urlopen 错误 [Errno 10060] 的搜索后,我决定尝试代理使用,结果证明这是解决方案!

如果 WSDL url 是

http://someurl.com:1234/something/somethingmore.asmx?WSDL< /a>


然后使用:

prxy = dict(http='http://someurl.com:1234/')
Client.set_options(proxy=prxy)

绝对解决了问题...

After some search based on urlopen error [Errno 10060], i decided to try proxy usage and it turns out to be the solution!

If WSDL url is

http://someurl.com:1234/something/somethingmore.asmx?WSDL

then using:

prxy = dict(http='http://someurl.com:1234/')
Client.set_options(proxy=prxy)

definitely solves the problem...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文