Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebastianmahecha/goap
It's another golang soap client.
https://github.com/sebastianmahecha/goap
Last synced: about 21 hours ago
JSON representation
It's another golang soap client.
- Host: GitHub
- URL: https://github.com/sebastianmahecha/goap
- Owner: SebastianMahecha
- License: mit
- Created: 2018-10-02T17:08:46.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2017-10-17T10:20:34.000Z (about 7 years ago)
- Last Synced: 2024-11-14T18:17:02.487Z (2 months ago)
- Language: Go
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Goap
It's another golang soap client.
## Usage
First define request body and response body structure :
```go
type addRequest struct {
XMLName xml.Name `xml:"http://tempuri.org/ Add"`IntA int `xml:"intA"`
IntB int `xml:"intB"`
}type addResponse struct {
XMLName xml.Name `xml:"http://tempuri.org/ AddResponse"`AddResult int `xml:"AddResult"`
}
```Then you can use goap to send your request and process response :
```go
response := addResponse{}
err := goap.Call(
"http://www.dneonline.com/calculator.asmx", // service url
"http://tempuri.org/Add", // soap action
nil, // soap request headers (optional)
addRequest{IntA: 10, IntB: 15}, // request
nil, // soap response headers(optional)
&response) // soap response pointerif err != nil {
panic(err)
}log.Println("add result is", response.AddResult)
```## Thanks
This project inspired by [Zarinpal go example](https://github.com/sijad/zarinpal-go) by [sijad](https://github.com/sijad)