XML Soap Request as KVM value - XML parsing error

Hi,

I am trying to insert a SOAP request as a value inside the kvm and modify the values inside the child nodes using a python script

.But whenever I am parsing the xml payload using python script its giving me the error

Error :

"xml.parsers.expat.ExpatError: Content is not allowed in prolog.""

Python callout :

import xml.etree.ElementTree as ET


payload = flow.getVariable("xml_payload")


tree = ET.fromstring('payload')


tree.find('/soapenv:Envelope[@xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"]/soapenv:Header/Security[@xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"]/UsernameToken').text  = "my-custom-value"


Can anyone help me on this ? I guess the issue is with well formed-ness of the xml data. But not sure on this.

0 1 216
1 REPLY 1

I pointed this out in reply to your other question: I think a better option might be to use AssignMessage or to use XSLT. Have you ruled out those options? If so, why?