Hi,

 

I have a short and simple Python script to talk to EWS.

I hit the exception: Exception: imported schema (http://www.w3.org/XML/1998/namespace) at (http://www.w3.org/2001/xml.xsd), failed.

 

I have tried many solutions I found on net but nothing working including ImportDoctor.

 

Could anyone please help me?

 

Thanks and regards,

Dung Nguyen

 

 

PYTHON Ver. 2.6.6

SUDS Ver. 0.4

EWS Exchange 2010

 

My script.

 

#-------------------------------------------------------------------------------

# Python and SOAP examples.

#-------------------------------------------------------------------------------

 

import urllib2 as u2

import suds

import logging

from suds import WebFault

from suds import cache

from suds.client import Client

from suds.client import Factory

from suds.transport.https import HttpAuthenticated

from suds.transport.http import HttpTransport

from suds import sudsobject

from suds.xsd import sxbasic

from suds.xsd.sxbasic import Import as impt

from logging import getLogger

import TMSLib

import LoadConfig

import CiscoUtils

import time

 

from suds.xsd import doctor

from suds.xsd.doctor import Import

from suds.xsd.doctor import ImportDoctor

 

ns = 'http://www.w3.org/XML/1998/namespace'

location = 'http://www.w3.org/2001/xml.xsd'

impt.bind(ns, location)

 

imp = Import(ns,location=location)

imp.filter.add('http://www.w3.org/XML/1998/namespace')

doctor = ImportDoctor(imp)

 

 

 

class Transport(HttpTransport):

    def __init__(self, **kwargs):

        realm = kwargs.pop('realm')

        uri = kwargs.pop('uri')

        username = kwargs.pop('username')

        password = kwargs.pop('password')

        HttpTransport.__init__(self, **kwargs)

        t = HttpAuthenticated(username=username, password=password)

        self.handler = u2.HTTPBasicAuthHandler(t.pm)

        self.handler.add_password(realm=realm,user=username,passwd=password,uri=uri)

        self.urlopener = u2.build_opener(self.handler)

        print(' ... ')

       

t = Transport(realm='drym-ex1.cisco.com',uri='https://drym-ex1.cisco.com/',username='drym\drymautotest001',password='ciscoLab123')

 

print(' ... create a Client now')

c = Client(url='https://drym-ex1.cisco.com/EWS/Services.wsdl',transport=t,doctor=doctor)

 

print c