Sure, you can do that; but the problem is that you then have to worry about type system mismatches between the interface definition language, and the back- and front-end application languages.
There have been lots of things that do something like this: SOAP and the associated WS-* standards are probably the best known.
There have been lots of things that do something like this: SOAP and the associated WS-* standards are probably the best known.