The Artima Developer Community
Sponsored Link

.NET Buzz Forum
The Web services empire strikes back - Contract-first with .NET 'IDL'

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Christian Weyer

Posts: 616
Nickname: cweyer
Registered: Sep, 2003

Christian Weyer is an independent Microsoft MSDN Regional Director and expert for Web services.
The Web services empire strikes back - Contract-first with .NET 'IDL' Posted: Sep 14, 2004 3:30 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Christian Weyer.
Original Post: The Web services empire strikes back - Contract-first with .NET 'IDL'
Feed Title: Christian Weyer: Web Services & .NET
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/cweyer/Rss.aspx
Feed Description: Philosophizing about and criticizing the brave new world ...
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Christian Weyer
Latest Posts From Christian Weyer: Web Services & .NET

Advertisement

Part 1: The Web services empire strikes back - Introductory thoughts
Part 2: The Web services empire strikes back - Inner Workings
Part 3: The Web services empire strikes back - Web Services in Visual Studio 2005
Part 4: The Web services empire strikes back - WS-I BP Conformance
Part 5: The Web services empire strikes back - Custom XML Serialization
Part 6: The Web services empire strikes back - Proxy Type Sharing

Clemens thinks 'IDL' is good and often enough to hammer down your services interface and message contract - well somehow, yes.
But we do not have to wait for Indigo, just some few months for Whidbey. T
hings really get better with ASMX v2 in Whidbey.

The following description assumes that you already have an exisiting WSDL (or a bunch of them) and then generate code from it. But the process can also be turned around: First code your interface in .NET and voila... you have the code-based contract-first approach rather than the schema-based one with XSD and WSDL.

ASMX v2 will generate a different interface for each binding in a WSDL description. E.g.:

[WebServiceBinding(Name="OrderBinding", Namespace="urn:...")]
public interface IOrderEntry
{
      [WebMethod]
      [SoapDocumentMethod(...)]
      string PlaceOrder(Order order);

      [WebMethod]
      [SoapDocumentMethod(...)]
      string UpdateOrder(Order order);

}

Each interface has the WebServiceBindingAttribute with the binding's name and namespace. At runtime, ASMX reflects over the interfaces that a user's class implements to find all WebServiceBinding and WebMethod attributes. A class that implements an interface which has the WebServiceBindingAttribute can't itself have any Web services or XML serialization attributes. Makes sense but is very important!
Obviously, a class can implement multiple interfaces each corresponding to a different WSDL binding, but a given binding cannot be split across multiple interfaces.
If an interface inherits from another interface, at most one of the interfaces can have the WebServiceBindingAttribute. This is analogous to WSDL not allowing portType inheritance.
The generated interface has the same name as the binding name and is prefixed with 'I' to indicate "Interface". Multiple bindings can be passed to the code generation process (e.g. with wsdl.exe) in one or more WSDL files. Each binding will then yield a different interface.

And as already stated at the beginning of this article: Just use this approach reversely and you are all set to design your contract-first Web services in 'IDL'.

Read: The Web services empire strikes back - Contract-first with .NET 'IDL'

Topic: Convert.ToInt32(5.5) != (int)5.5 Previous Topic   Next Topic Topic: Color me Bloglines

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use