I am trying to call a webservice from a c# script. For what I could understand, I should try with WWW and WWWForm (I also tried using System.Web.Services, the visual sutdio way, but it hans´t worked, as already posted somewhere in the forums).
Then I tried creating a wwwForm and passing it to a WWW object, but I don´t know how to call the intended webservice. I couldn´t succed calling the webservice I wanted.
Below there are some code excerpts showing what I tried creating a wwwForm and www object (but it fails). It gives no error/exception, but it is not working.
//Loading data on wwwform (form).
form.AddField(“xml”, Regex.Replace(doc.OuterXml, “"”, “'”));
//I thought of this to call the webservice. selectionReceiverHost is the address of the webservice (http://localhost/selectionreceiver/service.asmx)
WWW w = new WWW(selectionReceiverHost, form);
//Or this. But neither worked
w.InitWWW(selectionReceiverHost, form.data, headers);
How should I call a webservice? Would someone have an example?
You could try to generate a proxy class with the wsdl utility : start program → visual studio 2008 → Tools → Command prompt and type wsdl to watch the CLI options. It will generate a proxy .cs class that you can instanciate (the same type of class is generated under VS 2008 but hidden for easy of use).
But sincerely I doubt that it would wrk because of the missing of some dlls in the mono framework. Maybe on Windows…?
Otherwise, do a call test with a tool like Fiddler to generate your POST request to your webservice and see what it returns to parse the result (XML…)