1

I've been using zeep as a client in my application to request data from SOAP APIs and I now want to build a simple mock server that returns some XML data. I thought I wouldn't need to build a true soap server and rather I'd just respond to requests with XML data and call it good but I'm running into an issue where my zeep client throws the error:

line 101, in service
"There is no default service defined. This is usually due to "
ValueError: There is no default service defined. This is usually 
due to missing wsdl:service definitions in the WSDL

I've seen solutions that would require:

client.create_service()

I'm wondering if anyone has found a way around doing this or if there was a way to return the wsdl file in the response from my mock server?

1 Answers1

0

Instead of building your own mock server (which might be a bit painful in Python, because SOAP support is basic at best), you could use a tool like SoapUI: https://www.soapui.org/docs/soap-mocking/service-mocking-overview/

If you already have the WSDL, you can use it with SoapUI, and you can feed it to your client also. Just pay attention to the SOAP address within it. Either change it inside the WSDL to point to your mock server, or mention a different address when creating the zeep client.

Bogdan
  • 23,890
  • 3
  • 69
  • 61