Web service method signature changed to request / response objects for data type string []

I have two websites, both using .Net framework 3.5. One website hosts a soap web service, and the other refers to this service. I have some unexpected events with my signatures on the Internet. I have a simple method in my web service with a signature like:

[WebMethod]
public string[] HelloWorld()
{
    return new[] { "Hello World" };
}

But when I refer to this web service using the Add Service Link function in VS2008, with the setting "Always create contracts with messages" (although when I check the "reuse types in reference assemblies", it seems to me there is the same problem), the signature, apparently, changes by automatically generated proxy objects to the following:

HelloWorldResponse HelloWorld(HelloWorldRequest request)

I tried to find this on the net, but could not find something that would simply explain to me why this was happening, and could I / try to get around it?

I also have this question: How to determine whether to select a service link configuration parameter for "reuse types in referenced assemblies" and "always generated message contracts"?

+3
source share
1 answer

The message-contract option may have this effect; the goal here is to provide small-scale control over the underlying request. Ultimately, what you send (off-screen) is the payload of the request.

( , string[]), , 100% - Customer () , -, -.

, , WCF ([WebMethod] - -). , "Web Reference"; "", " -...". wsdl.exe , [WebMethod] (asmx), WCF (svc).

, , [WebMethod], ( 3.5) WCF; .

WCF; , , , . [WebMethod].

+1

Source: https://habr.com/ru/post/1714737/


All Articles