Middle
Do you have experience working with SOAP or XML?
sobes.tech AI
Answer from AI
Yes, I have experience working with SOAP and XML. SOAP is a messaging protocol based on XML, often used in enterprise integrations.
Working with SOAP typically involves:
- Creating XML requests based on WSDL schema.
- Sending HTTP requests with SOAP envelopes.
- Parsing XML responses and handling errors.
Example in Go using the encoding/xml package for parsing SOAP responses:
import (
"encoding/xml"
"fmt"
)
type Envelope struct {
XMLName xml.Name `xml:"Envelope"`
Body Body `xml:"Body"`
}
type Body struct {
Response Response `xml:"MyResponse"`
}
type Response struct {
Result string `xml:"Result"`
}
func parseSOAPResponse(data []byte) {
var env Envelope
err := xml.Unmarshal(data, &env)
if err != nil {
fmt.Println("Error parsing XML:", err)
return
}
fmt.Println("Result:", env.Body.Response.Result)
}
Experience with SOAP is useful when integrating with legacy systems and services where REST API is not available.