Saturday, 15 February 2014

python - Problems to authenticate correctly with pysimplesoap -



python - Problems to authenticate correctly with pysimplesoap -

i'm trying utilize pysimplesoap communicate websitepanel soap-api. websitepanel api introduction says:

for interacting websitepanel api should utilize basic authentication. websitepanel recognizes “authorization” header user credentials provided in next format: username:password

my first seek following:

client = soapclient(wsdl=endpoint_url, trace=true) client['authorization'] = "%s:%s" % (username, password)

which returns 401 "unauthorized". sec seek was:

client = soapclient(wsdl=endpoint_url, trace=true) client['wsse:security'] = { 'wsse:usernametoken': { 'wsse:username': username, 'wsse:password': password, } }

which works expected returns following:

status: 500 content-length: 924 x-aspnet-version: 4.0.30319 x-powered-by: asp.net server: microsoft-iis/7.5 cache-control: private date: tue, 12 feb 2013 14:23:56 gmt content-type: text/xml; charset=utf-8

and

pysimplesoap.client.soapfault: q0:security: soap response should signed.

why client['authorization'] not work , meant response should signed error message?

thanks in advance.

i figured out: authenticate correctly pysimplesoap have call

client = soapclient(wsdl=u, trace=true, http_headers={'authorization': 'basic %s' % encoded})

with encodedbeeing base64-encoded string username:password

python soap pysimplesoap

No comments:

Post a Comment