2017-02-14 8 views
2

Python Zeep SOAP Clientを使用して、Cisco CUCMへのSOAPコールを作成します。シスコのWSDLファイルで サービスがdefindedさ:Python ZeepでサービスURLを変更する

<service name="AXLAPIService"> 
    <port binding="s0:AXLAPIBinding" name="AXLPort"> 
     <soap:address location="https://CCMSERVERNAME:8443/axl/"/> 
    </port> 
</service> 

を今私は、WSDLを変更せずに「192.168.250.10」のように、本当の何かに「CCMSERVERNAME」を変更したいです。

しかし、私はそれを変更するための何かを見つけることができません。

「Client.set_address()」でURLを変更する方法については、ここで説明しましたが、これはもう機能しません。

誰でも私にヒントを教えてもらえますか?

編集:

service = client.create_service(" {http://www.cisco.com/AXLAPIService/}AXLAPIBinding","https://192.168.250.10:8443/axl/") 

ここで働いてSOAPコールからの例:

phones = service.listPhone({'devicePoolName':'Default'},returnedTags={'name':'','model':''}) 
私はそれを得たMVTの助けを借りて 、同じ問題で誰のために、このコマンドを使用してサービスを作成

は、リスト内のデバイスを返します。

SEPFFFFFFFFFFAA Cisco 7841 
SEPAAAABBBB2222 Cisco 7841 

答えて

0

、ないローカルホストへのsshを使用してインターネット経由で到達可能な、ポート転送ポート80を介して:8080私は、次のスニペットを作り、それがコピーさサービスをバインドし、バインディングアドレスに変換を適用して新しいサービスを作成します。

def get_service(client, translation) 
    if translation: 
     service_binding = client.service._binding.name 
     service_address = client.service._binding_options['address'] 
     return client.create_service(
      service_binding, 
      service_address.replace(*translation, 1) 
    else: 
     return client.service 

# ssh port forwarded internal.example.com:80 to localhost:8080 

client = zeep.Client(wsdl="localhost:8080/endpoint?WSDL") 

# client.service now points to the unreachable url internal.example.com/endpoint 

service = get_service(client=client, translation=('internal.example.com', 'localhost:8080')) 

# service now points to localhost:8080/endpoint 
関連する問題