Implement SOAP "bin.base64" marshalling.

This commit is contained in:
John Beisley
2013-10-27 20:17:00 +00:00
parent aba95ad90c
commit 3c28ba0b35
2 changed files with 30 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
package soap
import (
"encoding/base64"
"errors"
"fmt"
"regexp"
@@ -396,3 +397,13 @@ func UnmarshalBoolean(s string) (bool, error) {
}
return false, fmt.Errorf("soap boolean: %q is not a valid boolean value", s)
}
// MarshalBinBase64 marshals []byte to SOAP "bin.base64" type.
func MarshalBinBase64(v []byte) (string, error) {
return base64.StdEncoding.EncodeToString(v), nil
}
// UnmarshalBinBase64 unmarshals []byte from the SOAP "bin.base64" type.
func UnmarshalBinBase64(s string) ([]byte, error) {
return base64.StdEncoding.DecodeString(s)
}