For those who were subscribed to my old blog, this is a bit of a rehashing so forgive me. I'm in the middle of building a Web Service where I have to return some information about hotels. The data is stored in SQL Server, but I'm focusing on getting the messaging interface done before delving into the actual data retrieval. The web service has the requirement that it must conform exactly to the interface of an existing web service from one of our business partners. That way, our partners can go to the web.config file and swap out their implementation for ours. Turns out the syntax and semantics of their messages are pretty quirky (read crappy). For example, rather than making use of the SOAP Fault facility, their message format defines an
Anyway, I digress. The point is that I want to test that the message structure returned from the web service conforms to their specifications under normal conditions and exception conditions. I know I only need to pass the SQL stored procedure (which I haven't written yet) two parameters: DestinationCode and HotelCode. What I really want to do is to create an interface that defines the operation like so:
This way, I can build myself a mock implementation of the IHotelGateway interface that returns some sample data right away, letting me concentrate on getting the interface right before I worry about the implementation details. This has the benefit of allowing the business partner to test their client against my web service without having to wait for me to do all the wiring against the database. The next problem I anticipate is that there will be several places in my local code that look like this:
Update: Dug up the original thread from Chris Anderson's weblog.
Posted by Christian at June 14, 2004 01:51 PM |