Thanks for your reply! I used the proxy because I checked from the source code that proxy is the only place I can pass my username and password to pycurl from SoapClient class.
I can connect to this SOAP service directly with pycurl using the code you provided. But I want to create a SoapClient object based on this SOAP service. I still cannot figure it out yet. On Monday, June 8, 2015 at 5:28:08 PM UTC-4, Derek wrote: > > a simple monkey patch will do you. I would suggest you don't import into > the base namespace though. > import gluon.contrib.pysimplesoap.client as ssClient > > then do the monkey... > ssClient.Http = set_http_wrapper(library='pycurl') > > and use it like normal. > > I don't get why you are trying to use a proxy? > > import pycurl > > name='bob' > pwd='pwd1' > url="https://mywebservice" > > curl = pycurl.Curl() > curl.setopt(pycurl.URL, url) > curl.setopt(pycurl.SSL_VERIFYPEER, 0) > > curl.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_NTLM) > curl.setopt(pycurl.USERPWD, "{}:{}".format(name, pwd)) > > curl.perform() > curl.close() > > > On Monday, June 8, 2015 at 11:45:44 AM UTC-7, Pengfei Yu wrote: >> >> Hi Derek, >> >> Thanks for your reply! I saw similar source code as well. But there is no >> document how to set it up using pysimplesoap. Could you provide an example? >> >> I tried to use following, but it cannot work. >> import sys,time >> sys.path.append("/home/www-data/web2py") >> import pprint >> >> >> from gluon.contrib.pysimplesoap.client import * >> from gluon.contrib.pysimplesoap.transport import * >> >> >> user = 'XXXXXXX' >> password = "***********" >> >> proxy={'proxy_user':user,'proxy_pass':password} >> Http = set_http_wrapper(library='pycurl') >> client=SoapClient(wsdl="https://54.153.5.133:53441/ForAGISService?wsdl", >> proxy=proxy) >> >> >> >> Thanks! >> >> On Monday, June 8, 2015 at 12:18:38 PM UTC-4, Derek wrote: >>> >>> looks like pycurl is supported by pysimplesoap. That supports NTLM. See >>> line 67. >>> >>> >>> https://code.google.com/p/pysimplesoap/source/browse/pysimplesoap/client.py?r=6ed06397b4f0c1894156ee5d0a1c165f80ed6a68 >>> >>> >>> On Monday, June 8, 2015 at 7:28:39 AM UTC-7, Pengfei Yu wrote: >>>> >>>> Hi, >>>> >>>> I am trying to access a web service which requires windows NTLM >>>> authorization. I am able to successfully implement it using suds python >>>> library with following code: >>>> >>>> from suds.transport.http import * >>>> from suds.transport.https import WindowsHttpAuthenticated >>>> from suds.client import * >>>> >>>> import time >>>> >>>> >>>> sampleID = "AAAAAA" >>>> user = 'XXXXXXX' >>>> password = "***********" >>>> url = "https://54.153.5.133:53441/ForAGISService?wsdl" >>>> >>>> >>>> transport = WindowsHttpAuthenticated(username=user, password=password) >>>> client = Client(url, transport=transport) >>>> >>>> >>>> print "List of methods for this web service:" >>>> print [method for method in client.wsdl.services[0].ports[0].methods] >>>> >>>> >>>> print "\nsample info:" >>>> print client.service.GetSampleInfoById(sampleID) >>>> >>>> The NTLM transport is supported by python-ntlm package as mentioned in >>>> https://fedorahosted.org/suds/wiki/Documentation#WindowsNTLM. >>>> >>>> But I prefer to use pysimplesoap as SOAP client in my web2py >>>> application. I wonder if there is also an feasible approach to implement >>>> it >>>> with pysimplesoap + python-ntlm? If someone could provide a code example, >>>> that will be perfect. >>>> >>>> Thanks! >>>> >>>> >>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

