Hi piero:

The first choice to connect to a webservice that requires username &
password (add_credentials), you will httplib2 installed:

https://code.google.com/p/httplib2

Then you could do:

client = SoapClient(location = location_wsdl,sessions=True,username='admin',
password='xxxxxx')

Also, assuming your webservice supports basic auth, you could pass the
Authentication http header directly (it shouldn't need to install external
library):

import base64
auth = base64.b64encode('%s:%s' % (username, password)).replace('\n', '')

client = SoapClient(location = location_wsdl, sessions=True, http_headers={'
Authorization': "Basic %s" % auth})

Let me know if this solves your issue,

Best regards


Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com


On Mon, Mar 17, 2014 at 6:02 PM, piero crisci <piero.cri...@gmail.com>wrote:

> Hello i am trying to connect to this wsdl:
> http://docway.demo.3di.it/3diws/services/eXtraWay?wsdl
> It requires http basic authentication  and i am using pysimplesoap 1.10
> and i tried this configuration:
>
> from pysimplesoap.client import SoapClient
> location_wsdl = "http://docway.demo.3di.it/3diws/services";
> wsdl = "http://docway.demo.3di.it/3diws/services/eXtraWay?wsdl";
> client = SoapClient(location =
> location_wsdl,sessions=True,http_headers={'username': 'admin', 'password':
> 'xxxx'},username='admin',password='xxxxxx')
>
> I got this error
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "build\bdist.win32\egg\pysimplesoap\client.py", line 133, in
> __init__
>   File "build\bdist.win32\egg\pysimplesoap\client.py", line 469, in
> wsdl_parse
>   File "build\bdist.win32\egg\pysimplesoap\helpers.py", line 71, in fetch
>   File "build\bdist.win32\egg\pysimplesoap\transport.py", line 121, in
> request
>   File "C:\python27\lib\urllib2.py", line 406, in open
>     response = meth(req, response)
>   File "C:\python27\lib\urllib2.py", line 519, in http_response
>     'http', request, response, code, msg, hdrs)
>   File "C:\python27\lib\urllib2.py", line 444, in error
>     return self._call_chain(*args)
>   File "C:\python27\lib\urllib2.py", line 378, in _call_chain
>     result = func(*args)
>   File "C:\python27\lib\urllib2.py", line 527, in http_error_default
>     raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
> urllib2.HTTPError: HTTP Error 401: Unauthorized
>
> It seems like the basic authenitcation is not supported. am I wrong?
> How i need to change the wsdl call? And how i can use a session to send
> different call?
> Thx for help!
>
> --
> 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 web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to