In this post, I’m going to share one of my experiences during my work with SOAP-WSDL technology in Go programming language.
SOAP? WSDL? What are those? This is the first time I know about that.
For people who start programming since around 2003, I bet they will be quite familiar with SOAP and WSDL terms.
SOAP, or the Simple Object Access Protocol is a protocol used in computing. Web services use this protocol to communicate. SOAP uses XML to encode a message ~ Wikipedia.
SOAP is a protocol, it uses HTTP (or RPC) on the application layer for transport and negotiation, and XML on the messaging part.
The WSDL specification is often combined with SOAP. So it’s safe to say that SOAP and WSDL are best friend! They are very close to each other #bro4life.
The Web Services Description Language (WSDL) is an XML-based interface definition language that is used for describing the functionality offered by a web service ~ Wikipedia.
Nowadays SOAP-WSDL web service is rarely used in recent applications (opinion is mine). Most back-end engineer will rather choose to follow RESTful specification.
But doesn’t necessarily mean that no one is using it. There are still a lot of applications, especially the enterprise one, that implement SOAP-WSDL.
Btw, SOAP and REST are not something that is comparable. Remember that, millennial!
Performing SOAP request in Go is quite easy, the net/http package is enough to cover all the works (if the HTTP is used as the transport, and we’ll use that). But, you can definitely use 3rd party library if you want, there are some good open-source libraries available too.
In this post, we are going to learn how to do SOAP call using only available APIs from Go internal packages, so no 3rd party at all.
OK, let’s begin
First of all, we definitely need some SOAP Web Service for testing, right? You can use anything you have. I’ll use what I currently have, the WSO2IS SOAP API. We are going to get a list of available users from this WSO2IS app.
Ok, next, we need to know what-so-called Web Service URL.