我的ServiceContract中有以下OperationContract:
[WebInvoke(Method="POST", UriTemplate="books")]
[OperationContract]
void AddBookToInventory(BookTitle aBook);
BookTitle是一个DataContract对象:
[DataContract(Namespace="http://someurl.com/books")]
public class BookTitle
{
string title = "";
string author = "";
string isbn = "";
decimal price = 0.00m;
[DataMember]
public string Title
{
get { return title; }
set { title = value; }
}
[DataMember]
public string Author
{
get { return author; }
set { author = value; }
}
[DataMember]
public string Isbn
{
get { return isbn; }
set { isbn = value; }
}
[DataMember]
public decimal Price
{
get { return price; }
set { price = value; }
}
}
如何在c#或vb中使用来自.NET客户端的XML调用AddBookToInventory操作?