I want to use Python Zeep SOAP Client to make SOAP Calls to an Cisco CUCM. In the Cisco WSDL File is the Service definded:
<service name="AXLAPIService">
<port binding="s0:AXLAPIBinding" name="AXLPort">
<soap:address location="https://CCMSERVERNAME:8443/axl/"/>
</port>
</service>
Now i want to change the "CCMSERVERNAME" to something real, like "192.168.250.10" without changing the WSDL.
But from the Docs i can't find anything to change that.
I found an Discussion here about changing the URL with "Client.set_address()" but this don't work anymore.
Can anybody give me an hint?
Edit: With mvt's help i got it, for anybody with the same problem, create the service with this command:
service = client.create_service(" {http://www.cisco.com/AXLAPIService/}AXLAPIBinding","https://192.168.250.10:8443/axl/")
Here an example from an working SOAP call:
phones = service.listPhone({'devicePoolName':'Default'},returnedTags={'name':'','model':''})
returns Devices in an list:
SEPFFFFFFFFFFAA Cisco 7841
SEPAAAABBBB2222 Cisco 7841
This should be possible via http://docs.python-zeep.org/en/master/client.html#creating-new-serviceproxy-objects
Cheers (author of zeep)
For an endpoint on a internal server, not reachable over the internet, port-forwarded port 80 using ssh to localhost:8080 I made the following snippet, it copies the service binding and applies a translation to the binding address to create a new service.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With