Re: Call REST webservice in XPA 3.3


Andreas Sedlmeier
 

On Thu, Jan 3, 2019 at 12:24 AM, Todd Baremore wrote:
I'm missing something.  How is recreating a 3rd party's web service easier than just working with the web service itself
It's not easier, its just better. Most of the time even for most trivial APIs - and for more complex APIs I would say it's mandatory because only by mocking you then can test units of work and isolate problems resp. work around service dependencies for which you have your integration tests and where tools like the one I named help a lot too. Just google for advantages and benefits of unit testing and mocking to get tons of good documents.

For Magic development this is in my strong opinion even more important and relevant because the possibilities to refactor code in Magic (which often is needed to test units of work) are very limited in a tool where not even copy/paste of source code works reliable ^^.  Actually if you add a testing framework for Magic API clients you could even use that for the production version because Magic is a poor API client anyway where most of the required functionality is simply missing and has to be implemented "by feet" - where you elsewhere just work with annotations and dependency injection, ...

Its of course not a bad idea to suggest to Gabor to start with something easy, as you did, to get used to implement a REST (API) client. That was not the point anyways.

If he/she has however service definition files for the real API, the Mock services (and test clients) are generated automatically anyway and that's pretty easy then, you just have to get familiar with today's tooling and that's of course another issue. It's however mandatory too in my opionion if you do a lot with services, APIS, ...

Andreas

Join main@magicu-l.groups.io to automatically receive all group messages.