Skip to content

Commit

Permalink
change example to README
Browse files Browse the repository at this point in the history
  • Loading branch information
tiaguinho committed Jun 16, 2017
1 parent 4d901b0 commit 6c304d3
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 43 deletions.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,52 @@ package to help with SOAP integrations (client)

```bash
go get github.com/tiaguinho/gosoap
```

### Example

```go
package main

import (
"github.com/tiaguinho/gosoap"
"fmt"
)

type GetGeoIPResponse struct {
GetGeoIPResult GetGeoIPResult
}

type GetGeoIPResult struct {
ReturnCode string
IP string
ReturnCodeDetails string
CountryName string
CountryCode string
}

var (
r GetGeoIPResponse
)

func main() {
soap, err := gosoap.SoapClient("http://www.webservicex.net/geoipservice.asmx?WSDL")
if err != nil {
fmt.Errorf("error not expected: %s", err)
}

params := gosoap.Params{
"IPAddress": "8.8.8.8",
}

err = soap.Call("GetGeoIP", params)
if err != nil {
fmt.Errorf("error in soap call: %s", err)
}

soap.Unmarshal(&r)
if r.GetGeoIPResult.CountryCode != "USA" {
fmt.Errorf("error: %+v", r)
}
}
```
43 changes: 0 additions & 43 deletions example_test.go

This file was deleted.

0 comments on commit 6c304d3

Please sign in to comment.