Question:You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a Microsoft Windows Communication Foundation (WCF) service that exposes the following service contract:

01  [ServiceContract]
02 public interface IBlogService
03 {
04    [OperationContract]
05    [WebGet(ResponseFormat=WebMessageFormat.Xml)]
06    Rss20FeedFormatter GetBlog();
07 }
You configure the WCF service to use the WebHttpBinding class, and to be exposed at the following URL:
http://www.contoso.com/BlogService

You need to store the result of the GetBlog operation in an XmlDocument variable named xmlBlog in a Web form.
Which code segment should you use? 

A string url = @"http://www.contoso.com/BlogService/GetBlog";
XmlReader blogReader = XmlReader.Create(url);
xmlBlog.Load(blogReader); 

B string url = @"http://www.contoso.com/BlogService";
XmlReader blogReader = XmlReader.Create(url);
xmlBlog.Load(blogReader); 

C Uri blogUri = new Uri(@"http://www.contoso.com/BlogService");
ChannelFactory<IBlogService> blogFactory = new ChannelFactory<IBlogService>(blogUri);

IBlogService blogSrv = blogFactory.CreateChannel();
Rss20FeedFormatter feed = blogSrv.GetBlog();
xmlBlog.LoadXml(feed.ToString()); 

D Uri blogUri = new Uri(@"http://www.contoso.com/BlogService/GetBlog");
ChannelFactory<IBlogService> blogFactory = new ChannelFactory<IBlogService>(blogUri);

IBlogService blogSrv = blogFactory.CreateChannel();
Rss20FeedFormatter feed = blogSrv.GetBlog();
xmlBlog.LoadXml(feed.Feed.ToString()); 

+ Answer
+ Report
Total Preview: 1190

Copyright © 2024. Powered by Intellect Software Ltd