0

I've been handed a project that needs some work doing and the original team that created it have all since left the company. This has been sat "on-the-shelf" for 4 years and everyone but our client had forgotten about it. They want it delivering now and it doesn't work.

The system is a relatively simple ASP Web Forms application for submitting data to another service via 2 WSDL interfaces, logging that request in a SQL database and submitting the response to another service via OPC.

I can set up all of those interfaces for testing except the WSDL. I just have the software here to run. Is there any way I can easily create a service to simulate the final one so I can test my software. I only have the 2 WSDL files to go on. These aren't complicated services. I'm only using 4 methods total.

I've been led to believe that the original creator of this system did something similar but I can't find what he used or any documentation about it. I expect it was run on his laptop and was lost when he left the company.

A Jackson
  • 2,776
  • 7
  • 34
  • 45
  • 1
    You can just generate the web service and function by the WSDL. follow http://stackoverflow.com/questions/1221121/generate-webservice-from-wsdl. For the logic in function, you can use decompiler to get the code inside and update the generate code. – daniel Aug 24 '15 at 10:27
  • dotPeek can help you to decompile the exe / dll of the web service. – daniel Aug 24 '15 at 10:34

1 Answers1

0

The WCF service client should be wrapped and exposed via an interface to your software. That way, you can mock the interface and test how your software responds to various inputs/outputs from the mocked service client. You control all aspects of what is returned, including potentially throwing exceptions as the real WCF service client would.

This is basically the reason why the "I" in SOLID exists - because substitution of implementation based on interface is simple to do.

toadflakz
  • 7,764
  • 1
  • 27
  • 40
  • Yes, that helps me test most of the system. But not the service client itself. – A Jackson Aug 24 '15 at 10:35
  • The service client is autogenerated code by Microsoft when you add the necessary service references to your project - not much you can do if their code is wrong, to be honest beyond writing the entire client yourself but I wouldn't recommend it. – toadflakz Aug 24 '15 at 10:47