Excelのデータを使用してXML SOAPリクエストを作成しようとしています。現在、makoテンプレートを使用していますが、XMLテンプレートが必要です。どのように私は(これは単なる小さなサンプルではない完全なXMLである)以下のような名前空間を使用して要求を作成します:Python ElementTree、LXMLなどのライブラリを使用してSOAPリクエストを作成する方法
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mes="http://www.orange.com/Webalc/Interfaces/ManageSupplierQuote/RequestForQuotation/v3/message">
<soapenv:Header/>
<soapenv:Body>
<mes:CalculateSupplierQuote>
<!--1 to 500 repetitions:-->
<SupplierQuote>
<local_circuittype>Existing circuit</local_circuittype>
<local_businessOpportunity>Access to Orange Business Services Network</local_businessOpportunity>
<local_accessType>Upgrade/downgrade of full path diversity</local_accessType>
<!--Optional:-->
<local_configurationSite>single</local_configurationSite>
私はいくつかの進歩を遂げることができていますが、その後、私は立ち往生午前lxmlのライブラリを使用することにより。以下は私が作成したコードです。
from lxml import etree
import lxml.etree
import lxml.builder
Envelope = etree.Element("{http://www.w3.org/1999/soapenv}xmlns")
body = etree.SubElement(Envelope, "{http://www.w3.org/1999/soapenv}body")
print(etree.tostring(Envelope, pretty_print=True))
あなたがこれまでに試してみましたか?あなたのコードとそれが出力するものを投稿してください。 投稿したXMLも有効ではありません。完全なファイルを投稿してください。 –
こんにちは@PabloArias、私は私の質問を編集しました。私は先週、このコードを作成して、makoテンプレートを作成しました。 –