views:

187

answers:

4

We're switching from a legacy app written in ColdFusion to an ASP.Net Web Forms application. One requirement is to move over the legacy web service. The address can change, but the format of the input and responses have to be the same. I'm relatively new to web services, but I know that there are both SOAP and JSON output formats for a .Net web service (maybe others). But neither of these are workable.

I need to have complete control over the response given. If I were doing it with an .ASPX page, I would just write the legacy repose into a string, clear the Response and then add that string to the Response and call Response.End.

Is there something similar for a .ASMX?

Is there a smarter way to do it and still be able to integrate with the rest of the ASP.Net web application's code base?

A: 

Depends on the format you need.
ASMX and WCF will generate bona-fide SOAP responses.
If I understand correctly, You said "SOAP is not workable". If you need an odd format, you can certainly generate it the way you described with an ASPX page. The programming model won't be as nice, though.

Cheeso
+1  A: 

If you just need complete response control, then skip the ASPX page cycle drama and look into using a .ASHX instead. It's fairly raw and may be what you need.

routeNpingme
That exactly what I need to know, how to have TOTAL control over the output. Thanks
Jared
A: 

What version of Visual Studio are you using? If you have Visual Studio 2008 (SP1), then you should not create an ASMX web service. Microsoft now considers that technology to be "legacy", and does not plan to fix any bugs in it.

Instead, you should create a WCF service. You can control the output format completely.

John Saunders
A: 

You can use WCF to implement plain old XML (POX) instead of SOAP.

The WebHttpBinding is the binding to use for this. If your "complete control" negates the possibility of reverse engineering the existing service into an explicit WCF contract then you can use a Stream to get complete control of the output.

Tuzo