0

IDLE を開いて suds クライアントをインポートすると、次の方法でクライアントを作成できます。

c = Client('http://blah/Core.svc?wsdl')

その後の呼び出し:

c2 = Client('http://blah/Core.svc?wsdl')

TypeNotFoundwsdlファイルでクラスを指定すると、エラーがスローされます。

私が試してみました:

timeout = 5 # and then waiting
cache = None

しかし、同じエラーが発生します。最初のインスタンスを使用できなくてもかまいませんが、2 番目のインスタンスを取得するにはどうすればよいですか?

私は、PySys の単一のインスタンスによって実行されるテストを作成していますが、個別にはデータを共有しません。

余談ですが、この後に quit() IDLE を実行すると、実行中のプロセスを強制終了するかどうかを尋ねられます。クライアントを作成するとスレッドが起動されると仮定して正しいでしょうか?

私が得るエラーは次のとおりです。

Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    c1 = Client('http://localhost:8090/Service/Core.svc?wsdl')
  File "build\bdist.win-amd64\egg\suds\client.py", line 119, in __init__
    sd = ServiceDefinition(self.wsdl, s)
  File "build\bdist.win-amd64\egg\suds\servicedefinition.py", line 58, in __init__
    self.paramtypes()
  File "build\bdist.win-amd64\egg\suds\servicedefinition.py", line 137, in paramtypes
    item = (pd[1], pd[1].resolve())
  File "build\bdist.win-amd64\egg\suds\xsd\sxbasic.py", line 63, in resolve
    raise TypeNotFound(qref)
TypeNotFound: Type not found: '(ClassName, http://schemas.datacontract.org/4004/07/Class.Namespace, )'

c.last_received() と c.last_sent() はどちらも空です。

さらに進んで、IIS のログを調べたところ、Python インスタンスで初めて Client(url) を呼び出すたびに、次のようになることがわかりました。

GET /Service/Core.svc   wsdl    8090    -   ::1 Python-urllib/2.6   
GET /Service/Core.svc   xsd=xsd0    8090    -   ::1 Python-urllib/2.6   
GET /Service/Core.svc   xsd=xsd2    8090    -   ::1 Python-urllib/2.6   
GET /Service/Core.svc   xsd=xsd1    8090    -   ::1 Python-urllib/2.6   
GET /Service/Core.svc   xsd=xsd3    8090    -   ::1 Python-urllib/2.6   
GET /Service/Core.svc   xsd=xsd2    8090    -   ::1 Python-urllib/2.6   
GET /Service/Core.svc   xsd=xsd1    8090    -   ::1 Python-urllib/2.6   
GET /Service/Core.svc   xsd=xsd3    8090    -   ::1 Python-urllib/2.6   
GET /Service/Core.svc   xsd=xsd2    8090    -   ::1 Python-urllib/2.6   
GET /Service/Core.svc   xsd=xsd1    8090    -   ::1 Python-urllib/2.6   
GET /Service/Core.svc   xsd=xsd3    8090    -   ::1 Python-urllib/2.6   
GET /Service/Core.svc   xsd=xsd2    8090    -   ::1 Python-urllib/2.6   
GET /Service/Core.svc   xsd=xsd3    8090    -   ::1 Python-urllib/2.6   
GET /Service/Core.svc   xsd=xsd1    8090    -   ::1 Python-urllib/2.6   
GET /Service/Core.svc   xsd=xsd2    8090    -   ::1 Python-urllib/2.6   
GET /Service/Core.svc   xsd=xsd3    8090    -   ::1 Python-urllib/2.6   

しかし、同じ python インスタンス内からの後続の呼び出しでは、次のようになります。

GET /Service/Core.svc   wsdl    8090    -   ::1 Python-urllib/2.6
GET /Service/Core.svc   xsd=xsd0    8090    -   ::1 Python-urllib/2.6
GET /Service/Core.svc   xsd=xsd2    8090    -   ::1 Python-urllib/2.6
GET /Service/Core.svc   xsd=xsd3    8090    -   ::1 Python-urllib/2.6
GET /Service/Core.svc   xsd=xsd1    8090    -   ::1 Python-urllib/2.6
GET /Service/Core.svc   xsd=xsd2    8090    -   ::1 Python-urllib/2.6
GET /Service/Core.svc   xsd=xsd3    8090    -   ::1 Python-urllib/2.6

応答のサイズは、特定のファイルが要求されるたびに同じです。

4

2 に答える 2

1

SOAP サービスを使用している場合、IDLE または Python コマンド シェルまたはスクリプト (Windows を使用しています) のいずれかで再現できないため、これは他の場所 (つまり、WSDL を提供するサービス) で問題になる可能性があります。

正確なエラー、suds のバージョン、問題の WSDL への実際の URL を教えていただけますか?

以下の出力は、どのように試しても同じです。

>>> from suds.client import Client
>>> c1 = Client('http://vocab.nerc.ac.uk/vocab2.wsdl')
>>> c2 = Client('http://vocab.nerc.ac.uk/vocab2.wsdl')
>>> c1
<suds.client.Client object at 0x022AE230>
>>> c2
<suds.client.Client object at 0x022CCDB0>
>>>

編集:

IDLEでコードを実行せずにタイプquit()して終了しても発生するIDLE終了時の通知について

編集2:

ここに記載されているいくつかの手法(last_sent とログの両方)を使用して、これをデバッグしてみてください。

于 2012-09-10T18:35:57.537 に答える