def parseSoapPayload(payload):

    envelope = ET.fromstring(payload)

    assert envelope.tag == SOAP_ENV, 'Top element in soap payload is not SOAP:Envelope (got %s)' % envelope.tag

    header_elements = None

    for ec in envelope:
        if ec.tag == SOAP_HEADER:
            if header_elements is not None:
                raise ValueError('SOAP Payload has multiple header elements')
            header_elements = list(ec)
            continue
        elif ec.tag == SOAP_BODY:
            return header_elements, list(ec)
        else:
            raise ValueError('Invalid entry in SOAP payload: %s' % (ec.tag))

    raise ValueError('SOAP Payload does not have a body')
dataset/ETHPy150Open NORDUnet/opennsa/opennsa/protocols/shared/minisoap.py/parseSoapPayload/original