2009-08-25 19 views
10

私はSOAP Webサービスを(サービスはASP.netで書かれている)を呼び出すことSudsを使用して次のような単純なPythonのテストスクリプトがあります。パイソン/泡:タイプが見つかりません: 'XS:complexTypeの'

from suds.client import Client 

url = 'http://someURL.asmx?WSDL' 

client = Client(url) 

result = client.service.GetPackageDetails("MyPackage" ) 

print result 

私は、このテストスクリプトを実行すると(それがラップしていないとして使用されるコードのマークアップ)私は、次のエラーを取得しています:

(合わせて再フォーマット)WSDLファイルのヘッダのソースを見ると
No handlers could be found for logger "suds.bindings.unmarshaller" 
Traceback (most recent call last): 
    File "sudsTest.py", line 9, in <module> 
    result = client.service.GetPackageDetails("t3db" ) 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 240, in __call__ 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 379, in call 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 240, in __call__ 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 422, in call 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 480, in invoke 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 505, in send 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 537, in succeeded 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/binding.py", line 149, in get_reply 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 303, in process 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 88, in process 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 104, in append 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 181, in append_children 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 104, in append 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 181, in append_children 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 104, in append 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 181, in append_children 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 102, in append 
    File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 324, in start 
suds.TypeNotFound: Type not found: 'xs:complexType' 

<?xml version="1.0" encoding="utf-8" ?> 
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:s="http://www.w3.org/2001/XMLSchema" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:tns="http://http://someInternalURL/webservices.asmx" 
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
targetNamespace="http://someURL.asmx" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> 
私は、スキーマを修正するためにシュッドの doctor classを使用する必要がありますが、私はニーズが私の場合には、固定内容を正確に把握していないSOAPの初心者であること

suds.TypeNotFound: Type not found: 'xs:complexType' 

:私は、出力の最後の行に基づいて推測してい

。スキッドを修正/修正するためにSudsを使っている人はいますか?

+1

シンプルなC#テストアプリケーションを試したところ、このサービスに接続できます(ただし、サービスはASP.netベースです)。 Sudsがデフォルトでサポートしていないマイクロソフト固有のものかもしれませんか? – Danielb

+0

サービスがDataSetを返そうとしているようです。私はロガーで次のように見ています: 警告:suds.bindings.unmarshaller:属性(IsDataSet)タイプ、見つからない 警告:suds.bindings.unmarshaller:属性(タイプ)タイプ、見つからない エラー:suds .bindings.unmarshaller:Schema:0x7fce048c – Danielb

+0

SUDSのようなサウンドは、データセットの構造を指定するタグからインポートされません。 WSDLでインポートを検索しましたか? それが答えであれば、SUDSのImportDoctorが助けてくれます。例:https://fedorahosted.org/suds/wiki/Documentation#FIXINGBROKENSCHEMAs – ewall

答えて

15

Ewallのリソースはいいです。 suds tracのチケットを検索しようとすると、他の人には問題があることがわかります。similar to yoursしかし、さまざまなオブジェクトタイプがあります。例から学ぶ良い方法と、名前空間をインポートする方法です。

The problem is that your wsdl contains a schema definition that references the (...) but fails to import the " http://schemas.xmlsoap.org/soap/encoding/ " namespace (and associated schema) properly. The schema can be patched at runtime using the schema ImportDoctor as discussed here: https://fedorahosted.org/suds/wiki/Documentation#FIXINGBROKENSCHEMAs .

This is a fairly common problem.

A commonly referenced schema (that is not imported) is the SOAP section 5 encoding schema. This can now be fixed as follows:

(いずれも重視)。

WSDLに表示される名前空間を追加するために、これらのドキュメントが提供する行を試すことができます。これは、試行錯誤の可能性があります。

imp = Import('http://schemas.xmlsoap.org/soap/encoding/') 
# Below is your targetNamespace presented in WSDL. Remember 
# that you can add more namespaces by appending more imp.filter.add 
imp.filter.add('http://someURL.asmx') 
doctor = ImportDoctor(imp) 
client = Client(url, doctor=doctor) 

あなたはあなたが作業しているWSDLを提供しなかった、私はので、私は自分でこれらの可能性を試してみてと思う...あなたは私たちに表示されないに理由があるとします。がんばろう!

+0

私は何らかの理由でこれを答えとして受け入れられないようです。( – Danielb

+0

あなたの問題を完全には解決できないと知っていますが、あなたのwsdlを提供することはできません、私はこの状況で正確に問題を把握しようとすることはできませんので、あなたは問題で自分自身で進むことができるかどうかを確認するためにいくつかの一般的な "ブラインドデバッグアドバイス"あなたがこのコメントを書いて以来、私はあなたの問題に対する解決策を見つけられなかったと思います...あなたはSudsの公式サポートを試しましたか? – GmonC

関連する問題