Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am trying to receive an XML parameter, through Rest WCF request. my input xml node is this:
XML
<RequestData  xmlns='RequestXML'>
    <market>Global</market>
  <gender>Female</gender>
    <stattype>None</stattype>
    <section>Profile</section>
    <viewoption>Total</viewoption>
    <mission>Total</mission>
    <group>Category Penetration - Overall</group>
    <filter>Total Sample</filter>
    <chartmode>Profiling</chartmode>
    <viewpage>Normal</viewpage>
    <samplefilter></samplefilter>
</RequestData>



It is read into a class :
C#
[DataContract(Namespace = "RequestXML")]
public class RequestData
   {
       [DataMember]
       public string market { get; set; }
       [DataMember]
       public string gender { get; set; }
       [DataMember]
       public string stattype { get; set; }
       [DataMember]
       public string section { get; set; }
       [DataMember]
       public string viewoption { get; set; }
       [DataMember]
       public string mission { get; set; }
       [DataMember]
       public string group { get; set; }
       [DataMember]
       public string filter { get; set; }
       [DataMember]
       public string chartmode { get; set; }
       [DataMember]
       public string viewpage { get; set; }
       [DataMember]
       public string samplefilter { get; set; }

   }


Now when I read this request, few parameters are received and few are not. eg: parameters : market,stattype,viewpage are always received where as rest of them are always null.

Here is the interface

XML
[OperationContract]
       //attribute for returning JSON format
       [WebInvoke(Method = "POST",
           ResponseFormat = WebMessageFormat.Json,
           RequestFormat= WebMessageFormat.Xml,
           BodyStyle = WebMessageBodyStyle.WrappedResponse,
           UriTemplate = "ProfileData")]
       //method
       List<ProfileData> GenProfileData(RequestData xmlRequestString);


I hope my questions is clear. Hoping for a quick response
Posted
Updated 6-Nov-14 5:38am
v2

1 solution

I would suggest you to use Fiddler[^] or even IE developer toolbar to check if what xml values are being sent to the web service.

Then you can be atleast sure that the correct data is sent and there is not issue with the request itself.

If this correct, next step would be to use Visual Studio and debug what do you receive on the web server and step into the constructor (or method). I hope by now, you should already see what's going wrong.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900