jagamot
jagamot

Reputation: 5454

Webservices: Request-Response Mapper

This is more of a design-pattern question.

My client application [implemented and will run both as part of a scheduled batch job as well as a message processing application] makes SOAP over HTTP calls to a third party Engine to get some membership data. Since the underlying binding is done thought JAX-RPC, my SOAP response is eventually converted / copied into the generated client stubs.

Now, my question - Is it better to maintain my own domain objects and copy the data from the response objects of the service or is it OK if I can directly use the stub objects to do other processing!

Any suggestions?

Upvotes: 0

Views: 842

Answers (1)

smp7d
smp7d

Reputation: 5032

This question is going to be somewhat subjective. I prefer to always translate to my own domain objects in case I ever need to swap out the web service implementation. If they ever change over to RESTful web services or just simply change up their wsdl on a version upgrade, you may be out of luck if you are using the stub classes throughout your application.

There are cons to this practice though:

  1. You will need to maintain a similar set of classes
  2. If the service never changes, you wont see any returns on your effort
  3. You can always change this later if it proves useful

Upvotes: 1

Related Questions