Saturday 16 November 2013

How to send xml data to server using webservices in python

We can send xml data to server using web-services using Suds module. In last post we have used suds module for web-services either login or sending report.
Please see my post "How to use web-services in pygtk for desktop application"

Here first you have to install suds module and write below code for sending xml data to services through webservices.

            url = 'http://example.com/src/example.asmx?wsdl'
            uid='example@gmail.com'
            psw='hello@123'
            client = Client(url)
            xml = xdata.parse('../src/example.xml') # or xml.dom.minidom.parseString(xml_string)
            senddata= xml.toprettyxml()
            #print senddata
            data = client.service.Dologin(uid,psw)
            print 'token="%s"' % data
            data1 = client.service.SaveScanData({'senddata':senddata})
Enjoy Guys

No comments:

Post a Comment