So I am calling a wcf webservice using Rest WebHttp. I also have set up a second binding mex for testing. My method is working but when I try to test through fiddler or straight httppost through a client app I get a 400 Bad request error. I am passing mutliple datacontracts to the method. It forces me to use the BodyStyle of wrapped but I don't know how to format my xml for the test. I have created a test method to try this out and same error. Here is my code: All my other methods work with one datacontract but this one where I have two doesn't. I beleive the issue is in the xml at the bottom of this post, it needs to be wrapped but I do not know how to wrap it.
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped)]
string Test(wsAuth a, wsMed m);
[DataContract(Namespace = "")]
public class wsMed
{
[DataMember]
public string Test{ get; set; }
}
[DataContract(Namespace = "")]
public class wsAuth
{
[DataMember]
public string UserName { get; set; }
[DataMember]
public string Password { get; set; }
[DataMember]
public string DeviceId { get; set; }
}
my xml that I am using
<Test>
<wsAuth>
<DeviceId>jenglish</DeviceId>
<Password>treetop</Password>
<UserName>jenglish</UserName>
</wsAuth>
<wsMed>
<Test></Test>
</wsMed>
</Test>