WCF Interview Questions and Answers Part 10

1. Can we call soap services from client browser?
Ans. No we cannot call soap services from client browser.
For that we have built in tool called "WCF Test Client".


2. Is wsHttpBinding is Soap service or Rest service?
Ans. It is Soap service.

3. What are the WebMessageBodyStyles avaible in wcf?
Ans. There are 4 types of bodystyles,
1. Bare
2. Wrapped
3. WrappedRequest
4. WrappedResponse


4. Tell some disadvantages of passing parameters via url in wcf?
Ans. When parameters are passed through URL there are chances of:
1.Data lost.
2.Security issue.


5. How will the response object parent node name is formed in wcf ?
Ans. The response object will be return with a wrapper and the parent node for response object
will be name of method + Result.


Example :  If method name is "TestMethod" then response object will be "TestMethodResult".


6. How to Return a wrapped response object with some specific parent node in wcf?
Ans. To return a response object wrapped with some specific name
we need to add the following line on operation contract.
"[return: MessageParameter(Name = "TargetItem")]"


Example :

[return: MessageParameter(Name = "StudentItem")] 
[WebInvoke(BodyStyle=WebMessageBodyStyle.Wrapped)]    
public StudentItem Create(int sid,string sname)

  return new StudentItem { Rno = sid, Name = sname };         
}      

Output:

{"StudentItem":{                          
 "Rno":123456,                                        
 "Name":"abcd"    
}}






Subscribe

Receive Quality Tutorials Straight in your Inbox by submitting your Email below:

Delivered by FeedBurner

Protected by Copyscape Duplicate Content Checker