Interoperability with ASP. NET Web Services

Source: Internet
Author: User
Interoperability between ASP. net web services and Windows Communication Foundation (WCF) web services can be achieved by ensuring that services implemented using both technologies conform to the WS-I basic profile 1.1 specification. ASP. NET Web services that conform to WS-I basic profile 1.1 are interoperable with WCF clients by using WCF system-provided binding, basichttpbinding.

Use ASP. NET 2.0 option of adding the WebService and webmethodattribute butes to an interface rather than to a class, and writing a class to implement the interface, as shown in the following sample code.

Copy code
 
[WebService] public interface iecho {[webmethod] string echo (string input);} public class service: iecho {Public String echo (string input) {return input ;}}

Using this option is preferred, because the interface withWebServiceAttribute constitutes a contract for the operations specified med by the service that can be reused with varous classes that might implement that same contract in different ways.

Avoid using the soapdocumentserviceattribute attribute to have messages routed to methods based on the fully-qualified name of the Body element of the SOAP message rather thanSoapactionHTTP header. WCF usesSoapactionHTTP header for routing messages.

The XML into which xmlserializer serializes a type by default is semantically identical to the XML into which the datacontractserializer serializes a type, provided the namespace for the XML is explicitly defined. when defining a data type for use with ASP. net Web Services in anticipation of adopting WCF, do the following:

    • define the type using. NET Framework classes rather than XML Schema.

    • Add only the serializableattribute and the xmlrootattribute to the class, using the latter to explicitly define the namespace for the type. do not add additional attributes from the system. XML. serialization namespace to control how. net Framework class is to be translated into XML.

    • by adopting this approach, you should be able to later make. net classes into data contracts with the addition of the datacontractattribute and datamemberattribute without significantly altering the XML into which the classes are serialized for transmission. the types used in messages by ASP. net web services can be processed as data contracts by WCF applications, yielding, among other benefits, better performance in WCF applications.

Avoid using the authentication options provided by Internet Information Services (IIS ). WCF clients do not support them. if a service must be secured, use the options provided by WCF, because these options are robust and are based on standard protocols.

Performance impact caused by loading the servicemodel httpmodule

In the. NET Framework 3.0, the WCFHttpmoduleWas installed in the root web. config file such that every ASP. NET application was WCF enabled. This might affect performance, so you can removeServicemodelFor the Web. config file as shown in the following example.

Copy code
 
<Httpmodules> <remove name = "servicemodel"/>  
 
 
 
 
 Ref: interoperability with ASP. NET web service 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.