News:

SQL Table To C# Entity Model ConverterEntity Model (Class Properties) to SQL Table ConverterIf you encounter any trouble visiting our site, please contact us.

MCPD- Exam 70-513: Windows Communication Foundation Development with Microsoft .NET Framework 4

01 [ServiceContract]
02 [ServiceBehavior(includeExceptionDetailsInFaults = true)
03 public class OrderService
04 {
05 [Operation Contract]
06 public void Submit Order(Order anOrder)
07 {
08 try
09 {
10 ...
11 }
12 catch(DivideByZeroExcepton ex)
13 {
14
15 }
16 }
17 }

You need to ensure that the stack trace details of the exception ae not included in the error information sent to the client. What should you do?

  1. Replace line 14 with the following line.

    throw:
  2. Replace line 14 with the following line

    throw new FaultException<Order>(anOrder, ex.ToString());
  3. After line 05, add the following line.

    [FaultContract(typeof(FaultException<Order>))]

    Replace line 14 with the following line

    throw ex;
  4. Alter line 05, add the following line

    [FaultContract(typeof(FaultException<Order>))]

    Replace line 14 with the following line.

    throw new FaultException<Order>(anOrder, "Divide by zero exception");
Answer: Answer is d

public class Calculator
{
public int Add(int x, nty)
{
}
}

Which code segment should you use?

  1. [ServiceContract(Namespace="Arithmetic")]
    public class Calculator
    {
    [Operation Contract(Action="Sum")]
    public int Add(int x, int y)
    {}
    }
  2. [ServiceContract(ConfigurationName="Arithmetic")]
    public class Calculator
    {
    [Operation Contract(Action="Sum")]
    public int Add(int x, int y)
    {}
    }
  3. [ServiceContract(Name="Arithmetic")]
    public class Calculator
    {
    [OperationContract(Name="Sum")]
    public int Add(int x, lnt y)
    {}
    }
  4. [ServiceContract(Name="Arithmetic")]
    public class Calculator
    {
    [OperationContract(ReplyAction="Sum")]
    public int Add(int x, int y)
    {}
    }
Answer: Answer is c

  1. lCommunicationObject
  2. lExtension <T>

  3. lExtensibleObject <T>
  4. lExtensibleDataObject
Answer: Answer is a, d

  1. Add the Known Type attribute to the data contract. Set a default value in each of the data member declarations.

  2. Add the Known Type attribute to the data contract. Set the Order property of each data member to unique integer value.

  3. Set the Emit Default Value property of each data member to false.

  4. Set the lsRequired property of each data member to true.

Answer: Answer is d

[DataContract]
public class Person
{
[DataMember]
public string firstName;
[DataMember]
public string lastName;
[DataMember]
public int age;
[DataMember]
public int ID;
}

You need to ensure that the following XML segment is generated when the data contract is serialized.

<Person>
<firstName xsi:nil="true"/>
<lastName xsi:nil="true"/>
<lD>999999999 <ID>
</Person>

Which code segment should you use?

  1. [DataMember|
    public string firstName;
    [DataMember]
    public string lastName;
    [DataMember(EmitDefaultValue=true)]
    public int age = 0;
    [DataMember(EmitDefaultvalue=true")]
    public int ID = 999999999;
  2. [DataMember(EmitDefaultvalue false)]
    public string firstName = null;
    [DataMember(EmitDefaultValue = false)]
    public string lastName = null;
    [DataMember(EmitDefaultValue = true)]
    public int age = -1;
    [DataMember(EmitDefaultValue false)]
    public int ID = 999999999;
  3. [DataMember(EmitDefaultValue=true)]
    public string firstName;
    [DataMember(EmitDefaultValue=true)]
    public string IastName;
    [DataMember(EmitDefaultValue=false)]
    public int age = -1;
    [DataMember(EmitDefaultValue=false)]
    public int ID = 999999999
  4. [DataMember]
    public string firstName = null;
    [DataMember]
    public string lastName = null;
    [DataMember(EmitDefaultValue=false)]
    public int age = 0;
    [DataMember(EmitDefaultValue=false)]
    public int ID = 999999999;
Answer: Answer is d

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope">
<s:Header>
<h:StoreId xmlns:h="http://www.contoso.com">6495</h:StoreId>
</s:Header>
<s:Body>
<CheckStockRequest xmlns="http://www.contoso.com">
<ItemId>2469<ItemId>
</CheckStockRequest>
</s: Body>
</s:Envelope>

You need to create a message contract that generates the SOAP envelope.Which code segment should you use?

  1. [MessageContract(WrapperName="http://www.contoso.com")]
    public class CheckStockRequest
    {
    [MessageHeader(Namespace="http://www.contoso.com")]
    public int Storeld{get; set.}
    [MessageBodyMember(Namespace="http://www.contoso.com")]
    public int Itemld{get set;)
    }
  2. [MessageContract(WrapperNamespace="http://www.contoso.com")]
    public class CheckStockRequest
    {
    [MessageHeader(Namespace="http://www.contoso.com")]
    public int Storeld{get; set;}
    [MessageBodyMember(Namespace="http://www contoso.com")]
    public int ltemld{get; set;}
    }
  3. [MessageContract(WrapperNamespace="http://www.contoso.com")]
    public class CheckStockRequest
    {
    [MessageHeader(Namespace="http://www.contoso.com")]
    public int Storeld {get; set;}
    public int ltemld {get; set;}
    }
  4. [MessageContract(WrapperNamespace="http://www.contoso.com")]
    public class CheckStockRequest
    {
    [MessageHeader(Namespace="http://www.contoso.com")]
    public int Storeld {get; set;}
    [MessageBodyMember]
    public int ItemId(get; set;}
    }
Answer: Answer is b

[OperationContract]
void PostData(Order data);

You need to modify PostData so that it can receive any SOAP message. Which code segment should you use?

  1. [OperationContract(IsOneWay=true, Action="v", ReplyAction="-"]
    void PostData(Order data);
  2. (OperationContract(IsOneWay=true, Action="v", ReplyAction = ".")]
    add PostData(BodyWriter data);
  3. [OperationContract]
    void PostData(BodyWriter data);
  4. [OperationContract]
    void PostData(Message data);
Answer: Answer is d

[ServiceContract]
public interface ITestService
{
[OperationContract]
DateTime GetServiceTime();
}

TestService is hosted in an ASP.NET application. 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 /ServiceTime. What should you do?

  1. Add this attribute to the GetServiceTime method.

    [Weblnvoke(Method="POST")]

    In the web.config file, add this element to system.serviceModel/behaviors/endpointBehaviors.

    <behavior name="Json">
    <enableWebScript />
    </behavior>

    In the web.config file, configure TestService in the system.serviceModel/services collection as follows:

    <service name="TestService">
    <endpoint address="/ServiceTime"
    contract="TestService"
    behaviorConfiguration="Json"
    binding="webHttpBinding" />
    </service>
  2. Add this attribute to the GetServiceTime method.

    [Weblnvoke(Method="GET',  UriTemplate="/ServiceTime",ResponseFormat=WebMessageFormat.Json)]

    In the web.config file, configure TestService in the system.serviceModel/services collection as follows:

    <service name="TestService">
    <endpoint address="/ServiceTime"
    contract="TestService"
    binding="webHttpBinding"/>
    </service>
  3. Add this attribute to the GetServiceTime method

    [WebGet(ResponseFormat=WebMessageFormat.Json, UriTemplatee"/ServiceTime")]

    Create a new svc file named Jsonversion.svc with the following content.

    <%ServiceHost Service="TestService" Factory="System.ServiceModel.ActivationWebServiceHostFactory" %>
  4. Add this attribute to the GetServiceTime method.

    [WebGet(UriTemplate="Json)/ServiceTime")]

    Create a new .svc file named Jsonversion.svc with the following content

    <%ServiceHost Service="TestService" Factory="System.ServiceModel.ActivationWebServiceHostFactory" %>
Answer: Answer is c

void DeleteItems(string id);

You need to configure WCF to call this method when the client calls the service with the HTTP DELETE operation. What should you do?

  1. Add the Weblnvoke(UriTemplate="/Items/id", Method="DELETE") attribute to the operation

  2. Add the HttpDelete atribute to the operation

  3. Replace the string parameter with a RemovedActivityAction parameter

  4. Replace the return type with RemovedActivityAction.

Answer: Answer is a

[ServiceContract]
public interface IService
{
[OperationContract]
string Operation1 (string s);
}

 You need to ensure that the operation contract Operation1 responds to HTTP POST requests. Which code segment should you use?

  1. [OperationContract]
    [WebInvoke(Method="POST")]
    string Operation1(string s);
  2. [OperationContract]
    [WebGet(UriTemplate="POST")]
    string Operation1 (string s);
    
  3. [OperationContract(ReplyAction="POST")]
    string Operation1 (string s);
  4. [OperationContract(Action="POST")]
    string Operation1(string s);
Answer: Answer is a

Advertisement

BCS Preparation now even more easy. ReadBD is the place where you can find all kind of resources to be successful in BCS,Bank,Islami Bank exam and interview.

Looking for job. Try JobLoader- First ever job search engine in Bangladesh. All open bd jobs now a single mouse click away.

;