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

Function parseSOAPMessage

wsdiscovery/message.py:29–58  ·  view source on GitHub ↗

deserialize XML message strings into SOAP envelope objects

(data, ipAddr)

Source from the content-addressed store, hash-verified

27
28
29def parseSOAPMessage(data, ipAddr):
30 "deserialize XML message strings into SOAP envelope objects"
31 try:
32 dom = minidom.parseString(data)
33 except Exception as ex:
34 logger.debug('Failed to parse message from %s\n%s: %s', ipAddr, data, ex)
35 return None
36
37 if dom.getElementsByTagNameNS(NS_SOAPENV, "Fault"):
38 logger.debug('Fault received from %s: %s', ipAddr, data)
39 return None
40
41 actions = dom.getElementsByTagNameNS(NS_ADDRESSING, "Action")
42 if len(actions) == 0:
43 logger.warning('No action received from %s: %s', ipAddr, data)
44 return None
45
46 soapAction = actions[0].firstChild.data.strip()
47 if soapAction == NS_ACTION_PROBE:
48 return parseProbeMessage(dom)
49 elif soapAction == NS_ACTION_PROBE_MATCH:
50 return parseProbeMatchMessage(dom)
51 elif soapAction == NS_ACTION_RESOLVE:
52 return parseResolveMessage(dom)
53 elif soapAction == NS_ACTION_RESOLVE_MATCH:
54 return parseResolveMatchMessage(dom)
55 elif soapAction == NS_ACTION_BYE:
56 return parseByeMessage(dom)
57 elif soapAction == NS_ACTION_HELLO:
58 return parseHelloMessage(dom)

Callers 1

_recvMessagesMethod · 0.85

Calls 6

parseProbeMessageFunction · 0.85
parseProbeMatchMessageFunction · 0.85
parseResolveMessageFunction · 0.85
parseResolveMatchMessageFunction · 0.85
parseByeMessageFunction · 0.85
parseHelloMessageFunction · 0.85

Tested by

no test coverage detected