Interoperability Using Synchronous Web Services


Web services are abstract entities that are defined by a document called a Web Services Description Language (WSDL), which is an XML document that defines the location and method signature for a Web service. With a WSDL, it is possible to generate or write code that can call these services based on their described characteristics. The call methodology is also standardized on a protocol called Simple Object Access Protocol (SOAP). The underlying technology used to create the Web service doesn't matterthe interface is standard. By definition, the client posts a SOAP document to the service to call the methods. This provides a number of interoperability benefits. One doesn't need to care about the technologies, simply about the services themselves. As the services are all defined based on commonly agreed-on standards, it should be simple to interoperate with them.

There are a number of drawbacks with this methodnamely performance. As Web services are not real-time or close to it, the virtualization introduces a significant overhead. In addition to this, the implementation of the standards by different technology vendors isn't identical and can lead to problems passing data between services that have been implemented in different technologies. These are discussed throughout this bookand solutions are offered.

Web services (called XML Web Services by Microsoft) are front and center in the .NET Framework. They are considered a critical interoperability technology that allows for business connectivity.

One of the benefits of this attitude is that Microsoft has made it very simple to create Web services with their Visual Studio.NET IDE. It offers a Wizard that allows the user to create a simple "Hello World" Web service that configures ASP.NET and IIS to run it and automatically generates the WSDL for that Web service at compile time. The source code for a simple Web service in C# looks like this:

public class Service1 : System.Web.Services.WebService {     [WebMethod]     public string HelloWorld()     {         return "Hello World";     } } 


To implement a Web service the developer would simply create a class that is derived from System.Web.Services.WebService. If he or she attributes methods of this class with the [WebMethod] attribute, the compiler generates the appropriate WSDL to define this method to external callers.

Creation of Web service clients is also very straightforward. The framework has a tool: wsdl.exe that takes the WSDL of the Web service and creates a proxy class (in either C# or VB.NET) that can be used to call the Web service.

Using it is very straightforwardto generate a C# proxy, one simply provides it with the URL of the WSDL document:

wsdl http://servername/serviceroot/service.asmx?WSDL


This proxy class can then be used within managed code to marshal communication with the Web service.




Java EE and. Net Interoperability(c) Integration Strategies, Patterns, and Best Practices
Java EE and .NET Interoperability: Integration Strategies, Patterns, and Best Practices
ISBN: 0131472232
EAN: 2147483647
Year: N/A
Pages: 170

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net