11.07.2015 Views

y - Net Developer

y - Net Developer

y - Net Developer

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 11 ■ WORKING WITH DATA 355ramrameshreddy.blog.comThe only time a message type can inherit from another type is when the base type also has amessage contract. Also when inheriting, the message headers are a collection of all the headersin the inheritance hierarchy. Similarly, all the body parts are also consolidated in the inheritancehierarchy and are ordered first by the Order property specified in the [MessageBodyMember]attribute (if any) and then alphabetically. If the same name for either the header or the body partis repeated in the inheritance hierarchy, then the member that is lowest in the hierarchy is usedto store the information.■Note If required, the WCF runtime allows you to use your own serializer by inheriting theXmlObjectSerializer class and overriding the WriteStartObject, WriteObjectContent, andWriteEndObject members.You also need to consider the legacy XML support. If there is a requirement by your serviceto produce WSDL for interop scenarios, you need to treat this with care. WSDL and messagecontract support is tricky because WSDL supports only a subset of the message contract features.As a result, when generating WSDL, all the features from a message contract will not getreflected because of the lack of this support. You should consider these points when workingwith WSDL:• WSDL does not have the notion of an array of headers and will show only one header asopposed to the array.• Similar to the previous point, protection-level information is not fully supported andmay be missing.• The class name of the message contract type will be the message type generated in theWSDL.• If many operations in a service contract use the same message contract across thoseoperations, then the WSDL that is generated for that service contract will contain multiplemessage types even though at the end of the day they are the same type. Thesemultiple messages are made unique in the WSDL by appending a numeral at the endsuch as 2, 3, and so on. As a result, the message types created when importing such aWSDL are identical except for their names.SecurityYou have three options to make a message secure when using message contracts. Dependingon which of the three options you choose, different parts of a SOAP message are digitallysigned and encrypted. The options you have are to secure the entire SOAP message, to secureonly the header of the SOAP message, or to secure only the body of the SOAP message (that is,the payload). To enable the option you choose, set the ProtectionLevel property on either the[MessageHeader] attribute or the [MessageBodyMember] attribute. Although for each header theprotection level is determined individually, the body’s security level is determined collectivelywith the highest level being applied across all body parts. For these security options to work,ramrameshreddyramrameshreddy

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!