|
|
|
|
|
|
|
Author Rank :
|
|
|
Page Views :
|
2942
|
|
Downloads :
|
0
|
|
Rating :
|
Rate it
|
|
Level :
|
Beginner
|
|
Web Services are logic units that allow programs written in different programming languages and on different platforms and technologies to communicate through standard Internet protocols. Web services are a useful way to provide data to an array of consumers over the Internet, like stock quotes and weather reports. But they take on a new power in the enterprise, where they offer a flexible solution for integrating distributed systems, whether legacy systems or new technology.
Web Services are invoked using SOAP messages. SOAP, which is defined using XML, is an emerging standard for transmitting messages across the Internet. SOAP facilitates application-to-application interoperation between multiple processing points. SOAP messages contain header information about the communication channel and a body containing the business-oriented content. SOAP messages are often sent within the body of some transport protocol such as HTTP, SMTP or TCP.
There are a lot of standards and technologies associated to Web Services Stack:
-
WSDL is an XML-based grammar used to define a contract provided by the Web Service. It is used the XML Schema Definition (XSD) standard to describe message structure and data types, WSDL provides a means to describe the basic format of a Web Service request message or invocation and the format of a subsequent response message from the Web Service. The WSDL file gives the developer of a Web Service consuming application all of the information necessary to achieve this programmatic access to another system—that is, to invoke a Web Service.
-
The WSDL gives self-description aspect to the Web Services.
-
The UDDI specification provides directories and descriptions of Web Services so that interested parties can locate these services and interact with them. Specifically, the UDDI standard defines a way to provide a universal database or registry of Web Services and links to their associated WSDL files. A Web Service consumer can use a UDDI registry, whether it be a public registry, or an intranet-based private registry, to discover and reference a Web Service provider.
There are standards and specifications that all major software vendors-including Microsoft, IBM, Oracle, BEA Systems, and many others-have agreed upon. So a Web Service endpoint running on Microsoft.NET could be invoked by another application running on, for example, J2EE, and vice versa.
Nowadays there are a lot of applications within an enterprise. When you model and implement a business process, sometimes you need to integrate some platforms, protocols, portals, database systems, ERP, even to connect an external organization. One way is to use Web Service a mechanisms to provide Internet-Standards service interfaces, these protocols may pass by the corporate router, and use some middleware application, for example an Enterprise Service Bus, for coordinating all the messaging between the services.
So, there might be some level of interoperability in Web Service. Thus one Web Service written in one platform may be consumed by other Web Service or application client written in a totally different platform. In a response to this kind of problem, it is created the WS-I organization to promote Web Services Interoperability across platforms, operating systems and programming languages. Microsof, BEA, IBM and others belong to this important organization.
In this article, I will explain how one Web Service built using BEA Web Logic may be called by a client application written in Microsoft.NET.
The service interface for the Web Service is very simple. It receives a Customer object and create a Purchase order for this customer using some of its properties.
package MyWebServicesPackage;
import CustomerPackage .*; import OrderPackage.*;
/** * @common:target-namespace namespace=http://www.olamendy.com/MyFirstWS */
public class MyFirstWS implements com.bea.jws.WebService {
static final long serialVersionUID = 1L; /** * @common:operation */ public Order CreateCustomerOrder(Customer objCustomer) {
Order objOrder=new Order(); objOrder.Id=objCustomer.Id; objOrder.Description=objCustomer.Description; objOrder.Customer=objCustomer.FullName; return objOrder;
}
}
Listing 1.
You can see about in Listing 1, the implementation of the Web Service interface which is in the package MyWebServicePackage. A Web Service may have a lot of attributes associated to it and to its context (principles of Aspect-Oriented Programming) in this listing, I use the most simple aspect for describing it such as the Web Service namespace and the specification of CreateCustomerOrder as a Web Operation, and I can accomplish this one using Java Annotation.
package CustomerPackage;
public class Customer {
public int Id; public String FullName; public String Description;
}
Listing 2.
package OrderPackage;
public class Order {
public int Id; public String Description; public String Customer;
}
Listing 3.
You can see the logic implementation of the entities Customer and Order in the above listings. All the state of such objects is serialized in XML and send in a wire between the service and the customer.
Right now I will create a client application using Microsoft.NET to consumes the services of the former Web Services. In File->New->Solution create a Windows project. To add a reference to the Web Service in the Solution Explorer right-click in Web References and click Add Web Reference, then a nice wizard appears and you can enter the url to the definition of the Web Services such as http://localhost:7001/WebServiceFirstWeb/MyWebServicesPackage/MyFirstWS.jws Then all the proxies for accessing to the Web Service from the client is created.
private void button1_Click(object sender, System.EventArgs e) {
Customer objCustomer=new Customer(); objCustomer.Id=System.Convert.ToInt32(this.m_tbId.Text); objCustomer.FullName=this.m_tbFullname.Text; objCustomer.Description=this.m_tbDescription.Text; Call2BEAWS.MyFirstWS.MyFirstWS ws=new Call2BEAWS.MyFirstWS.MyFirstWS(); Order objOrder=ws.CreateCustomerOrder(objCustomer); this.m_lbInformation.Text=String.Format("Id is {0} customer is {1} and description is {2}",objOrder.Id,objOrder.Customer,objOrder.Description);
}
Listing 4.
In listing 4, you can see the method logic part of the main application class for accessing the Web Services. It is created the Customer entity and the Web Services proxy. Afterwards, the Customer entity fills its properties, and the call to the Web Method of the Web Service MyFirstWs.MyFirstWS is called and the state of Customer entity is serialized in wire and the magic happens in the WebLogic Application Server. Then an XML result describing the Order entity and the proxy creates the Order entity and fills its properties.
This is a very simple example to show the interoperability in different implementation of Web Services protocol stack. Next articles will be about how proprietary aspects of one Web Service stack could interoperate with other one. How is magic inside the stuff code.
|
|
Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post
Here.
|
|
|
|
|
Login
to add your contents and source code to this article
|
|
|
|
|
|
|
|
|
|
|
|
John Charles Olamendy
He’s a senior Integration Solutions Architect and Consultant. His primary area of involvement is in Object-Oriented Analysis and Design, Database design , Enterprise Application Integration, Unified Modeling Language, Design Patterns and Software Development Process. He has knowledge and extensive experience in the development of Enterprise Applications using Microsoft.NET and J2EE technologies and standards. He is proficient with distributed systems programming; and business-process integration and messaging using the principles of the Services Oriented Architecture (SOA) and related technologies such as Microsoft BizTalk Server, Web Services (Windows Communication Foundation, WSE, BEA WebLogic, Oracle AS and Axis) through multiple implementations of loosely-coupled system. He’s a prolific blogger contributing to .NET and J2EE communities and actively writes articles on subjects relating to integration of applications, business intelligence, and enterprise applications development. He holds a Master’s degree in Business Informatics at Otto Von Guericke University, Magdeburg, Germany. He was recently awarded as MVP. He currently works in the telecommunication industry and delivers integration solutions for this industry. He harbors a true passion for the technology.
|
|
|
|
|
|
|
|
|
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional
consulting company, our consultants are well-known experts in .NET and many of them
are MVPs, authors, and trainers. We specialize in Microsoft .NET development and
utilize Agile Development and Extreme Programming practices to provide fast pace
quick turnaround results. Our software development model is a mix of Agile Development,
traditional SDLC, and Waterfall models.
|
|
Click here to learn more about C# Consulting. |
|
|
|
|
|
|
|
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon.
Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees.
As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
|
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
|
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
|
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
|
|
|
|
|
|
|
|
|
|
|
|
|