Python-zeep: Failure on attempt to access services over HTTPS protocol.

Created on 24 Nov 2016  路  4Comments  路  Source: mvantellingen/python-zeep

Hello, @mvantellingen!

Congrats for this great Python SOAP client.

I've found an error related to the enhancement done for issue #228.

Failed to establish a new connection: [Errno -2] Name or service not known.

Take a look in zeep.wsdl.bindings.soap.py file, method process_service_port (lines 156-167).

def process_service_port(self, xmlelement, force_https=False):
    address_node = xmlelement.find('soap:address', namespaces=self.nsmap)

    # Force the usage of HTTPS when the force_https boolean is true
    location = address_node.get('location')
    if force_https and location and location.startswith('http://'):
        logger.warning("Forcing soap:address location to HTTPS")
        location = 'https://' + location[8:]

    return {
        'address': location
    }

location[8:] should be location[7:], cause it is a slice over 'http://' string. For example, if we have an address like http://myserver.com/ the result will be https://yserver.com/.

I'm using Zeep 0.22.1.

bug

Most helpful comment

@mvantellingen, PR submitted.

All 4 comments

Whoops, nice catch. I should have written a test case for this :(

I'll fix it asap, or if you want to submit a PR including test then that is also really appreciated 馃憤

@mvantellingen, PR submitted.

@mvantellingen, will you create a new version with this fix? 0.22.2?

Yes, although i'd like to bundle multiple fixes per release to minimize my work. So it might take a couple of days

Was this page helpful?
0 / 5 - 0 ratings

Related issues

grguthrie picture grguthrie  路  4Comments

vadivelkindhealth picture vadivelkindhealth  路  3Comments

eagle-r picture eagle-r  路  6Comments

dhinchakdhoom picture dhinchakdhoom  路  4Comments

nihankarslioglu picture nihankarslioglu  路  4Comments