Subscribe to Subscribers
Talk to Webmaster Tony John

Online Members

Pawan Awasthi
More...


Resources » .NET programming » WCF/Webservices

Web Services in BEA Web Logic and Microsoft.NET


Posted Date:     Category: WCF/Webservices    
Author: Member Level: Silver    Points: 30



 


Web Services in BEA Web Logic and Microsoft.NET


By: John Charles (Juan Carlos) Olamendy Turruellas.

Introduction

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.

Developing the solution

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.

Conclusion

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.





Did you like this resource? Share it with your friends and show your love!


Responses to "Web Services in BEA Web Logic and Microsoft.NET "
Author: Gaurav Arora    18 Mar 2009Member Level: Gold   Points : 0

Hi,
Good work..











Author: Sumit Pyne    28 Aug 2012Member Level: Silver   Points : 0
Hi,

It will be very helpful if you provide a solution, if my client is not .Net application, may be it is a HTML page,then how could I consume this java web service?



Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: Creating a Web Service in Microsoft.NET and consuming from WebLogic’s Web Client
    Previous Resource: J2EE and Microsoft .NET for Enterprise Applications
    Return to Resources
    Post New Resource
    Category: WCF/Webservices


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Microsoft.NET BEA WebLogic Web Services Interoperatibility Integration Enterprise Application  .  BEA web Logic  .  Weblogic  .  Web Logic  .  BEA  .  Web Services  .  



    Follow us on Twitter: https://twitter.com/dotnetspider

    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.