Files
opentf/vendor/github.com/masterzen/winrm/soap/message.go
Paul Hinze 6fe2703665 Vendor all dependencies w/ Godep
* Remove `make updatedeps` from Travis build. We'll follow up with more
   specific plans around dependency updating in subsequent PRs.
 * Update all `make` targets to set `GO15VENDOREXPERIMENT=1` and to
   filter out `/vendor/` from `./...` where appropriate.
 * Temporarily remove `vet` from the `make test` target until we can
   figure out how to get it to not vet `vendor/`. (Initial
   experimentation failed to yield the proper incantation.)

Everything is pinned to current master, with the exception of:

 * Azure/azure-sdk-for-go which is pinned before the breaking change today
 * aws/aws-sdk-go which is pinned to the most recent tag

The documentation still needs to be updated, which we can do in a follow
up PR. The goal here is to unblock release.
2016-01-29 15:08:48 -06:00

75 lines
1.6 KiB
Go

package soap
import (
"github.com/masterzen/simplexml/dom"
)
type SoapMessage struct {
document *dom.Document
envelope *dom.Element
header *SoapHeader
body *dom.Element
}
type MessageBuilder interface {
SetBody(*dom.Element)
NewBody() *dom.Element
CreateElement(*dom.Element, string, dom.Namespace) *dom.Element
CreateBodyElement(string, dom.Namespace) *dom.Element
Header() *SoapHeader
Doc() *dom.Document
Free()
String() string
}
func NewMessage() (message *SoapMessage) {
doc := dom.CreateDocument()
e := dom.CreateElement("Envelope")
doc.SetRoot(e)
AddUsualNamespaces(e)
NS_SOAP_ENV.SetTo(e)
message = &SoapMessage{document: doc, envelope: e}
return
}
func (message *SoapMessage) NewBody() (body *dom.Element) {
body = dom.CreateElement("Body")
message.envelope.AddChild(body)
NS_SOAP_ENV.SetTo(body)
return
}
func (message *SoapMessage) String() string {
return message.document.String()
}
func (message *SoapMessage) Doc() *dom.Document {
return message.document
}
func (message *SoapMessage) Free() {
}
func (message *SoapMessage) CreateElement(parent *dom.Element, name string, ns dom.Namespace) (element *dom.Element) {
element = dom.CreateElement(name)
parent.AddChild(element)
ns.SetTo(element)
return
}
func (message *SoapMessage) CreateBodyElement(name string, ns dom.Namespace) (element *dom.Element) {
if message.body == nil {
message.body = message.NewBody()
}
return message.CreateElement(message.body, name, ns)
}
func (message *SoapMessage) Header() *SoapHeader {
if message.header == nil {
message.header = &SoapHeader{message: message}
}
return message.header
}