serialize a SOAP envelope object into a string
(env)
| 27 | |
| 28 | |
| 29 | def 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 | |
| 62 | def parseHelloMessage(dom): |
no test coverage detected