Consuming HTTP Services in Python Transcripts
Chapter: Calling SOAP services from Python
Lecture: Suds Replacement: Zeep

Login or purchase this course to watch this video and the rest of the course contents.
0:03 So we are in a new place in this course, now we've made our way over to the data format section, and we are going to be talking about soap clients.
0:11 We are going to see how to consume Soap services from Python, and the answer is actually not to bad there, there are some pretty cool projects
0:18 that we are going to be using. So I talked at the beginning of this course a little bit about the network,
0:25 the spectrum of network services, and we put Soap in there, in the really nice to work with if you have the tooling in some ways
0:33 but also kind of old school and very burningsome if you don't. So, I just want to reiterate that, if you get a choice
0:40 between making an http restful service and a Soap service, choose the rest service, if you got to consume one,
0:48 choose the rest service but we are going to talk about Soap because there are many internal Soap services,
0:54 if you work in large companies, there are probably Soap services all over the place,
0:59 and what you'll learn here is how you can work with the existing code, okay, this is not an advocation of Soap,
1:07 this is just a- we live in a world where there used to be many Soap services, and you may still run across them so how do we work with them,
1:14 alright, and just to remind you how this went, recall we had this function, doubleAnInteger which we were calling on a Soap service,
1:20 and what happens is we come in, we call this function, it generates a Soap envelope and the Soap envelope contains things like
1:29 it's going to run, what the values are, and it's very name space laden to describe all of its types, so we are going to get a message like this,
1:38 and all of this is really to send two pieces of information, we want to call the thing, doubleAnInteger, and we want to pass the number 1, 2, 3,
1:48 the server is going to do the work, it will pull this all apart, it will run that operation and it's going to, not surprisingly double that number
1:54 and send the message back that looks similar, like this. And here you can see the response came back and the response is 2,4,6.
2:02 Okay, so this is the Soap world, and what are the properties benefits and drawbacks really of Soap services, all data is exchanged via http post,
2:12 now on one hand, you might not really care, like you might not be really into exactly matching the architecture of the internet and the web,
2:20 and that's fine, but one of the challenges you have with everything being tunneled if you will over http post is that nothing is cashable out,
2:29 outside of maybe the server in memory cashing in, but the verb post is not cashable and this causes many problems on the public internet.
2:39 Next, all the operations target single url, so they might go against server/service
2:43 and then the action header tells you which operation on that service to run,
2:49 so it's not again, just kind of not really working the way the internet works, because we're using post, nothing is cashable, xml format
2:57 especially with all those name spaces is really --- and we don't want to use it, right, we've seen json as better from a bandwidth perspective,
3:05 better from a human readability perspective and it's just simpler for most clients especially Python because dictionaries and json match
3:13 so closely to each other. However, with tooling support, Soap does lead to pretty quick development.


Talk Python's Mastodon Michael Kennedy's Mastodon