Web Services in BEA Web Logic and Microsoft.NET

Web Services in BEA Web Logic and Microsoft.NET

By: John Charles (Juan Carlos) Olamendy Turruellas.


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();
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

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}",

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.


Author: Gaurav Aroraa18 Mar 2009 Member Level: Gold   Points : 1

Good work..

Author: Sumit Pyne28 Aug 2012 Member Level: Silver   Points : 0


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?

  • 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: