Created
April 12, 2016 23:57
-
-
Save gerep/0b1ec10278ac9bc28e279db771c3e4b7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| package main | |
| import "fmt" | |
| // The dumb way to deal with SOAP requests | |
| func userRequest(userId string) string { | |
| template := soapify(userTemplate) | |
| return fmt.Sprintf(template, userId) | |
| } | |
| func soapify(template string) string { | |
| return fmt.Sprintf(userTemplate, template) | |
| } | |
| const soapTemplate = | |
| `<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://we❤namespaces.com/"> | |
| <soapenv:Header/> | |
| <soapenv:Body> | |
| %s | |
| </soapenv:Body> | |
| </soapenv:Envelope>` | |
| const userTemplate = | |
| `<github:user> | |
| <arg0>%s</arg0> | |
| </github:user>` | |
| func main() { | |
| payload := userRequest("dmichael") | |
| fmt.Println(payload) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment