Passin credentials of HTTP Basic AUTH

2010-04-28
2013-05-02
  • Hello to all members.

    How is the right way to pass credentials for a web service cliente using ZSI Service Proxy.

    I have the following client, and it keeps returning HTTP 401 code:

    #!/opt/python/bin/python

    from ZSI.ServiceProxy import ServiceProxy
    from ZSI.auth import AUTH
    from ZSI.wstools.Utility import HTTPResponse
    import sys

    username = 'myuser'
    password = 'mypass'
    urlservicio = 'http://server/wsMisConsumos/CryMiContadorSrv.asmx?WSDL'

    cred=(AUTH.httpbasic, username, password )
    print urlservicio

    try:
            servicio = ServiceProxy(wsdl=urlservicio, auth=cred,  tracefile=sys.stdout)

    except HTTPResponse, http:
                    print http.status
                    print cred

    Thanks in advance for your attention.