Created
June 4, 2016 16:39
-
-
Save h3xh4wk/720572f1889257aa497ecb4cf24dda02 to your computer and use it in GitHub Desktop.
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
from suds.client import Client | |
from suds.sax.element import Element | |
url = "file:///home/jitendra/obs/wsdl.jsp.xml" | |
client = Client(url) | |
token = "xxxxxxxxxxxxxxxxxxxxxxxx" | |
print client | |
LoginResult = client.service.login("userId", "pwd"+token) | |
#Specifies the server URL as the target for subsequent service requests. The login server supports only login calls. | |
client.wsdl.services[0].setlocation(LoginResult.serverUrl) | |
#Sets the session ID in the SOAP header so that the API can validate subsequent requests for this session. | |
ssnp = Element("xsi:SessionHeader").append(Element('xsi:sessionId').setText(LoginResult.sessionId)) | |
client.set_options(soapheaders=ssnp) | |
LogOutResult = client.service.logout() | |
print LoginResult | |
print client.last_sent() | |
print client.last_received() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Well, I didn't know that I could achieve the same thing in lesser lines of code.