我的 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 操作?