Can I call a web service based on the URL name and method?

I have a webservice http: // localhost: 51624 / Service1.asmx that has a method

public object HelloWorld(object)

My requirements are simple or can be complicated.

  • Do not add a link to the service
  • Do not use wsdl to generate proxies.

I want to call something like

WebService Ws = new WebService();
Ws.url = "http://localhost:51624/Service1.asmx";
Ws.MehtodName =  "HelloWorld";//Need to pass object type as parameter somehow.

object result = Ws.Invoke();

Thanks, Advance, Bhaskar

+3
source share
1 answer

You can write a class that creates the required XML and then uses the object XMLHTTPRequestto send the XML to the web service. This will effectively “call” the web service and respond with other XML (which, if you are interested in the answer, you will need to decode again).

Just go to the url http://localhost:51624/Service1.asmx, click on the method and read the examples.

, , . ...

.

+4

All Articles