views:

16

answers:

2

I am developing a PHP script that has to make some calls to a web service. This web service is running on the LAN of our client. This means I do not have access to it yet. I will go to the client to test it, but would like to be able to test my code before I go all the way over there.

Is there an easy way to set up some kind of fake web service (preferably based on a WSDL file) on my development PC without actually creating a web service on this network (system admins won't like that)? I don't want to just create a static class as a stub or something, because it's not really the functionality of the web service I want to test, but more all the stuff around it. Like I'm putting in the right type of object and I'm making the correct calls to PHP functions to connect to the web service etc.

Thanks in advance.

+1  A: 

I don't see why running a web service on localhost should upset your sys admins, no data will leave your machine. They don't even need to know you're doing this.

For testing the stuff you want to test calling a fake web service is by far the best. I don't use PHP myself, but in my development environment (Java as it happens) knocking up a fake service is pretty quick, presumably in your case too.

djna
If I set up a web service on my PC, won't that open up my PC more to the network? Or is it easy to just set it up as only on localhost?
Matthijs Wessels
+1  A: 

PHPUnit has ability to mock webservices:

http://www.phpunit.de/manual/3.4/en/test-doubles.html#test-doubles.stubbing-and-mocking-web-services

Mchl
Wow thanks, that's exactly what I was looking for. I couldn't find it because I kept ending up with stuff to test a web service instead of the client-side.
Matthijs Wessels