Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.

Commit 732043a

Browse files
digitalsparkyjhedev
authored andcommitted
Fix character-set issues (fiorix#108)
* Fix character-set issues * Add decoder charset compliance to soap client * Update travis ci file to force env var for build and path to golint
1 parent 1c9cf1d commit 732043a

File tree

8 files changed

+107
-13
lines changed

8 files changed

+107
-13
lines changed

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ sudo: false
33
language: go
44

55
install:
6-
- go get -u github.com/golang/lint/golint
6+
- go get -u github.com/golang/dep/cmd/dep
7+
- go get -u golang.org/x/lint/golint
78

89
before_script:
10+
- dep ensure
911
- go vet ./...
1012
- golint ./...
1113

1214
go:
13-
- 1.7
14-
- 1.8
1515
- 1.9
1616
- tip
1717

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
# Please keep the list sorted.
1010

1111
Alexandre Fiori <[email protected]>
12+
Matt Spurrier <[email protected]>

Gopkg.lock

+47
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Gopkg.toml example
2+
#
3+
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
4+
# for detailed Gopkg.toml documentation.
5+
#
6+
# required = ["github.com/user/thing/cmd/thing"]
7+
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
8+
#
9+
# [[constraint]]
10+
# name = "github.com/user/project"
11+
# version = "1.0.0"
12+
#
13+
# [[constraint]]
14+
# name = "github.com/user/project2"
15+
# branch = "dev"
16+
# source = "github.com/myfork/project2"
17+
#
18+
# [[override]]
19+
# name = "github.com/x/y"
20+
# version = "2.4.0"
21+
#
22+
# [prune]
23+
# non-go = false
24+
# go-tests = true
25+
# unused-packages = true
26+
27+
28+
[[constraint]]
29+
branch = "master"
30+
name = "golang.org/x/net"
31+
32+
[prune]
33+
go-tests = true
34+
unused-packages = true

README.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# wsdl2go
2-
[![Build Status](https://travis-ci.org/fiorix/wsdl2go.svg)](https://travis-ci.org/fiorix/wsdl2go)
2+
3+
[![Build Status](https://travis-ci.org/digitalsparky/wsdl2go.svg)](https://travis-ci.org/digitalsparky/wsdl2go)
34
[![Go Report Card](https://goreportcard.com/badge/github.com/grid-x/wsdl2go)](https://goreportcard.com/report/github.com/grid-x/wsdl2go)
45
[![GoDoc](https://godoc.org/github.com/grid-x/wsdl2go?status.svg)](https://godoc.org/github.com/grid-x/wsdl2go)
56

@@ -32,10 +33,10 @@ Here's how to use the generated code: let's say you have a WSDL that defines the
3233

3334
The process is this:
3435

35-
* Import the generated code
36-
* Create a soap.Client (and here you can configure SOAP authentication, for example)
37-
* Instantiate the service using your soap.Client
38-
* Call the service methods
36+
- Import the generated code
37+
- Create a soap.Client (and here you can configure SOAP authentication, for example)
38+
- Instantiate the service using your soap.Client
39+
- Call the service methods
3940

4041
Example:
4142

@@ -59,8 +60,8 @@ func main() {
5960

6061
The soap.Client supports two forms of authentication:
6162

62-
* Setting the "Pre" hook to a function that is run on all outbound HTTP requests, which can set HTTP headers and Basic Auth
63-
* Setting the Header attribute to an AuthHeader, to have it as a SOAP header (with username and password) in every request
63+
- Setting the "Pre" hook to a function that is run on all outbound HTTP requests, which can set HTTP headers and Basic Auth
64+
- Setting the Header attribute to an AuthHeader, to have it as a SOAP header (with username and password) in every request
6465

6566
Note that only the **Document** style of SOAP is supported. The RPC style is currently not supported.
6667

soap/client.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
"io/ioutil"
1010
"net/http"
1111
"reflect"
12+
13+
"golang.org/x/net/html/charset"
1214
)
1315

1416
// XSINamespace is a link to the XML Schema instance namespace.
@@ -154,7 +156,9 @@ func doRoundTrip(c *Client, setHeaders func(*http.Request), in, out Message) err
154156
Body Message
155157
}{Body: out}
156158

157-
return xml.NewDecoder(resp.Body).Decode(&marshalStructure)
159+
decoder := xml.NewDecoder(resp.Body)
160+
decoder.CharsetReader = charset.NewReaderLabel
161+
return decoder.Decode(&marshalStructure)
158162
}
159163

160164
// RoundTrip implements the RoundTripper interface.

wsdl/decoder.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ package wsdl
66
import (
77
"encoding/xml"
88
"io"
9+
10+
"golang.org/x/net/html/charset"
911
)
1012

1113
// Unmarshal unmarshals WSDL documents starting from the <definitions> tag.
@@ -14,7 +16,9 @@ import (
1416
// WSDL XML that can be introspected to generate the Web Services API.
1517
func Unmarshal(r io.Reader) (*Definitions, error) {
1618
var d Definitions
17-
err := xml.NewDecoder(r).Decode(&d)
19+
decoder := xml.NewDecoder(r)
20+
decoder.CharsetReader = charset.NewReaderLabel
21+
err := decoder.Decode(&d)
1822
if err != nil {
1923
return nil, err
2024
}

wsdlgo/encoder.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"text/template"
2626

2727
"github.com/grid-x/wsdl2go/wsdl"
28+
"golang.org/x/net/html/charset"
2829
)
2930

3031
// An Encoder generates Go code from WSDL definitions.
@@ -339,7 +340,9 @@ func (ge *goEncoder) importRemote(loc string, v interface{}) error {
339340

340341
r = bufio.NewReader(file)
341342
}
342-
return xml.NewDecoder(r).Decode(v)
343+
decoder := xml.NewDecoder(r)
344+
decoder.CharsetReader = charset.NewReaderLabel
345+
return decoder.Decode(&v)
343346

344347
}
345348

0 commit comments

Comments
 (0)