Interoperability between WCF and Oracle Application Server : Part I


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, 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;

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 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"?>





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

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



                    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" />






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




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




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





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.

Up Next
    Ebook Download
    View all
    View all