Hi mariano i still got some problem
I solved the problem with the basic authentication but i still have some 
problem on calling webservice.
The webservice infact need a first call for the db connection ('init' )
After this call you can call the other services.
I made this code :
 
from pysimplesoap.client import SoapClient
from pysimplesoap.client import SoapClient, SimpleXMLElement
location_wsdl = " 
*http://docway.demo.3di.it*/3diws/services/eXtraWay<http://docway.demo.3di.it/3diws/services/eXtraWay>
"
wsdl =  
*http://docway.demo.3di.it/*/3diws/services/eXtraWay?wsdl<http://10.55.38.247:8080/3diws/services/eXtraWay?wsdl>
"
namespace_wsdl = " 
*http://docway.demo.3di.it/*<http://www.google.com/url?q=http%3A%2F%2Fdocway.demo.3di.it%2F3diws%2Fservices%2FeXtraWay%3Fwsdl&sa=D&sntz=1&usg=AFQjCNFAe47af7Nlfx1k8KJR8x-hsRTOAg>
3diws/services/eXtraWay <http://10.55.38.247:8080/3diws/services/eXtraWay>"
import base64
username='admin'
password='xxxx'
auth = base64.b64encode('%s:%s' % (username, password))
client = SoapClient(location = location_wsdl, 
wsdl=wsdl,*sessions=True,*namespace=namespace_wsdl, 
http_headers={'Authorization': "Basic %s" % 
auth},username=username,password=password)
client['AuthHeaderElement'] = {'Authorization': "Basic %s" % auth}

client.send('init',xml=xml_init)
client.send('executeQuery',xml=xml_execute_query)
When i call the 'executeQuery' i got as response that the connection is not 
established. The connection should be established with the 'Init' call . 
I got the same problem with SOAPUI but i managed to solve the problem 
activating the option "Maintain HTTP Session"
Even putting sessions = True is not solving the problem
Thank for help 
Piero

Il giorno martedì 18 marzo 2014 07:26:35 UTC+1, Mariano Reingart ha scritto:

> 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....@gmail.com<javascript:>
> > 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+un...@googlegroups.com <javascript:>.
>> 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