Thanks for all those who viewed this question. I didn't find a solution but I did find a work-around. I thought I'd post it here in case anyone else had the same problem.
As my web-service was only receiving and returning a string, I was able to configure the .net web service to accept GET requests in the web.config file to cover all methods in the service:
<webServices>
<protocols>
<add name="HttpGet"/>
</protocols>
</webServices>
Alternatively, you can use the following attribute if you wish to limit GET requests to one particular method:
[ScriptMethod(UseHttpGet = true)]
public string HelloWorld()
{
return "Hello World";
}
Instead of use wsdl to generate a stub, I used the WWW class that sent the url as a string. The string was concatenated to format the GET request for a webservice. The method I used in a Unity c# class is below:
public IEnumerator getMyWebService(string _inputText)
{
string url = "http://www.myserver.com/mywebservice.asmx/myMethod?inputText=" + WWW.EscapeURL(_inputText);
WWW www = new WWW(url);
yield return www;
Debug.Log(www.text); //Do something with the response as the www object.
}
Finally the line of code below was inserted into an Awake(), Start(), Update() or onGUI() method, to invoke the web service as-and-when required:
StartCoroutine(getMyWebService(inputText));
I would have liked to get a solution that used SOAP so I could efficiently handle the retured object from the web service. Hoever the deadline I had meant I had to find a workaround quickly!
This workaround had the added advantage of allowing the Unity project to be compiled as a Web Application (.unity3d) - which is prevented in Unity3 if you use a wsdl stub class / SOAP approach. So some benefits I guess :-)
(If you publish your .unity3d file on the same server as your web-service, then there is no need for a cross domain xml file at the root of the server)
If there is anyone out there ever in the same situation as me, I hope this is of use!
EDIT : Additional Info by Meltdown
To add to Luke’s excellent answer, many people may be wondering how to get rid of the XML that is returned with the WWW.text response from the server.
The following method accomplishes this…
Courtesy of [this post][1] from Snipplr.com
string StripXML(string source)
{
source = source.Replace("
", “”);
char buffer = new char[source.Length];
int bufferIndex = 0;
bool inside = false;
for (int i = 0; i < source.Length; i++)
{
char let = source*;*
if (let == ‘<’)
{
inside = true;
continue;
}
if (let == ‘>’)
{
inside = false;
continue;
}
if (!inside)
{
buffer[bufferIndex] = let;
bufferIndex++;
}
}
return new string(buffer, 0, bufferIndex);
}
[1]: http://snipplr.com/view.php?codeview&id=20590