在PySimpleSoap中将ComplexType作为函数调用

2024-04-19 21:37:20 发布

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

给定以下返回有效Soap/XML响应的PHP: 在

$params = new StdClass();
$params->subRequest = new StdClass();
$params->subRequest->endCSN = "0212341234";
$client = new SoapClient($WSDL);
$response = $client->qualifyProduct($params);

我试图用Python实现到这个web服务的连接,但是我没有走得太远——会遇到错误(我在PHP中尝试过,只是为了检查一下是否正常)。在

到目前为止,我已经尝试了一些在我头脑中似乎有意义的选择,包括: 在

^{pr2}$

所有这些都不起作用-而且都给我一个PySimpleSoap错误,比如:

ValueError: Invalid Args Structure. Errors: [u"Argument key subRequest not in parameter.

PySimpleSoap: How to pass a complexType as a function parameter的回答似乎提供了一线希望,但最终在我的实例中没有起作用。在

我确实有其他函数在处理给定的WSDL,但没有一个函数具有ComplexType,该方法定义为这样的提取,其中子请求和其他子请求类型在另一个.xsd文件中定义:

<xsd:complexType name="QualifyProductRequest">
    <xsd:sequence>
        <xsd:choice>
            <xsd:element name="subRequest" type="wsg:subRequest">
                <xsd:annotation>
                    <xsd:documentation xml:lang="en">A complex type capturing required data for a qualification</xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="anotherSubRequest" type="wsg:anotherSubRequest">
                <xsd:annotation>
                    <xsd:documentation xml:lang="en">A complex type capturing required data for a different qualification</xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        <! -- SNIPPED -->
        </xsd:choice>
    </xsd:sequence>
</xsd:complexType>

Tags: nameclientnewdocumentationtype错误annotationelement