Blue Theme Orange Theme Green Theme Red Theme
 
Nevron Gauge for SharePoint
Home | Forums | Videos | Photos | Blogs | Beginners | Advertise with Us
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
6 Months Free & No Setup Fees ASP.NET Hosting!
Search :       Advanced Search »
Home » Web Services » Interoperability between WCF and Oracle Application Server

Interoperability between WCF and Oracle Application Server

This article is to illustrate techniques and architecture that address the situation of one service running in WCF and a client consuming this service.

Author Rank :
Page Views : 4107
Downloads : 0
Rating :
 Rate it
Level : Advanced
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
 
Team Foundation Server Hosting
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 

Summary

This article is part of series intended to show how to use Web Services related technologies to interoperate applications running in different platforms, in this case, the most common scenario between Microsoft.NET and Oracle AS platforms.

Creating the Oracle Web Service.


This section describes how to install Oracle JDeveloper, create of simple Web Service, and deploy it to Oracle AS. Our target Web Service exposed the functionality of Financial System developed using Oracle technologies.

The section contains the following topics:

  1. Installing Oracle JDeveloper, starting Oracle AS and creating a connection.
  2. Defining the interface of the service and creating the Web Service.
  3. Deployment and running of the Web Service.    

Installing Oracle JDeveloper, starting the Oracle AS and creating a connection.

You need to download the installation of Oracle JDeveloper from http://www.oracle.com/tools/jdev_home.html, next unzip the downloaded file into a location in your host, and finally run the jdeveloper.exe executable file.

Starting Oracle AS is pretty simple. Just go to $(JDEVELOPER_HOME)\jdev\bin and run the batch file start_oc4j.bat. The first time you're asked for an administrator's password (oc4jadmin username), please write a suitable password.

To create a connection to Oracle AS, select Connection Navigation from the View main menu in JDeveloper. Right click Application Server. Select New Application Server Connection , and click Next and enter the suitable information in each dialog box, for example the administrator's password.

Defining the interface of the service and creating the Web Service.

You must create an application and a project to begin. Select File -> New from the main menu. Enter a name in Application Name and place to store the application in Directory Name, and next click OK. Now in the Create Project windows, enter a name for the project in Project Name, and finally click OK.

The interface defines the operations exposed by the Web Service. In our case, the service allows doing credit and debit operations. In the File ->New, select Java Class, in the Create Java Class windows, enter the name of the class for example MyFinancialService, and the package.

The MyFinancialService class implements the debit and credit operations  as shown in the following figure.

package mywebservicemodule;

public
class MyFinancialServer

{

    public MyFinancialServer()

    {

 

    }

 

    public int Debit(int nAccout, int nAmount)

    {

        //Call the Financial System debit operation

    }

 

    public int Credit(int nAccount, int nAmount)

    {

        //Call the Financial System debit operation

    }

} 

In the Application Navigator, right click the MyFinancialService.java class, and select Create J2EE Web Service, click OK, in the Web Service creation wizard, enter a Web Service name such as FinancialWS, and finish. Now we have the Web Service.

Deployment and running of the Web Service.

In the Application Navigator, find the WebService.deploy component, right click and select Deploy to and finally select the created connection to Oracle AS. The Web Service is also running, If you want to see the Web Service, go to the following address http://localhost:8888/em/ . You can find the address of the Web Service.

Consuming the Oracle Web Service.

This section describes how to consume the Web Service using Windows Communication Foundation.

This section contains the following topics:

  1. Creating the proxy and calling the Web Service.
  2. Running the application.

Creating the proxy and calling the Web Service.

Select File -> New -> Project from the main menu in Visual Studio.NET. In the New Project window, enter a project name such as WSFinancialClient, and directory to store it. Using the Command Prompt windows go to the directory where the WSFinancialClient project is, and call the following command:

svcutil http://servicehost:8888/myWebService-MyWebServiceModule-context-root/FinancialWSSoapHttpPort?wsdl

This command creates the proxy using the Service Metadata (WSDL document) publish in the URL http://servicehost:8888/myWebService-MyWebServiceModule-context-root/FinancialWSSoapHttpPort?wsdl and an associated configuration file.

The configuration file has all the information that WCF needs to access the Web Service such as address, binding and contract as shown below in the following figure.

The Application Configuration File.

<?xml version="1.0" encoding="utf-8"?>

<configuration>

      <system.serviceModel>

            <bindings>

                  <basicHttpBinding>

                        <binding name="FinancialWSSoapHttp" closeTimeout="00:01:00" 

                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"

                    allowCookies="falsebypassProxyOnLocal="false"

                    hostNameComparisonMode="StrongWildcard"

                    maxBufferSize="65536" maxBufferPoolSize="524288"

                    maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-

                    8" transferMode="Buffered" useDefaultWebProxy="true">

                              <readerQuotas maxDepth="32" maxStringContentLength="8192" 

                               maxArrayLength="16384" maxBytesPerRead="4096" 

                               maxNameTableCharCount="16384" />

                              <security mode="None">

                                    <transport clientCredentialType="None"

                                     proxyCredentialType="Nonerealm="" />

                                    <message clientCredentialType="UserName"

                                     algorithmSuite="Default" />

                              </security>

                        </binding>

                  </basicHttpBinding>

            </bindings>

            <client>

                  <endpoint address="http://servicehost:8888/myWebService-MyWebServiceModule-

                                     context-root/FinancialWSSoapHttpPort"

                   binding="basicHttpBinding"

                   bindingConfiguration="FinancialWSSoapHttp"

                   contract="FinancialWS" name="FinancialWSSoapHttpPort" />

            </client>

      </system.serviceModel>

</configuration> 

And finally, we have the code where the proxy invokes the Web Service. The proxy is hosted in a Console Application.

The main application code.

using System;

using System.Collections.Generic;

using System.Text;

 

namespace WSFinancialClient

{

    class Program

    {

        static void Main(string[] args)

        {

            FinancialWSClient objProxy = new FinancialWSClient();

            int nResult=objProxy.Debit(1, 1);

 

            System.Console.WriteLine("The operation result is {0}",nResult);

        }

    }

}

Conclusions

This article explained the techniques used to implement the Web Service interoperability scenario between WCF and Oracle Application Server. Specifically, it covered how to invoke an Oracle Application Server Web Service from WCF. The second part of this article will address this scenario where a client application developed using Oracle technologies invokes a WCF Web Service.

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
 [Top] Rate this article
 
 About the author
 
Author
Looking for C# Consulting?
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!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
Team Foundation Server Hosting
Become a Sponsor
 Comments
6 Months Free & No Setup Fees ASP.NET Hosting!
 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.