Simple Recipe for SOAP Echo Service
I ran across yet another couple of people looking to implement a SOAP echo server, this time for load testing. Here’s how to do it very simply:
What is SOAP? It’s an HTTP POST containing XML, and an HTTP response containing XML. You can make an echo server by – here it is – simply serving a static XML file. That’s it. Just put an XML file on your http server and you’re done.
One complication – many HTTP servers, including apache, get unhappy if you POST to a static page. So make it a php page. Or any other scripting language you like. All you want is the ability to accept POST and spit out XML.
Here’s how not to do it: don’t use Apache Axis. No sense in that. Remember, SOAP is just XML over HTTP. So just do XML over HTTP.
Update: Mark likes it, Savas doesn’t. I should mention I fully realize that SOAP is transport independent and not tied to HTTP, and that I’m looking forward to all the implementations of SOAP over messenger pigeon. For SOAP over HTTP, the above will work for you.
Manage your expenses via Email, SMS, iPhone, Twitter, Voice (Call and say your expense), IM (Yahoo, AIM, MSN), or Web.
Comments(4)
Fantastic idea. It really undersores how _simple_ SOAP was supposed to be, and how complicated everyone makes it.
I’m pretty sure that the Apache prohibition against POSTing to a static page is a config option. Don’t quote me on that, but it’s worth looking into if you want to do real load testing without swamping the poor PHP/scripting system.
I must be missing something, but isn’t an echo server supposed to return something *different* depending on the SOAP request? How can this be a static page?
Stefan, excellent point, of course an echo server should echo the input, which this setup doesn’t. I used the term simply because the people who were originally looking to implement the “echo server” were returning simple static content.
What I’ve described here is a ping service or something like that. What we ended up doing was using a php script to embed a few pieces of info (eg. current time in miliseconds, ip address of calling party, etc) into the response so it’s not entirely static, but doesn’t echo the input either. The php document is basically an XML doc that has contents of the fields filled in by small php segments. I’ll post it one of these days.
I like the concept. It is a bit misleading to call it an echo server when in fact it doesn’t echo anything, but that’s a really small issue if all you are trying to do is to get a basic SOAP functionality working from your client.
Nice!