Command payload wants a `xmlns` attribute.
Created by: bweston92
I have an issue where the tag after the <soap:Body> tag requires a xmlns attribute.
Currently the request begins like the following:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="https://api.twenty7tec.com/sourcing.svc?wsdl"
xmlns:tns="https://api.twenty7tec.com/sourcing.svc?wsdl"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<soap:Body>
<RunSource>
However the following is required
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<soap:Body>
<RunSource xmlns="http://tempuri.org/">
My current work around:
Pre: func(r *http.Request) {
out, _ := ioutil.ReadAll(r.Body)
_ = r.Body.Close()
newBody := bytes.ReplaceAll(out, []byte("<RunSource>"), []byte("<RunSource xmlns=\"http://tempuri.org/\">"))
r.ContentLength = int64(len(newBody))
r.Body = ioutil.NopCloser(bytes.NewReader(newBody))
},
Is there any other way of doing this that would work on requests that are available?