C # WSDL web service webservice returns json and let pure Web services support HTTP request

C # WSDL web service webservice returns json and let pure Web services support HTTP request

Changing how data is returned,
with a return statement Context.Response.Write replaced
, modified as follows to return to the correct Json format data.

[WebMethod]  
    public void GetTest(String code)  
    {           
        String json=这里是转换的json结果
        Context.Response.Write(json);  
        Context.Response.End();  ##这里不用return 来实现返回,即可以跳过wsdl默认的返回方式。
    }

The Web.Config
## was added to the <system.web> in

<webServices>
        <protocols>
          <add name="HttpPost"/>
          <add name="HttpGet"/>
        </protocols>
</webServices>
Published 48 original articles · won praise 3 · views 20000 +

Guess you like

Origin blog.csdn.net/chscomfaner/article/details/103729828