Convert dataframe into a payload using custom-made SOAP-Envelope?

Question:

I have a Python project where I am supposed to convert my dataframe into a payload for POST API hit (on a SAP server). This payload must be in a particular format/SOAP Envelope which I received using the WSDL URL. I need help in framing the SOAP Envelope using the dataframe that I have.

Below is the code I am using to Post the data.

import requests

url = 'my SAP url'


# structured XML
payload = df_xml_test.to_xml()
certificate_file = "certificate.pem"

# headers
headers = {
    'Content-Type': 'application/soap+xml; charset=utf-8'
}

# POST request
response = requests.request("POST", url, headers=headers, data=payload,
                            cert=certificate_file,verify=False)
  
# prints the response
print(response.text)
print(response)

I received a Response 500 instead of a Response 200.

Asked By: FarzadAvari

||

Answers:

Did using string append and iterations

Answered By: FarzadAvari
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.