从PySimpleSoap服务器的SOAP请求获取属性

2024-10-05 15:27:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我对pySimpleSoap还很陌生,我正在用教程进行研究。但我需要你的帮助

以下是我的wsdl文件的一部分:

<xs:complexType name="DocumentType">
    <xs:sequence/>
    <xs:attribute name="Type" type="xs:string" use="required"/>
    <xs:attribute name="Version" type="xs:string" use="required"/>
    <xs:attribute name="ControllingInstance" type="xs:string" use="required"/>
</xs:complexType>

以及它在我的Soap请求中的表现:

<Document Type="test" Version="test" ControllingInstance="test"/>

我需要在词汇表中获得如下属性:

{'Document': 
    {'Type': u'test'}, 
    {'Version': u'test'}, 
    {'ControllingInstance': u'test'},
}

现在,我正在使用PySimpleSAP dispatcher:

   self.dispatcher.register_function(
       'function', 
       getattr(self, 'function'),
       returns=getattr(self, "_function_returns"(),
       args=getattr(self, "_function_args"()
   )

函数参数:

def _function_args(self):
    return OrderedDict([
        ('Document', OrderedDict([
                ('Type', str),
                ('Version', str),
                ('ControllingInstance', str),
            ])
        ),

但是函数总是返回“None”

另外,我用这个请求的格式进行了测试,结果很好,但我不能用那种方式编辑我的wsdl

     <Document>
        <Type>test</Type>
        <Version>test</Version>
        <ControllingInstance>test</ControllingInstance>
     </Document>

Tags: nametestselfstringuseversiontyperequired