Answer the question
In order to leave comments, you need to log in
How to implement a stub for a web service listener by wsdl?
There was such a task.
When describing examples of interaction with a web service, it is usually covered:
- the development of the service itself
- the client of this service (which comes to the service and uses its functionality)
- mock objects (replacement of the web service / its functions in order to debug the client or the absence of the service itself)
And what approach should be used if a stub is required, which is behind the service? For example, a web service under test calls another service for a date, and upon receiving a response, conditionally outputs the day of the week that corresponds to this date. What if the initiator of the interaction is the service under test itself? We need an emulator that will implement some kind of logic in response to a service request (return xml / json), but there are no ideas how to approach it.
The situation is complicated by the fact that the service itself does not exist, but its wsdl exists. To work with WS for python3, the zeep library is mainly used, however, there are not many examples of its use on the network, and reading the manual is not so informative, because there is still no understanding of how it should all look like. In theory, you need to generate classes using wsdl, add your own logic to them, and raise it all as a service, but I haven’t found a single example anywhere on the net how this can be implemented.
For python2, there was a wsdl2interface lib that collected code based on wsdl, but for some reason I didn’t find analogues for the 3rd python, the wsimport utility in java seems to do the same - but I’m not sure that this is what I need.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question