Why WebService Methods are being accessed with? Operator RRS feed

  • Question

  • Hi,

    I 've been using .asmx web services by creating proxy client by adding web reference to my Proj and creating an object of the service. Recently I stumbled upon a C++ code which uses Get method to access asmx service methods in the following format of URL

    http://<myWebService>.asmx/<Methodname?Param1=value1&param2=value2&param3=value3 and so on...

    Generally we use this for Get Method but can we access Web Service Methods like this as well? Since the code is working fine I might not be aware of this way to access Web Services. Could some one explain why and how is this happening?



    • Edited by Pa1 Kumar Friday, November 7, 2014 6:02 AM
    Friday, November 7, 2014 6:00 AM


  • Hi Pa1 Kumar,

    In the asmx web service, we can add the protocol(Get Or Post) to our web.config, but inside a location element. Then specify the webservice location as the path attribute, like below:

    <location path="YourWebservice.asmx">
            <add name="HttpGet"/>
            <add name="HttpPost"/>

    Or we can declare UseHttpGet over our method:

    [ScriptMethod(UseHttpGet = true)]
    public string HelloWorld()
        return "Hello World";

    After that we can call the web method with the Get Operator.    
    Best Regards,
    Amy Peng

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, November 10, 2014 2:55 AM