Answers for "how to add soapenv while marshalling in golang"

0

how to add soapenv while marshalling in golang

soapenv_head :=
[]byte(
`<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:yourWebService">
<soapenv:Header/>
<soapenv:Body>
<urn:callyourWebservice>`)

soapenv_close := []byte(
`</urn:callyourWebservice>
</soapenv:Body>
</soapenv:Envelope>`)

// Do something with the unmarshalled body

Uxml := append ( <your_xml_struct_that_has_an_array_of_the_appended_struct>, datasource_inputs {'name','value' }   )

output, err := xml.Marshal(Uxml)
   if err != nil {
    fmt.Printf("error: %v\n", err)
     panic(err)
   }
var buffer bytes.Buffer
buffer.Write(soapenv_head)
buffer.Write(output)
buffer.Write(soapenv_close)

fmt.Println(buffer.bytes() ) // this has your full soap request
Posted by: Guest on September-30-2021

Browse Popular Code Answers by Language