I am trying my hands on creating and consuming wcf services. when i try to call a service operation that expects a data contract as a request, it gives me a compile time error. It says that data contract can't be converted in to strin开发者_运维技巧g. I thing, I have to serialize it first. But I don't know how to do serialization or deserialization.
public partial class _Default : System.Web.UI.Page
{
Service1Client _client = new Service1Client();
protected void Page_Load(object sender, EventArgs e)
{
CompositeType _dataContract = new CompositeType();
_dataContract.BoolValue = false;
_dataContract.StringValue = "vaibhav";
TextBox1.Text=_client.GetDataUsingDataContract(_dataContract);
}
}
That last line should be something like:
_dataContract = _client.GetDataUsingDataContract(_dataContract);
TextBox1.Text = dataContract.StringValue;
If that doesn't work, post the exact error message and line number.
精彩评论