Python Spyne自定义输出参数

时间:2016-06-22 01:33:23

标签: python soap spyne

我需要在Spyne中输出这样的输出:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <getActiveServicesResponse xmlns="http://mci.tajmi.ir/">
            <getActiveServicesReturn>12345:2030:hafez poem:hafez </getActiveServicesReturn>
            <getActiveServicesReturn>12346:2031:شعر طنز:tanz </getActiveServicesReturn>
            <getActiveServicesReturn>bardari123:203861:سرویس بارداري :bar
</getActiveServicesReturn>
        </getActiveServicesResponse>
    </soapenv:Body>
</soapenv:Envelope>

我能产生的是

<?xml version='1.0' encoding='UTF-8'?>
<soap11env:Envelope xmlns:soap11env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://mci.tajmi.ir/">
    <soap11env:Body>
        <tns:getActiveServicesResponse>
            <tns:getActiveServicesReturn>
                <tns:string>12345:2030:hafez poem:hafez</tns:string>
                <tns:string>12346:2031:شعر طنز:tanz </tns:string>
                ....
            </tns:getActiveServicesReturn>
        </tns:getActiveServicesResponse>
    </soap11env:Body>
</soap11env:Envelope>

如何自定义输出?我尝试了复杂的方法但没有成功。

1 个答案:

答案 0 :(得分:1)

https://github.com/timi-ro/simulator查看我的代码。你可以找到如何制作它。还读它: Spyne - how to duplicate one elements of wsdl file created by spyne?