You need to modify the application to allow the GetServiceTime method to return the data formatted as JSON

A class named TestService implements the following interface. TestService is hosted in an
ASP.NET applicator. You need to modify the application to allow the GetServiceTime
method to return the data formatted as JSON. It must do this only when the request URL
ends in lServiceTime. What should you do?

A class named TestService implements the following interface. TestService is hosted in an
ASP.NET applicator. You need to modify the application to allow the GetServiceTime
method to return the data formatted as JSON. It must do this only when the request URL
ends in lServiceTime. What should you do?

A.
Add this attribute to the GetServiceTime method <Webinvoke(Method PGETw,
UrTemplate:eiSeneiceTim&, ResponseFormat: WebMessageFormatJson)> In the bconfIg
file, configure TestService in the system.arviceModeI/services collection as follows.
<senvice namee”TestService”> <endpoint ad&esse”ISer,iceTime”r contracte”TestSence’
bindingewebHttpBindngw /> c/service>

B.
Add this attribute to the GetServiceTime method <webGet( ResponseFormat

WebMessageFormatJson, UnTemplate:eJServiceTime”)>? Create a new svc file named
Jsonversion svc with the following contract <%@ ServiceHost Servicee”TessService”i
Factory=”System ServiceModelktivation WebServiceHosFactory” %s

C.
Add this attribute to the GetServiceTime method <webinvoke(Method “POST)> In the
bconfig file, add this element to systemserviceModeI/behaviors/endpointBehaviors.
<behavior names”Json”>e <enableWebScript c/behavior> In the web.config file, configure
TestService in the system.serviceModel/services collection as follows. <service
name”TestService”>s <endpoint address/ServiceTime” contract-”TestSerAce””
behaviorConlfgurationz’Json bindinge”webHttpBinding”!> <!services

D.
Add this attribute to the GetServiceTime method <WebGet(UriTempbte:
z”{Json}/ServiceTime”)> Create a new svc file named Jsonversionsvc with the following
contert <%@ ServiceHost Service=”TestSenvice” Factoryz’System Se
viceMode[ktivationWebServiceHodFactory” %>



Leave a Reply 0

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