From c48790902d98063a68eeacb7dc012e5081f4cd2c Mon Sep 17 00:00:00 2001 From: Jeremy Liu Date: Mon, 13 Sep 2021 16:52:32 +0800 Subject: [PATCH 1/2] handle content-type:multipart/related; type="application/xop+xml";start="";boundary="uuid:xxxx";start-info="text/xml" --- soap/MTOMEncoder.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/soap/MTOMEncoder.go b/soap/MTOMEncoder.go index 6f214ec..9b25bf2 100644 --- a/soap/MTOMEncoder.go +++ b/soap/MTOMEncoder.go @@ -202,8 +202,8 @@ func getMtomHeader(contentType string) (string, error) { } startInfo, ok := params["start-info"] - if !ok || startInfo != "application/soap+xml" { - return "", fmt.Errorf(`Expected param start-info="application/soap+xml", got %s`, startInfo) + if !ok || strings.Index(contentType,"xml") == -1{ + return "", fmt.Errorf(`Expected param start-info contains xml, got %s`, startInfo) } return boundary, nil } @@ -231,7 +231,7 @@ func (d *mtomDecoder) Decode(v interface{}) error { return err } contentType := p.Header.Get("Content-Type") - if contentType == "application/xop+xml" { + if strings.HasPrefix(contentType,"application/xop+xml") { err := xml.NewDecoder(p).Decode(v) if err != nil { return err From 6c5eabe3c775a686c4b5426c0c0acb3c0be7bc34 Mon Sep 17 00:00:00 2001 From: Jeremy Liu Date: Tue, 30 Nov 2021 16:57:03 +0800 Subject: [PATCH 2/2] fixs typo, change contentType to startInfo --- soap/MTOMEncoder.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soap/MTOMEncoder.go b/soap/MTOMEncoder.go index 9b25bf2..588007b 100644 --- a/soap/MTOMEncoder.go +++ b/soap/MTOMEncoder.go @@ -202,7 +202,7 @@ func getMtomHeader(contentType string) (string, error) { } startInfo, ok := params["start-info"] - if !ok || strings.Index(contentType,"xml") == -1{ + if !ok || strings.Index(startInfo,"xml") == -1{ return "", fmt.Errorf(`Expected param start-info contains xml, got %s`, startInfo) } return boundary, nil