views:

115

answers:

0

Hi,

I am trying to consume a RESTFul WCF service's Method through a POST request. Following is Webservice's method signature

[DataContract(Namespace = "")]
    public class CompositeType
    {
        bool boolValue = true;
        string stringValue = "Hello ";

        [DataMember]
        public string StringValue
        {
            get { return stringValue; }
            set { stringValue = value; }
        }
    }

 [ServiceContract]
    public interface IService1
    {

        [OperationContract]
        [WebInvoke(UriTemplate = "/GetDataUsingDataContract",Method="POST")]
        CompositeType GetDataUsingDataContract(CompositeType composite);
    }

In POST request i send the input XML like this:

string input = @"<CompositeType xmlns='urn:abc'>               
                    <StringValue>Manoj</StringValue>
                  </CompositeType>";

It works fine with the above input XML and GetDataUsingDataContract() method gets called.. but In some scenario my input XML is like

string input = @"<ns2:CompositeType xmlns:ns2='urn:abc'>               
                    <StringValue>Manoj</StringValue>
                  </ns2:CompositeType>";

basically it has a local identifier for the class name added to it. In this case the request fails since it cann't Deserialize this XML to the DataContact defination. So is there some way I can ignore the leading localidentifier from the class name i.e even if there are some extra characters added to the root element, i want the correct method is getting called in WCF service...

Thanks a lot.. Manoj