0

If I have an existing WCF SOAP service which has an operation like this:

[OperationContract]
List<string> GetDetails(int id, string name);

Under the hood, WCF generates a GetDetails_InputMessage type to represent the parameters of the method.

Is there some way to change the service method implementation to explicitly use this type, without breaking any existing clients?

[OperationContract]
List<string> GetDetails(GetDetails_InputMessage parameters);
// with some extra magic?

(Or more precisely, to declare my own transport type that would end up generating exactly the same WSDL and behaviour so that existing clients can't tell the two apart.)

I assume that the extra magic will probably involve MessageContract but I haven't been able to find any references on switching an existing operation from one to the other without breaking anything.

(For further reference: I have an existing SOAP service to which I've added a webHttp binding, but noticed that the help pages are really bad at reporting WrappedRequest body, which is needed when there's more than one parameter that needs to be sent via the body. So I want to switch these to Bare body with an explicitly-specified wrapper type (since it does appear to be able to render those ok), but in such a way that it doesn't break existing SOAP clients as well. I would also accept an alternative answer to this question that is not "use IIS".)

Miral
  • 12,637
  • 4
  • 53
  • 93
  • Possibly. The way MS implemented SOAP in WCF is kinda like code-first when dealing with databases - the .NET code is created first and the WSDL is generated later (as opposed to the SOAP Java community who tend to always WSDL-first). If you could obtain the WSDL for your current service then you could generate the contracts; types; and method stubs via tools like [WCFblue](https://archive.codeplex.com/?p=wscfblue). I suspect then your parameters will change to the type you mentioned –  Oct 12 '19 at 00:40
  • I had a closer look at the code that generates the help pages, and it appears that they don't support generating examples for message types, just like wrapped types, which means I probably still won't be able to achieve what I actually want. Though I'm still curious about the answer. – Miral Oct 13 '19 at 08:25

0 Answers0