英文:
Convert dataframe into a payload using custom-made SOAP-Envelope?
问题
我需要帮助使用我拥有的数据框架来构建 SOAP Envelope,以便将其用作POST API请求的有效载荷(在SAP服务器上)。此有效载荷必须采用特定格式/ SOAP Envelope,我使用WSDL URL接收到了它。
以下是我用于发布数据的代码。
import requests
url = '我的SAP网址';
# 结构化XML
payload = df_xml_test.to_xml()
certificate_file = "certificate.pem"
# 标头
headers = {
'Content-Type': 'application/soap+xml; charset=utf-8'
}
# 发送POST请求
response = requests.request("POST", url, headers=headers, data=payload,
cert=certificate_file, verify=False)
# 打印响应
print(response.text)
print(response)
我收到了一个响应 500
而不是响应 200
。
英文:
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
.
答案1
得分: 1
使用字符串附加和迭代来实现。
英文:
Did using string append and iterations
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论