private BookInfo GetBookInfo(string isbn) { // TODO: Build a uri we can use to get book info // TODO: Create a web client and add a header for xml content // Get xml string containing book info string xmlStr = null; // Parse xml string to get book return(BookInfo.Parse(xmlStr)); }
private BookInfo GetBookInfo(string isbn) { // Build a uri we can use to get book info Uri baseUri = new Uri(Settings.Default.SvcBaseAddress); UriTemplate template = new UriTemplate("books?isbn={isbn}"); Uri boundUri = template.BindByPosition(baseUri, isbn); // Create a web client and add a header for xml content WebClient client = new WebClient(); client.Headers.Add("Content-Type", "application/xml; charset=utf-8"); // Get xml string containing book info string xmlStr = client.DownloadString(boundUri); // Parse xml string to get book return(BookInfo.Parse(xmlStr)); }