4

「choice」引数を使用してメソッドへのリクエストを生成する方法は?

http://127.0.0.1/service?wsdlのwsdlの一部:

<xs:complexType name = "ByA">
<xs:sequence>
..。
</ xs:sequence>
</ xs:complexType>
<xs:complexType name = "ByB">
<xs:sequence>
..。
</ xs:sequence>
</ xs:complexType>

<xs:complexType name = "GetMethodRequest">
<xs:choice>
<xs:element name = "byA" type = "s0:ByA" />
<xs:element name = "byB" type = "s0:ByB" />
</ xs:choice>
</ xs:complexType>

私がする時

from suds.client import Client
client = Client("http://127.0.0.1/service?wsdl")
print client

そうか

GetMethod()

引数なし。

byAまたはbyBを使用してGetMethodを呼び出すにはどうすればよいですか?

4

3 に答える 3

5

これはsudsの既知のバグです https://fedorahosted.org/suds/ticket/342

于 2011-05-12T11:49:08.877 に答える
1

私はそれを修正しました:

class MyPlugin(DocumentPlugin):
    def setChoice(self, context):
        if not context.children:
            return
        for i in context.children:
            if i.name == "choice":
                for j in i.children:
                    i.parent.append(j)
            else:
                self.setChoice(i)

    def parsed(self, context):
        self.setChoice(context.document)


plugin = MyPlugin()
client = Client("http://127.0.0.1/service?wsdl", plugins=[plugin])
于 2015-12-28T14:06:25.800 に答える
0

wsdl全体を見ずに知るのは難しいです、あなたのリンクはあなたのローカルマシンにあります。

Suds Clientクラスは、wsdlと対話するためのインスタンス変数としてサービスクラスを使用します。このようなことを試しましたか?

from suds.client import Client
client = Client("http://127.0.0.1/service?wsdl")
client.service.GetMethod("byA")

また

client.service.GetMethod("byB")

于 2011-05-11T12:49:32.447 に答える