views:

482

answers:

2

Is there anyway to configure WCF endpoint/binding to send the data "as-is" without wrapping as a soap message (with the Envelope tag, etc.)?

I'm trying to send an xml using WCF and its ended up wrapped as a soap and i would like that the server side would get it as plain xml (exactly as the original) because i can't change the server side at this point.

+1  A: 

There is a write up on MSDN for "POX" (plain old xml), but I haven't tried it out. (http://msdn.microsoft.com/en-us/library/aa395208.aspx)

I was able to use the answer from a REST/SOAP stackoverflow question to return plain text (which I assume could be xml): http://stackoverflow.com/questions/186631/rest-soap-endpoints-for-a-wcf-service

smaglio81
can you use POX for non-http endpoints? i'm using TIBCO as my "service" and when i try to set the end-point with the "webHttp" element, it complains that 'System.ServiceModel.Description.WebHttpBehavior' is only intended for use with WebHttpBinding or similar bindings.any other alternative?
Or A
Thanks for the vote-up. I also liked marc_s answer. I'm glad he was able to clear up the binding issues.
smaglio81
+3  A: 

Check out the excellent screen cast series by Pluralsight, which covers all of WCF REST extensively:

Specifically, there's on screen cast on:

HTTP Plain XML (POX) Services

marc_s
can you use POX for non-http endpoints? i'm using TIBCO as my "service" and when i try to set the end-point with the "webHttp" element, it complains that 'System.ServiceModel.Description.WebHttpBehavior' is only intended for use with WebHttpBinding or similar bindings.any other alternative?
Or A
I don't think so - POX is really usually associated with HTTP. You should be able to expose your TIBCO service as a HTTP endpoint, however - I'm doing that right now :-) (as a client)
marc_s
how can i do it? do i need to configure anything on the server side or i just change my TIBCO address (tcp://....) to http one?
Or A
Well, if your service normally requires tcp://, then you'd have to build a "front" service that can take in http:// requests, and then turn around and call your TIBCO stuff on tcp.//
marc_s
See this 2-part MSDN article on building a "WCF Router": http://msdn.microsoft.com/en-us/magazine/dvdarchive/cc500646.aspx - it'll be part of WCF 4 with .NET 4, too (out sometime later this spring)
marc_s
in the case of TIBCO, you can extense TemsMessageProtocol and then you can override and control how the message will get piped out. I got it to work and it makes everything else much easier.
Or A
The Pluralsight video seems to be "subscriber only" That said, I've found it at http://www.msdev.com/Directory/Description.aspx?eventId=1312
SteveC