Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python webservice client

Can anyone make a webservice client in python from the following JAX-WS API?

https://109.231.73.12:8090/API?wsdl

As I'm running this of a virtual server it's self signed. Both the username and password are 'querty123'

We can get it to work in php just fine not python.

So a working example explaining how you managed to do it would be great

Thanks

like image 777
x20mar Avatar asked Jul 13 '10 14:07

x20mar


People also ask

Can Python be used for Web services?

By using Python and REST APIs, you can retrieve, parse, update, and manipulate the data provided by any web service you're interested in.

How do I call a webservice in Python?

The easiest way to GET or POST a response from a web service from Python is using requests. You do not note what version of python you are using so you may need to install requests using the command pip install requests. You also do not indicate if your web service requires authentication.

What is Python Web services?

Web services can be generally regarded as functions or functionality of applications or systems exposed over the Web using standardised message formats and typically interfaced to other software using traditional APIs, although "message-centric" usage of such services is also possible and may be favoured by certain ...


1 Answers

The suds library makes this a snap in 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
like image 107
Will McCutchen Avatar answered Oct 05 '22 03:10

Will McCutchen