Implement SOAP bin.hex marshalling.

This commit is contained in:
John Beisley
2013-10-27 20:21:44 +00:00
parent 3c28ba0b35
commit e86d73d8f4
2 changed files with 29 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ package soap
import (
"encoding/base64"
"encoding/hex"
"errors"
"fmt"
"regexp"
@@ -407,3 +408,13 @@ func MarshalBinBase64(v []byte) (string, error) {
func UnmarshalBinBase64(s string) ([]byte, error) {
return base64.StdEncoding.DecodeString(s)
}
// MarshalBinHex marshals []byte to SOAP "bin.hex" type.
func MarshalBinHex(v []byte) (string, error) {
return hex.EncodeToString(v), nil
}
// UnmarshalBinHex unmarshals []byte from the SOAP "bin.hex" type.
func UnmarshalBinHex(s string) ([]byte, error) {
return hex.DecodeString(s)
}