Reputation: 33
I'm trying to send mtom/xop request using python behave. I'm not able to understand how can I send Content-id
I am using python3 and xml payloads.
Python code
url = 'http://www.example.com'
headers = {
'Content-Type': 'multipart/related; boundary="MIMEBoundary_337cc20b65587a0a19b6cc64978c33d1f46c4058e18a82ed"; '
'type="application/xop+xml"; '
'start="<[email protected]>"; '
'start-info="application/soap+xml"; action="urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-b"',
'Content-ID': '<[email protected]>'
}
Error
errors reported by MtomMessageValidator
Part has no Content-ID header
Exception HttpParseException
gov.nist.toolkit.http.HttpParseException: Part has no Content-ID header
at gov.nist.toolkit.http.PartParserBa.initPart(PartParserBa.java:30)
at gov.nist.toolkit.http.PartParserBa.<init>(PartPar`erBa.java:19)
--MIMEBoundary112233445566778899--
using this code to send headers in payload file and send POST request
tree = ET.parse(os.path.dirname(file) + '/../Payloads/XSD/ITI-41/ITI-41-S1_1.xml')
root = tree.getroot()
xmlstr = ET.tostring(root, encoding='utf8', method='xml')
body = xmlstr.decode('utf8')
# xml.dom.minidom.parseString(body)
response = requests.post(url, data=body, headers=headers)
context.status_code = response.status_code
context.response_document = response.text
Upvotes: 0
Views: 581