none
How can I find out the url to call my web service written in c# (asmx) RRS feed

  • Question

  • I' ve written several WebServices in c# with the help of ASP.net. The Services are pubished and I can test it in the following way:

    I've made a new Windows Project and added a Service Reference by referencing to the asmx file. So I get a type which I can use to instance a class with my serivices as methods,  like this:

    ErrandServices.WebServiceErrandBoysSoapClient l_Webservice = new ErrandServices.WebServiceErrandBoysSoapClient();
    
    l_Ergebnis = l_Webservice.login(c_textBoxResult.Text);

    But how can the services invoked directly via the url, like http://###.###.###.###/MyService.asmx/MethodName.... ?

    How ist the Syntax for adding the Method name and the parameter name and value?


    Regards From Austria Manfred Homm



    • Edited by ManfredHomm Wednesday, February 19, 2014 9:41 AM
    Wednesday, February 19, 2014 9:40 AM

Answers

All replies

  • SOAP services work by sending an HTTP Post containing an Soap "Envelope" with the paramaters in an XML body. You also need to specify the method in a special "action" header.

    Soap serivces are not meant to be called via URL.

    You want to either create a HTTPRequestHandler that does what you want, or create a REST API.


    JS

    • Marked as answer by ManfredHomm Thursday, February 20, 2014 7:18 AM
    • Unmarked as answer by ManfredHomm Thursday, February 20, 2014 7:18 AM
    Thursday, February 20, 2014 12:16 AM
  • Hi JS,

    thanks for your answer.

    I have found the following solution:

    • Turn on HTTP-GET by adding this lines to the web.config:
    	<webServices>
            	<protocols>
                		<add name="HttpGet"/>
                		<add name="HttpPost"/>
            	</protocols>
        	</webServices>


    Regards From Austria Manfred Homm

    • Marked as answer by ManfredHomm Thursday, February 20, 2014 7:24 AM
    Thursday, February 20, 2014 7:24 AM