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' 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 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/%22%3Esoap:Body<getOemKeyResponse xmlns="http://lsi.com/dpm/core/types" xmlns:ns2="http://lsi.com/dpm/types"><oemKey>LSI</oemKey></getOemKeyResponse></soap:Body></soap:Envelope>
Thanks, Bruce
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' 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 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/ envelope/">soap:Body<getOemKeyResponse xmlns="http://lsi.com/dpm/core/types " xmlns:ns2="http://lsi.com/dpm/types"><oemKey>LSI</oemKey></ getOemKeyResponse></soap:Body></soap:Envelope>
Thanks, Bruce _______________________________________________ fedora-suds-list mailing list fedora-suds-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-suds-list
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@nortoncrew.commailto:david@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?wsdlhttps://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/%22%3Esoap:Body<getOemKeyResponse xmlns="<http://lsi.com/dpm/core/types>http://lsi.com/dpm/core/types" 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.comfedora-suds-list@redhat.commailto:fedora-suds-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-suds-list
Hey Bruce,
Can you paste the <service/> node from the wsdl?
-jeff
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@nortoncrew.com mailto:david@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?wsdlhttps://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/getOemKeyhttps://localhost:8443/service-war/dpmcore/getOemKey <soap:Envelope xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/http://schemas.xmlsoap.org/soap/envelope/%22%3Esoap:Body<getOemKeyResponse xmlns=" <http://lsi.com/dpm/core/types>http://lsi.com/dpm/core/types" 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.comfedora-suds-list@redhat.com mailto:fedora-suds-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-suds-list
fedora-suds-list mailing list fedora-suds-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-suds-list
On Mon, Jun 22, 2009 at 6:45 AM, Jeff Ortel jortel@redhat.com wrote:
Hey Bruce,
Can you paste the <service/> node from the wsdl?
-jeff
Here's the service def node:
<service name="xxxService"> <port binding="tns:xxxBinding" name="xxxPort"> <soap:address location="https://localhost:8443/service-war/xxx%22/%3E </port> </service>
I did get it working.
This works:
url = 'https://localhost:8443/service-war/dpmcore?wsdl' client = Client(url, username="username", password="password") client.service.getOemKey()
This does not:
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) client.service.getOemKey()
I was making it harder than it needed to be. What is the difference is between these above two client authentication mechanisms? Will either one of these support digest passwords some time in the future?
One last somewhat off-topic question, (for today anyway) Is there a way to easily obfuscate the userid/passwd in code? Can we use suds with ssl certs and something like an authorized keys file?
Thanks
-Bruce
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@nortoncrew.com mailto: david@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%3E https://localhost:8443/service-war/dpmcore/getOemKey <soap:Envelope xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/%22%3Esoap:Body<getOemKeyResponse xmlns=" <http://lsi.com/dpm/core/types>http://lsi.com/dpm/core/types" 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.comfedora-suds-list@redhat.commailto: fedora-suds-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-suds-list
fedora-suds-list mailing list fedora-suds-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-suds-list
fedora-suds-list mailing list fedora-suds-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-suds-list
I have a clue as to why the client instantiation works but the method calls fail.
If I instantiate the client using the external IP it works: client = Client(' https://kaan-01.wlv.lsi.com:8443/service-war/dpmcore?wsdl', wsse=security)
However if I use the localhost addr, it fails: (see after trace for possible explanation)
client = Client('https://127.0.0.1:8443/service-war/dpmcore?wsdl', wsse=security) --------------------------------------------------------------------------- URLError 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 __init__(self, url, **kwargs) 104 options.set(**kwargs) 105 self.options = options --> 106 self.wsdl = Definitions(url, options) 107 self.service = Wrapper(Service(self)) 108 self.factory = Factory(self.wsdl)
/import/gin/bedge/dev_kaan/Apps/ws/test/suds/wsdl.pyc in __init__(self, url, options) 169 log.debug('reading wsdl at: %s ...', url) 170 p = Parser(options.transport) --> 171 root = p.parse(url=url).root() 172 WObject.__init__(self, root) 173 self.id = objid(self)
/import/gin/bedge/dev_kaan/Apps/ws/test/suds/sax/parser.pyc in parse(self, file, url, string) 131 return handler.nodes[0] 132 if url is not None: --> 133 fp = self.transport.open(Request(url)) 134 sax.parse(fp) 135 timer.stop()
/import/gin/bedge/dev_kaan/Apps/ws/test/suds/transport/https.pyc in open(self, request) 58 def open(self, request): 59 self.__addcredentials(request) ---> 60 return HttpTransport.open(self, request) 61 62 def send(self, request):
/import/gin/bedge/dev_kaan/Apps/ws/test/suds/transport/http.pyc in open(self, request) 60 u2request = u2.Request(url) 61 self.__setproxy(url, u2request) ---> 62 fp = self.__open(u2request) 63 return cache.put(url, fp) 64 except u2.HTTPError, e:
/import/gin/bedge/dev_kaan/Apps/ws/test/suds/transport/http.pyc in __open(self, u2request) 97 return u2.urlopen(u2request) 98 else: ---> 99 return self.urlopener.open(u2request) 100 101 def __setproxy(self, url, u2request):
/usr/lib/python2.6/urllib2.pyc in open(self, fullurl, data, timeout) 381 req = meth(req) 382 --> 383 response = self._open(req, data) 384 385 # post-process response
/usr/lib/python2.6/urllib2.pyc in _open(self, req, data) 399 protocol = req.get_type() 400 result = self._call_chain(self.handle_open, protocol, protocol + --> 401 '_open', req) 402 if result: 403 return result
/usr/lib/python2.6/urllib2.pyc in _call_chain(self, chain, kind, meth_name, *args) 359 func = getattr(handler, meth_name) 360 --> 361 result = func(*args) 362 if result is not None: 363 return result
/usr/lib/python2.6/urllib2.pyc in https_open(self, req) 1136 1137 def https_open(self, req): -> 1138 return self.do_open(httplib.HTTPSConnection, req) 1139 1140 https_request = AbstractHTTPHandler.do_request_
/usr/lib/python2.6/urllib2.pyc in do_open(self, http_class, req) 1103 r = h.getresponse() 1104 except socket.error, err: # XXX what error? -> 1105 raise URLError(err) 1106 1107 # Pick apart the HTTPResponse object to get the addinfourl
After obtaining a client reference using the external IP, with logging enabled it shows that it's using the localhost address, which fails when used for client instantiation:
In [18]: client.service.getOemKey(wsse=security) DEBUG:suds.client:sending to (*https://localhost:8443/service-war/dpmcore*) <<-- should be using external IP here. message: <SOAP-ENV:Envelope xmlns:wsse=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1...." xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV=" http://schemas.xmlsoap.org/soap/envelope/%22%3E SOAP-ENV:Header <wsse:Security mustUnderstand="true"> wsse:UsernameToken wsse:Usernamedpm</wsse:Username> wsse:Passwordpassword</wsse:Password> </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'}
So, I'm guessing that this would work if the client did not swap the external IP used in the client instantiation with the localhost addr used in the method call.
Although, why does the localhost addr not work?
The localhost addr works fine when used with other clients, like curl, so it's not the service:
$> curl -ku dpm:password https://localhost:8443/service-war/dpmcore/getOemKey <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/%22%3Esoap:Body<getOemKeyResponse
xmlns="http://lsi.com/dpm/core/types" xmlns:ns2="http://lsi.com/dpm/types "><oemKey>*DUMMY KEY DATA*</oemKey></get OemKeyResponse></soap:Body></soap:Envelope>#
-Bruce
On Sat, Jun 20, 2009 at 8:46 AM, David Norton david@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' 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 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/%22%3Esoap:Body<getOemKeyResponse xmlns="http://lsi.com/dpm/core/types" xmlns:ns2="http://lsi.com/dpm/types"><oemKey>LSI</oemKey></getOemKeyResponse></soap:Body></soap:Envelope>
Thanks, Bruce _______________________________________________ fedora-suds-list mailing list fedora-suds-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-suds-list