Python webservice客户端

时间:2010-07-13 14:09:38

标签: python web-services

任何人都可以通过以下JAX-WS API在python中创建一个Web服务客户端吗?

https://109.231.73.12:8090/API?wsdl

当我运行虚拟服务器时,它是自签名的。用户名和密码均为“querty123”

我们可以让它在php中工作就好了而不是python。

所以一个解释你如何设法做到这一点的工作实例将会很棒

由于

1 个答案:

答案 0 :(得分:5)

suds库在Python中简化了这一步:

>>> from suds.client import Client
>>> url = 'https://109.231.73.12:8090/API?wsdl'
>>> client = Client(url, username='qwerty123', password='qwerty123')
>>> client.service.addition(1, 2)
3
>>> client.service.hello('John')
HelloJohn
>>> client.service.xToThePowerOfy(2, 16)
18
>>> print client # automagic documentation

Suds ( https://fedorahosted.org/suds/ )  version: 0.4 (beta)  build: R685-20100513

Service ( BasicService ) tns="http://service.basic.com/"
   Prefixes (1)
      ns0 = "http://service.basic.com/"
   Ports (1):
      (BasicPort)
         Methods (3):
            addition(xs:int x, xs:int y, )
            hello(xs:string name, )
            xToThePowerOfy(xs:int x, xs:int y, )
         Types (6):
            addition
            additionResponse
            hello
            helloResponse
            xToThePowerOfy
            xToThePowerOfyResponse