I have an HttpHandler that acts as a proxy between website visitor and a windows hosted WCF service. Right now the WCF service is setup to handle a json request, but I would like to convert the json request to net.pipe or net.tcp or any of the protocols that WCF can handle. I am hoping to have a communication that goes:
client <--json using HTTP(S)--> IIS/HttpHandler <--SOAP/XML using net.pipe--> WCF service
Is this possible?
Right now I am just using the HttpHandler to make another webrequest to the WCF service, but would like to get away from that. The problem is that with the proxy, there is no real way (that I can see), on how to deserialize a response if the method I am calling contains an out parameter.
For instance take this method:
int DoSomething(string x, out long y)
If I were to call that method using a standard WCF proxy object within the logic of the HttpHandler proxy, how could I then serialize that response to json (using WCFs json formatting) and feed it back to the client?
-
I think if you are designing with services in mind, you want your "methods" to have message-oriented signatures.
ResponseMessage DoSomething(RequestMessage) {...}
rather than
int DoSomething (String x, out long y) {...}
It avoids the challenge you raise in your question, among other problems. It helps you think in terms of messages into and out of the service, rather than parameters.
Getting back to the root of your question... I think what you are hinting at is a protocol bridge between the client which speaks JSON/HTTP and the WCF service, which you want to be listening on a net.pipe channel. Well, sorry to say, there is no automagic protocol bridge that does this for you.
But maybe you are not looking for magic. If you are satisfied with writing the bridge code, then yes, it will work fine. But clean up those method signatures first.
0 comments:
Post a Comment