I am getting a `{"The remote server returned an error: (415) Unsupported Media Type."}` when I run a client against a RESTful web service I have created. The content types are correct in the client. The service runs correctly, under the WCF test client in vs 2010. I think my problem is within my client code or the way I'm sending/formatting the XML. Any advice is GREATLY appreciated.

Using VS2010, .net4

Web Service code:

```
public Charge GetCharge(Charge aCharge)
    {
        return aCharge;
    }

[ServiceContract(Namespace = "http://www.test.com/Charge")]
public interface IService1
{

    [OperationContract]
    [WebInvoke(Method = "POST", UriTemplate = "getcharge",
      RequestFormat = WebMessageFormat.Xml,
      ResponseFormat = WebMessageFormat.Xml,
      BodyStyle = WebMessageBodyStyle.Bare)]
    Charge GetCharge(Charge aCharge);
}

// Use a data contract as illustrated in the sample below to add composite types to service operations.
[DataContract(Namespace = "http://www.test.com/Charge")]
public class Charge
{
    [DataMember]
    public string ID
    {
        get;
        set;
    }

    [DataMember]
    public string Hours
    {
        get;
        set;
    }

    [DataMember]
    public string Comment
    {
        get;
        set;
    }

    [DataMember]
    public string DateT
    {
        get;
        set;
    }
}

```

Client code:

```
HttpWebRequest req = null;
        HttpWebResponse res = null;
        try
        {
            string url = "http://localhost:1657/Service1.svc/getcharge";
            req = (HttpWebRequest)WebRequest.Create(url);
            req.Method = "POST";
            req.ContentType = "application/xml";
            req.Timeout = 30000;
            req.Headers.Add("SOAPAction", url);

            System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
            xmlDoc.XmlResolver = null;
            xmlDoc.Load(@"c:\file\benCharge.xml");
            string sXML = xmlDoc.InnerXml;
            req.ContentLength = sXML.Length;
            System.IO.StreamWriter sw = new System.IO.StreamWriter(req.GetRequestStream());
            sw.Write(sXML);
            sw.Close();

            res = (HttpWebResponse)req.GetResponse();

        }
        catch (Exception ex)
        {
            System.Console.WriteLine(ex.Message);
        }

```

Client XML:

```
<Charge xmlns="http://www.test.com/Charge"><ID>1</ID><Hours>10</Hours><Comment>Mobile app development</Comment><DateT>01/01/2011</DateT></Charge>

```