Created
February 12, 2015 21:06
-
-
Save tocano33/a08eb9f9691c96a4289f to your computer and use it in GitHub Desktop.
pysimplesoap error and logging issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pysimplesoap,time, logging, logging.handlers | |
#### VARS #### | |
username = "..." | |
password = "..." | |
soapURL = "https://.../path/to/soap" | |
namespace = "https://.../path/to/namespace" | |
logFilePath = "C:\\path\\to\\logs\\" | |
logFileName = time.strftime("%Y-%m-%d") + "_Output.log" | |
#### INIT LOGGING #### | |
logLevel = logging.DEBUG | |
# log format | |
logFormat = "%(asctime)s - %(levelname)s - %(message)s" | |
basicFormat = logging.Formatter(logFormat) | |
# SOAP logger | |
soapLogger = logging.getLogger('pysimplesoap.client') | |
soapLogger.setLevel(logLevel) | |
#soapLogger2 = logging.getLogger('pysimplesoap.simplexml') | |
#soapLogger2.setLevel(logLevel) | |
#soapLogger3 = logging.getLogger('pysimplesoap.server') | |
#soapLogger3.setLevel(logLevel) | |
# SOAP Logger filehandler | |
soapFileHandler = logging.handlers.RotatingFileHandler(logFilePath + logFileName, mode='a', maxBytes=5242880,backupCount=20) | |
soapFileHandler.setFormatter(basicFormat) | |
soapLogger.addHandler(soapFileHandler) | |
#soapLogger2.addHandler(soapFileHandler) | |
#soapLogger3.addHandler(soapFileHandler) | |
#### Execute #### | |
print "Instantiating SOAP Proxy Obj" | |
soapClient = pysimplesoap.client.SoapClient(location=soapURL + "?wsdl",namespace=namespace) #pysimplesoap | |
print "Instantiated" | |
print "Setting WSSE Headers" | |
soapClient['wsse:Security'] = { | |
'wsse:UsernameToken': { | |
'wsse:Username': username, | |
'wsse:Password': password | |
} | |
} | |
print "Headers set" | |
print "Executing getDocumentContent()" | |
response = soapClient.getDocumentContent('1234567') | |
print "Executed" | |
-------------------------------------------- | |
Output: | |
Instantiating SOAP Proxy Obj | |
Instantiated | |
Setting WSSE Headers | |
Headers set | |
Executing getDocumentContent() | |
Traceback (most recent call last): | |
File ".\SOAPtest2.py", line 60, in <module> | |
response = soapClient.getDocumentContent('1234567') | |
File "build\bdist.win32\egg\pysimplesoap\client.py", line 139, in <lambda> | |
AttributeError: 'str' object has no attribute 'call' | |
############## NOTE ############### | |
# But the part that I'm really struggling with is that the ..._Output.log file is always empty! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment