Which code segment should you use?

You are consuming a Windows Communication Foundation (WCF) service in an ASP.NET Web application. The service interface is defined as follows.
<ServiceContract()>
Public Interface ICatalog
<OperationContract()>
<WebGet(UriTemplate:=”/Catalog/Items/{id}”, ResponseFormat:=WebMessageFormat.Json)>
Function RetrieveItemDescription(ByVal id As Integer) As String
End Interface
The service is hosted at /Catalog.svc. You need to call the service using jQuery to retrieve the description of an item as indicated by a variable named itemId. Which code segment should you use?

You are consuming a Windows Communication Foundation (WCF) service in an ASP.NET Web application. The service interface is defined as follows.
<ServiceContract()>
Public Interface ICatalog
<OperationContract()>
<WebGet(UriTemplate:=”/Catalog/Items/{id}”, ResponseFormat:=WebMessageFormat.Json)>
Function RetrieveItemDescription(ByVal id As Integer) As String
End Interface
The service is hosted at /Catalog.svc. You need to call the service using jQuery to retrieve the description of an item as indicated by a variable named itemId. Which code segment should you use?

A.
$.get(String.format(“/Catalog.svc/Catalog/Items/?id={0}”, itemId) null, function (data) { … }, “javascript”)?

B.
$.get(String.format(“/Catalog.svc/Catalog/Items/{0}”, itemId), null, function (data) { … }, “json”)?

C.
$.get(String.format(“/Catalog.svc/Catalog/Items/{0}”, itemId), null, function (data) { … }, “xml”)?

D.
$.get(String.format(“/Catalog.svc/Catalog/Items/id={0}”, itemId), null, function (data) { … }, “json”)?



Leave a Reply 0

Your email address will not be published. Required fields are marked *