2

プロジェクトが外部 WSDL ファイルを提供する SOAP サービスを使用しています。Python + Suds を使用してサービスに接続しています。(https) サービス URL が次のようになっているため、問題が発生します。

/sipxconfig/services/UserService?wsdl

しかし、その URL の WSDLは、プロジェクトによって提供される外部 WSDL ファイルと一致しません。返された SOAP ドキュメントは、外部 WSDL ファイルと一致します。したがって、私の泡クライアントは障害を発生させます。

これまでのところ、動的に作成された WSDL (URL で) と一致するように、返された SOAP XML を「修正」する suds プラグインを作成することで、これを回避することができました。しかし、Subs クライアントに外部 WSDL ファイルをフィードしてから、サービスの URL を使用するように切り替える方法があることを期待していました。

私はこのようなことを試しました:

wsdl_file = os.path.abspath(args.wsdl_file)
client = Client("file://%s" % wsdl_file, transport=t, username=sip_user, password=sip_pwd, doctor=doctor)
client.set_options(location=url)

#Get the results.
user_search = client.factory.create("UserSearch")
user_search.byUserName = args.find_user
user_search.byFuzzyUserNameOrAlias = args.fuzzy
user_search.byGroup = args.group

result = client.service.findUser(user_search)
#^^^
#Error here!

しかし、最終的にはMethodNotFound例外が発生します。別の端末で netstat を実行すると、クライアントが外部サービスへのネットワーク接続を確立していないことがわかります。

Suds WSDL をファイルからフィードすることができた人は他にいますか?

ありがとう、カール

4

1 に答える 1

2

そのため、正しい軌道に乗っていると判断しましたが、SOAP サービスには複数のポートがありました。私は次のことをする必要がありました:

wsdl_file = os.path.abspath(args.wsdl_file)
client = Client("file://%s" % wsdl_file, transport=t, username=sip_user, password=sip_pwd, doctor=doctor)
client.set_options(location=url)

#Get the results.
user_search = client.factory.create("UserSearch")
user_search.byUserName = args.find_user
user_search.byFuzzyUserNameOrAlias = args.fuzzy
user_search.byGroup = args.group

result = client.service['UserService'].findUser(user_search)
#                      ^^^^^^^^^^^^^^^
# This was the missing bit that threw me off!

ありがとう、カール

于 2013-04-26T18:40:23.110 に答える