MCPcopy Create free account
hub / github.com/andreikop/python-ws-discovery / createHelloMessage

Function createHelloMessage

wsdiscovery/actions/hello.py:29–59  ·  view source on GitHub ↗

serialize a SOAP envelope object into a string

(env)

Source from the content-addressed store, hash-verified

27
28
29def createHelloMessage(env):
30 "serialize a SOAP envelope object into a string"
31 doc = createSkelSoapMessage(NS_ACTION_HELLO)
32
33 bodyEl = getBodyEl(doc)
34 headerEl = getHeaderEl(doc)
35
36 addElementWithText(doc, headerEl, "a:MessageID", NS_ADDRESSING, env.getMessageId())
37
38 if len(env.getRelatesTo()) > 0:
39 addElementWithText(doc, headerEl, "a:RelatesTo", NS_ADDRESSING, env.getRelatesTo())
40 relatesToEl = headerEl.getElementsByTagNameNS(NS_ADDRESSING, "RelatesTo")[0]
41 relatesToEl.setAttribute("RelationshipType", "d:Suppression")
42
43 addElementWithText(doc, headerEl, "a:To", NS_ADDRESSING, env.getTo())
44
45 appSeqEl = doc.createElementNS(NS_DISCOVERY, "d:AppSequence")
46 appSeqEl.setAttribute("InstanceId", env.getInstanceId())
47 appSeqEl.setAttribute("MessageNumber", env.getMessageNumber())
48 headerEl.appendChild(appSeqEl)
49
50 helloEl = doc.createElementNS(NS_DISCOVERY, "d:Hello")
51 addEPR(doc, helloEl, env.getEPR())
52 addTypes(doc, helloEl, env.getTypes())
53 addScopes(doc, helloEl, env.getScopes())
54 addXAddrs(doc, helloEl, env.getXAddrs())
55 addElementWithText(doc, helloEl, "d:MetadataVersion", NS_DISCOVERY, env.getMetadataVersion())
56
57 bodyEl.appendChild(helloEl)
58
59 return getDocAsString(doc)
60
61
62def parseHelloMessage(dom):

Callers 1

createSOAPMessageFunction · 0.85

Calls 15

createSkelSoapMessageFunction · 0.85
getBodyElFunction · 0.85
getHeaderElFunction · 0.85
addElementWithTextFunction · 0.85
addEPRFunction · 0.85
addTypesFunction · 0.85
addScopesFunction · 0.85
addXAddrsFunction · 0.85
getDocAsStringFunction · 0.85
getMessageIdMethod · 0.80
getRelatesToMethod · 0.80
getToMethod · 0.80

Tested by

no test coverage detected