You are developing an application to update a users social status. You need to consume
the service using Windows Communication Foundation (WCF). The client configuration is
as follows. <system.serviceModel> <bindings> <webHttpBinding> <binding
name=”SocialConfig”> <security mode=”TransportCredentialOnly”> <transport
clientCredentialType=”Basic” realm=”Social API” /> </security> </binding>
</webHttpBinding> </bindings> <client> <endpoint address= ” http:// contoso .com “
binding=”webHttpBinding” bindingConfiguration=”SocialConfig” ontract=”ISocialStatus”
name=”SocialClient” /> </client> </system.serviceModel> The service contract is defined as
follows. <ServiceContract()> Public Interface ISocialStatus <OperationContract()>
<WebInvoke(UriTemplate:=”/statuses/update.xml?status={text}”)> Sub UpdateStatus(ByVal
text As String) End Interface Which code segment should you use to update the social
status?
A.
Using factory As ChannelFactory(Of ISocialStatus) = New WebChannelFactory(Of
ISocialStatus)(GetType(ISocialStatus)) factory.Credentials.UserName.UserName =
user.Name factory.Credentials.UserName.Password = user.Password Dim socialChannel
As ISocialStatus = factory.CreateChannel() socialChannel.UpdateStatus(newStatus) End
Using
B.
Using factory As ChannelFactory(Of ISocialStatus) = New ChannelFactory(Of
ISocialStatus)(“POST”) factory.Credentials.Windows.ClientCredential.UserName =
user.Name factory.Credentials.Windows.ClientCredential.SecurePassword.SetAt( 0,
user.Password) Dim socialChannel As ISocialStatus = factory.CreateChannel()
socialChannel.UpdateStatus(newStatus) End Using
C.
Using factory As WebChannelFactory(Of ISocialStatus) = New WebChannelFactory(Of
ISocialStatus)(“SocialClient”) factory.Credentials.UserName.UserName = user.Name
factory.Credentials.UserName.Password = user.Password Dim socialChannel As
ISocialStatus = factory.CreateChannel() socialChannel.UpdateStatus(newStatus) End
Using
D.
Using factory As WebChannelFactory(Of ISocialStatus) = New WebChannelFactory(Of
ISocialStatus)(GetType(ISocialClient))
factory.Credentials.Windows.ClientCredential.UserName = user.Name
factory.Credentials.Windows.ClientCredential.SecurePassword.SetAt( 0, user.Password)
Dim socialChannel As ISocialStatus = factory.CreateChannel()
socialChannel.UpdateStatus(newStatus) End Using
Explanation: