调用webservice出错,不知道原因

小平123 发布于 2014/10/23 15:16
阅读 537
收藏 0

 

弄了个suds调用webservice的代码.报错


Suds ( https://fedorahosted.org/suds/ ) version: 0.4 GA build: R699-20100913

Service ( messagecentertarget ) tns="http://loushang.ws"
Prefixes (2)
ns0 = "http://loushang.ws"
ns2 = "http://util.java/xsd"
Ports (2):
(IcommonSendMessageCenterHttpSoap11Endpoint)
Methods (1):
commonSendMessage(ns2:Map args0, )
Types (2):
Exception
ns2:Map
(IcommonSendMessageCenterHttpSoap12Endpoint)
Methods (1):
commonSendMessage(ns2:Map args0, )
Types (2):
Exception
ns2:Map

Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\webservices - 副本.py", line 19, in <module>
result = client.service.commonSendMessage( **maps )
File "build\bdist.win32\egg\suds\client.py", line 542, in __call__
return client.invoke(args, kwargs)
File "build\bdist.win32\egg\suds\client.py", line 602, in invoke
result = self.send(soapenv)
File "build\bdist.win32\egg\suds\client.py", line 637, in send
reply = transport.send(request)
File "build\bdist.win32\egg\suds\transport\https.py", line 64, in send
return HttpTransport.send(self, request)
File "build\bdist.win32\egg\suds\transport\http.py", line 77, in send
fp = self.u2open(u2request)
File "build\bdist.win32\egg\suds\transport\http.py", line 118, in u2open
return url.open(u2request, timeout=tm)
File "E:\Python27\lib\urllib2.py", line 391, in open
response = self._open(req, data)
File "E:\Python27\lib\urllib2.py", line 409, in _open
'_open', req)
File "E:\Python27\lib\urllib2.py", line 369, in _call_chain
result = func(*args)
File "E:\Python27\lib\urllib2.py", line 1173, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "E:\Python27\lib\urllib2.py", line 1148, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 10051] >

不知道是怎么回事,请求帮忙(参数是接收一个map).返回一个map.

代码如下

from suds.client import Client
import urllib

url = 'http://localhost/base/services/messagecentertarget?wsdl'
client = Client(url)
print client
maps = { "PUSH_TYPE": "1" ,"CONTENT":"test", "PARAM1":"13883329482","SEND_ID":"yurp", "SEND_NAME":"yurp"};

result = client.service.commonSendMessage( **maps )
print result

 

加载中
返回顶部
顶部