Cyberiafreak

"Fortunate are those who take the first steps.” ― Paulo Coelho

What is SOAPExtension? When to extend and Why?

SoapExtension allows you to alter the SOAP messages sent to and from a Web service or a Web service client. For instance, if you want to implement an encryption or compression algorithm to run with an existing Web service.. then you need to extend.

To implement-derive a class from the SoapExtension class.
1) ChainStream, a virtual method 2) GetInitializer, an abstract method with two signatures
3) Initialize, an abstract method 4) ProcessMessage, an abstract method

Read about WebService Life Cycle from MSDN.

When and why?
1) You may run into situation where you need to compress and decompress on your way – then you need this extension.
2) You may need to get the content length / packet size for your webrequest and webresponse, then you need this extension. Coz, when you compress your request and get you response in compressed format.. you wont be getting the content length for your response. You have to serialize to stream and then get the length out of the stream.
Do you think any other situation?

Advertisements

April 26, 2012 Posted by | Uncategorized | Leave a comment

Designing Custom Exceptions

There are so many articles in Web regarding this, but I had a doubt on Serializable attribute on few CustomException in my project. Here is the crux – If you are seriously thinking of passing your exception across remoting boundaries using web service or across AppDomain… then it makes sense to decorate your custom exception with ‘serializable’ attribute- else keep it simple 🙂
Read it from here – http://msdn.microsoft.com/en-us/library/ms229064.aspx

April 17, 2012 Posted by | Uncategorized | Leave a comment

   

%d bloggers like this: