Here's the output with debugging turned up. The end result is still:
Status report</p><p><b>message</b>
<u></u></p><p><b>description</b> <u>*This
request requires HTTP authentication ().*
Also, if I use client = Client(url+"?wsdl") as you suggested, then the
"?wsdl" string is repeated twice, so I dropped that.
I get the same result using
client = Client(url, wsse=security)
and
client = Client(url, username="name", password="password")
The print client.service still works, but the method call (getOemKey)
doesn't.
Note the funky formatting is from ipython.
In [40]: client.service.getOemKey()
DEBUG:suds.client:sending to (
https://kaan-01.wlv.lsi.com:8443/service-war/dpmcore?wsdl) <- correct url
message:
<SOAP-ENV:Envelope xmlns:wsse="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext...
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsu="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utilit...
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<wsse:Security mustUnderstand="true">
<wsse:UsernameToken>
<wsse:Username>dpm</wsse:Username>
<wsse:Password>password</wsse:Password>
<wsse:Nonce>43901aefc25cc1bd455e7d3cc3c58d7b</wsse:Nonce>
<wsu:Created>2009-06-21T06:53:14.146074</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</SOAP-ENV:Header>
<SOAP-ENV:Body/>
</SOAP-ENV:Envelope>
DEBUG:suds.client:headers = {'SOAPAction': u'"
http://lsi.com/dpm/core/getOemKey"';, 'Content-Type': 'text/xml'}
ERROR:suds.client:<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:wsse="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext...
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsu="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utilit...
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<wsse:Security mustUnderstand="true">
<wsse:UsernameToken>
<wsse:Username>dpm</wsse:Username>
<wsse:Password>password</wsse:Password>
<wsse:Nonce>43901aefc25cc1bd455e7d3cc3c58d7b</wsse:Nonce>
<wsu:Created>2009-06-21T06:53:14.146074</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</SOAP-ENV:Header>
<SOAP-ENV:Body/>
</SOAP-ENV:Envelope>
DEBUG:suds.client:http failed:
<html><head><title>Apache Tomcat/6.0.18 - Error
report</title><style><!--H1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
BODY
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
P
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
{color : black;}A.name {color : black;}HR {color : #525D76;}--></style>
</head><body><h1>HTTP Status 401 - </h1><HR size="1"
noshade="noshade"><p><b>type</b> Status
report</p><p><b>message</b>
<u></u></p><p><b>description</b> <u>This request
requires HTTP
authentication ().</u></p><HR size="1"
noshade="noshade"><h3>Apache
Tomcat/6.0.18</h3></body></html>
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
/import/gin/bedge/dev_kaan/Apps/ws/test/<ipython console> in <module>()
/import/gin/bedge/dev_kaan/Apps/ws/test/suds/client.pyc in __call__(self,
*args, **kwargs)
238 def __call__(self, *args, **kwargs):
239 target = self.__wrapped__
--> 240 return target.call(*args, **kwargs)
241
242 def __str__(self):
/import/gin/bedge/dev_kaan/Apps/ws/test/suds/client.pyc in call(self, *args,
**kwargs)
377 """
378 method = self.resolve(self.name(), strict=False)
--> 379 return method(*args, **kwargs)
380
381
/import/gin/bedge/dev_kaan/Apps/ws/test/suds/client.pyc in __call__(self,
*args, **kwargs)
238 def __call__(self, *args, **kwargs):
239 target = self.__wrapped__
--> 240 return target.call(*args, **kwargs)
241
242 def __str__(self):
/import/gin/bedge/dev_kaan/Apps/ws/test/suds/client.pyc in call(self, *args,
**kwargs)
420 return (500, e)
421 else:
--> 422 return client.invoke(args, kwargs)
423
424 def faults(self):
/import/gin/bedge/dev_kaan/Apps/ws/test/suds/client.pyc in invoke(self,
args, kwargs)
478 self.method.qname, timer)
479 timer.start()
--> 480 result = self.send(msg)
481 timer.stop()
482 metrics.log.debug(
/import/gin/bedge/dev_kaan/Apps/ws/test/suds/client.pyc in send(self, msg)
509 else:
510 log.error(self.last_sent())
--> 511 result = self.failed(binding, e)
512 return result
513
/import/gin/bedge/dev_kaan/Apps/ws/test/suds/client.pyc in failed(self,
binding, error)
566 return (status, None)
567 if self.options.faults:
--> 568 raise Exception((status, reason))
569 else:
570 return (status, None)
Exception: (401, u'Unauthorized')
Again, here's the full code:
import suds
from suds.wsse import *
from suds.client import Client
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
security = Security()
token = UsernameToken('username', 'password')
security.tokens.append(token)
url = 'https://kaan-01.wlv.lsi.com:8443/service-war/dpmcore?wsdl'
client = Client(url, wsse=security)
print client.service
client.wsdl.service.setlocation(url)
client.service.getOemKey(wsse=security)
-Bruce
On Sat, Jun 20, 2009 at 11:29 PM, Edge, Bruce <Bruce.Edge(a)lsi.com> wrote:
________________________________________
From: David Norton [david(a)nortoncrew.com]
Sent: Saturday, June 20, 2009 3:15 PM
To: Edge, Bruce
Subject: Re: [Fedora-suds-list] https authentication failing
Try turning up debugging:
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
That should tell you what URL it is trying to connect to when it makes the
getOemKey() call.
David
On Jun 20, 2009, at 4:21 PM, Edge, Bruce wrote:
If that was the problem wouldn't the client instantiation fail?
I'm able to inatantiate a client and do a:
print client.service
But then any methods called on the service fail.
-Bruce
Sent from my iPhone
On Jun 20, 2009, at 8:46 AM, David Norton <david(a)nortoncrew.com<mailto:
david(a)nortoncrew.com>> wrote:
Hello Bruce,
Does the WSDL specify a different URL for the service? I have had to use
the following code because the WSDLs I'm using specify "localhost:8080":
client = Client(url+"?wsdl")
client.wsdl.service.setlocation(url)
Best,
David Norton
On Jun 19, 2009, at 8:02 PM, Bruce Edge wrote:
I'm having a problem with https basic authentication
Is there something I'm doing wrong here?
security = Security()
token = UsernameToken('username', 'password')
security.tokens.append(token)
url = '<https://targetboc:8443/service-war/dpmcore?wsdl>
https://targetboc:8443/service-war/dpmcore?wsdl'
c = Client(url, wsse=security)
print c.service
# OK so far
c.service.getOemKey(wsse=security)
# fails with
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "wsenv.py", line 22, in <module>
c.service.getOemKey(wsse=security)
File "suds/client.py", line 240, in __call__
return target.call(*args, **kwargs)
File "suds/client.py", line 379, in call
return method(*args, **kwargs)
File "suds/client.py", line 240, in __call__
return target.call(*args, **kwargs)
File "suds/client.py", line 422, in call
return client.invoke(args, kwargs)
File "suds/client.py", line 480, in invoke
result = self.send(msg)
File "suds/client.py", line 504, in send
reply = transport.send(request)
File "suds/transport/https.py", line 64, in send
return HttpTransport.send(self, request)
File "suds/transport/http.py", line 78, in send
fp = self.__open(u2request)
File "suds/transport/http.py", line 99, in __open
return self.urlopener.open(u2request)
File "/usr/lib/python2.6/urllib2.py", line 383, in open
response = self._open(req, data)
File "/usr/lib/python2.6/urllib2.py", line 401, in _open
'_open', req)
File "/usr/lib/python2.6/urllib2.py", line 361, in _call_chain
result = func(*args)
File "/usr/lib/python2.6/urllib2.py", line 1138, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/usr/lib/python2.6/urllib2.py", line 1105, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 111] Connection refused>
>>>
I tried the beta with the same result.
I know the service is OK because I can do this:
curl -ku username:password <
https://localhost:8443/service-war/dpmcore/getOemKey>
https://localhost:8443/service-war/dpmcore/getOemKey
<soap:Envelope
xmlns:soap="<http://schemas.xmlsoap.org/soap/envelope/>
http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><g...
xmlns="<http://lsi.com/dpm/core/types>http://lsi.com/dpm/core/...
xmlns:ns2="<http://lsi.com/dpm/types>http://lsi.com/dpm/types
"><oemKey>LSI</oemKey></getOemKeyResponse></soap:Body></soap:Envelope>
Thanks, Bruce
_______________________________________________
fedora-suds-list mailing list
<mailto:fedora-suds-list@redhat.com>fedora-suds-list@redhat.com<mailto:
fedora-suds-list(a)redhat.com>
https://www.redhat.com/mailman/listinfo/fedora-suds-list