Look at this example:
from suds.client import Client
url = 'http://xxx.yy.com/etc...'
client = Client(url)
result = client.service.wsExtAuth..ckAuth(username='xx')
The service "wsExtAuth..ckAuth" is not standard (name) and compiler return syntax error. How can I use it?
You could try:
getattr(client.service, 'wsExtAuth..ckAuth')(username='xx')
Also, make sure you're using suds-jurko and not the outdated suds client.
Related
How can i use python zeep module and configure the connection to connect with no proxy?
I need to access an internal WSDL. That means no proxy is needed.
I have tried to create the client:
from zeep import client
client = Client("myURL")
But i am getting an error because is trying to connect with a default proxy
Regards.
Using the information provided in the links provided by Dima,
the following worked for me:
session = requests.Session()
session.trust_env = False
transport = Transport(timeout=10)
transport.session = session
client = Client("your url", transport=transport)
im trying to build an client for an webservice in python with suds. i used the tutorial
on this site: http://www.jansipke.nl/python-soap-client-with-suds. Its working with my own written Webservice and WSDL, but not with the wsdl file i got. The wsdl file is working in soapUI, i can send requests and get an answer. So the problem is, i think, how suds is parsing the wsdl file. I get following error:
urllib2.URLError: <urlopen error [Errno -2] Name or service not known>
Any ideas how to fix that? If you need more information please ask. Thank you!
The error you have given us seems to imply that the URL you are using to access the WSDL is not correct. could you show us a bit more of your code? for example the client instatiation and the url to the WSDL. this might allow others to actually help you.
Olly
# SUDS is primarily built for Python 2.6/7 (Lightweight SOAP client)
# SUDS does not work properly with other version, absolutely no support for 3.x
# Test your code with Python 2.7.12 (I am using)
from suds.client import Client
from suds.sax.text import Raw
# Use your tested URL same format with '?wsdl', Check once in SOAP-UI, below is dummy
# Make sure to use same Method name in below function 'client.service.MethodName'
url = 'http://localhost:8080/your/path/MethodName?wsdl'
#Use your Request XML, below is dummy, format xml=Raw('xml_text')
xml = Raw('<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:diag=" </soapenv:Body></soapenv:Envelope>')
def GetResCode(url, xml):
client = Client(url)
xml_response = (client.service.MethodName(__inject={'msg':xml}))
return xml_response
print(GetResCode(url,xml))
I'm using Python's SUDs lib to access Sharepoint web services.
I followed the standard doc from Suds's website.
For the past 2 days, no matter which service I access, the remote service always returns 403 Forbidden.
I'm using Suds 0.4 so it has built-in support for accessing Python NTLM.
Let me know if anyone has a clue about this.
from suds import transport
from suds import client
from suds.transport.https import WindowsHttpAuthenticated
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
ntlm = WindowsHttpAuthenticated(username='USER_ID', password='PASS')
c_lists = client.Client(url='https://SHAREPOINT_URL/_vti_bin/Lists.asmx?WSDL', transport=ntlm)
#c_lists = client.Client(url='https://SHAREPOINT_URL/_vti_bin/spsearch.asmx?WSDL')
#print c_lists
listsCollection = c_lists.service.GetListCollection()
Are you specifying the username as DOMAIN\USER_ID as indicated in examples for the python-ntlm library? (Also see this answer).
I am using the following python code to display all methods offered by a webservice generated from a wsdl version 2.0 file.
The url is the following:
http://localhost:8080/axis2/services/UserService?wsdl2
Using the above url, the browser displays the wsdl file but when using this url in a python application below, it returns only the following info and nothing related to the webservice methods in question.
Python code
from suds.wsse import *
from suds.client import Client
myclient = Client("http://localhost:8080/axis2/services/UserService?wsdl2")
print myclient
output
Suds ( https://fedorahosted.org/suds/ ) version: 0.3.9 GA build: R659-20100219
it should be returing the methods available in the webservice as in the example https://fedorahosted.org/suds/wiki/Documentation
any idea?
Try removing the /tmp/suds directory. Also try passing cache=None in the Client constructor:
myclient = Client("http://localhost:8080/axis2/services/UserService?wsdl2", cache=None)
It seems that still suds doesn't support WSDL 2.
See https://fedorahosted.org/suds/ticket/479
I want to use Sharepoint with python (C-Python)
Has anyone tried this before ?
I suspect that since this question was answered the SUDS library has been updated to take care of the required authentication itself. After jumping through various hoops, I found this to do the trick:
from suds import WebFault
from suds.client import *
from suds.transport.https import WindowsHttpAuthenticated
user = r'SERVER\user'
password = "yourpassword"
url = "http://sharepointserver/_vti_bin/SiteData.asmx?WSDL"
ntlm = WindowsHttpAuthenticated(username = user, password = password)
client = Client(url, transport=ntlm)
To get the wsdl :
import sys
# we use suds -> https://fedorahosted.org/suds
from suds import WebFault
from suds.client import *
import urllib2
# my 2 url conf
# url_sharepoint,url_NTLM_authproxy
import myconfig as my
# build url
wsdl = '_vti_bin/SiteData.asmx?WSDL'
url = '/'.join([my.url_sharepoint,wsdl])
# we need a NTLM_auth_Proxy -> http://ntlmaps.sourceforge.net/
# follow instruction and get proxy running
proxy_handler = urllib2.ProxyHandler({'http': my.url_NTLM_authproxy })
opener = urllib2.build_opener(proxy_handler)
client = SoapClient(url, {'opener' : opener})
print client.wsdl
main (mean) problem:
the sharepoint-server uses a NTLM-Auth [ :-( ]
so i had to use the NTLM-Auth-Proxy
To Rob and Enzondio : THANKS for your hints !
SOAP with Python is pretty easy. Here's a tutorial from Dive Into Python.
SharePoint exposes several web services which you can use to query and update data.
I'm not sure what web service toolkits there are for Python but they should be able to build proxies for these services without any issues.
This article should give you enough information to get started.
http://www.developer.com/tech/article.php/3104621