WWW

Hi,

I’ve been messing with the www class and am confused have never done any comms with webservices before im just trying to get a simple helloworld to response from the webservice but i keep getting a doctype line, im sure im doing something stuipd, can anyone help?

code below:

Unity Code:

using UnityEngine;
using System.Collections;

public class ServerComms:MonoBehaviour{

GameMaster m_gm;
string m_sUrl;
string m_sResult;

public IEnumerator Start()
{
m_gm = GameObject.Find(“__GameMaster”).GetComponent();

m_sUrl = “http://localhost/dummy/DataService.asmx?op=HelloWorld”;

// Host: localhost
//Content-Type: application/x-www-form-urlencoded
//Content-Length: length

WWWForm post = new WWWForm();

post.AddField(“Host”, “localhost”);
post.AddField(“Content-Type”, “application/x-www-form-urlencoded”);
post.AddField(“Content-Length”, 10);

WWW www = new WWW(m_sUrl, post);

yield return www;

m_gm.m_sMessage = www.text;

}

}

Web Service Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace HorizonService
{
///


/// Summary description for Service1
///

[WebService(Namespace = “http://tempuri.org/”)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class DataService : System.Web.Services.WebService
{

[WebMethod]
public string HelloWorld()
{
return “Hello World”;
}
}
}

never mind iis was not set up correctly, thanks for the help tho