I have a wcf service which accepts a parameter like this:
[DataContract]
public class Person
{
[DataMember]
public int ID { get; set; }
[DataMember]
public string Name { get; set; }
[DataMember]
public string Family { get; set; }
}
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json, UriTemplate = "")]
int InsertPerson(Person person);
I am familiar how to consume a wcf service with string parameter from Objective-C but in this case I want to pass an instance of Person class as parameter. How can I do that?
NSString *path = [[NSString alloc] initWithFormat:@"http://192.168.0.217/JSON/Service1.svc/InsertPerson"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
[request setHTTPMethod:@"POST"];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…