Message oriented interoperability between WCF channels and Oracle Application Server WSIF

By Jesus Rodriguez

Overview

A few weeks ago, in an SOA forum, someone inquired about which technologies to use to achieve untyped interactions with Web Services. Untyped interactions are interactions in which the Service Contract (WSDL, Policies, etc) is not available at design time. This is a classic Enterprise Service Bus (ESB) scenario in which multiple and generic interactions with Web Services are needed and in which generating specific proxies per Web Services is not a practical solution. Going back to my conversation, my response to the question was that the Windows Communication Foundation (WCF) channel model in .NET and the Web Services Invocation Framework (WSIF) in J2EE are technologies that can address those types of scenarios. Surprisingly, when somebody else asked me about .NET-J2EE interoperability references for those technologies, mainly WSIF, I could not find a good example for them to reference.

After this introduction you can guess what this post is all about. I intend to illustrate the techniques used in WSIF and WCF channels to achieve interoperable solutions.

Low-level Interoperability

From the technology standpoint both WCF channels and WSIF reside at the lowest level of the Web Service stack. In other words, this is the component in the Web Service technology responsible for sending and receiving messages from Web Services.  Contrary to WCF channels which are exclusive to WCF, WSIF is the foundation of numerous J2EE-based Web Service stacks such as Oracle Application Server, WebSphere Application Server and WSO2 (this is J2SE). WSIF is also the foundation of some integration products such as Oracle BPEL Process Manager, Oracle ESB, and WebSphere Integration Server, among others.   For the purposes of the demonstrations included on this article we are going to focus on Oracle Application Server. 

Although WCF channels and WSIF reside at the lowest level of the Web Service technology stack, they still present interoperability challenges in terms of contract design and serialization. The difference from the consumer standpoint relies on the fact that the developer has complete control of the serialization process despite having no type information available at design time. On the other hand, the consumer has to be intimately familiar with the contract of the service in order to create the proper messages.

Even though this article does not intend to deep dive into the WCF or WSIF concepts, a high level overview of the technologies is required in order to walk through the samples.

WSIF overview

WSIF provides standard interfaces to interact with Web Services using alternative protocols to the classic SOAP over HTTP approach. The protocols used can be either transport (TCP, UDP) or technology (EJB, JMS). WSIF relies on WSDL bindings in order to reference the different providers.  The following picture illustrates a high overview of the WSIF architecture

 

Figure 1: WSIF Architecture overview

As the figure illustrates WSIS implements an extensible provider model in order to abstract the different transports. A common kernel layer is responsible for determining the required provider for executing the operation based on the WSDL binding.   The SOAP provider must be used for standard Web Services interactions.   The extensible WSIF provider model is used by multiple J2EE Web Service technologies as the mechanism for supporting multi-transport and multi-binding Web Services. WCF Channels would be considered the equivalent to that model.

WCF Channels overview

WCF endpoints communication with other applications using a communication stack called the channel stack. Basically, every component of the channel stack abstracts the communication aspects of the layers below it and exposes that abstraction only to the layer above it. The lowest level in the channel stack is the transport channel which sends and receives messages using a transport protocol like TCP or UDP.

 

Figure 2: WCF Channel stack overview

The main communication unit between channels is the Message object.   Above the transport channel could be a number of protocols channels responsible for performing additional functionalities against the message object like encryption, transformation, etc.  The main components for channel interactions are Channel Factories on the client side and Channel Listeners on the Service side.   In particular, WCF channel listeners are combined with different types of channels in order to receive messages. IReplyChannel is commonly used for receiving request messages and sending back reply messages.

The following sections will illustrate how to create interactions between the WCF channel and WSIF models.

Programming with the WCF Service Channel Layer

For the purposes of this example we will use the following WCF contract which simulates a mathematical operation.

[DataContract(Name="Add", Namespace="http://tempuri.org/")]

                public class Add

                {

                        private int fparam1;

                        private int fparam2;

                        [DataMember]

                        public int param1

                        {

                                get { return fparam1; }

                                set { fparam1 = value; }

                        }

                        [DataMember]

                        public int param2

                        {

                                get { return fparam2; }

                                set { fparam2 = value; }

                        }

                }

                [DataContract(Name = "AddResponse", Namespace = "http://tempuri.org/")]

                public class AddResponse

                {

                        private int fAddResult;

                        [DataMember]

                        public int AddResult

                        {

                                get { return fAddResult; }

                                set { fAddResult = value; }

                        }

                }

The next step is to create a WCF listener that waits for a message and returns a response. In order to receive a message we are going to use an IReplyChannel instance. Also, for interoperability purposes we will bind the listener using the basicHttpBinding.

private static void OpenListener()

{

      BasicHttpBinding binding = new BasicHttpBinding();

      IChannelListener<IReplyChannel> listener =

      binding.BuildChannelListener<IReplyChannel>(new Uri(WCF Endpoint Url…), new BindingParameterCollection());

      listener.Open();

      IReplyChannel channel = listener.AcceptChannel();

      channel.Open();

    rest of the code…

}

Then we have to add the required logic to receive a message. This is accomplished by calling the ReceiveRequest method of the IReplyChannel class.

RequestContext request = channel.ReceiveRequest();

Message message = request.RequestMessage;

Add data = message.GetBody<Add>(); 

After that, we are ready to build and send the response message.   We will use the Reply operation of the IReplyChannel class.

      AddResponse result = new AddResponse();

      result.AddResult = data.param1 + data.param2;

      Message replymessage = Message.CreateMessage(message.Version, "http://tempuri.org/", result);

    //Send the response…

    request.Reply(replymessage);

  

Finally, we must release the resources allocated to the messages, channels and listeners.

message.Close();

request.Close();

channel.Close();

listener.Close();

This is basically all the logic we need to put in place to create a WCF channel listener that implements a request-response message exchange pattern. Now, we will create a WSIF client that interacts with the WCF channel.

Creating an Oracle App Server client using WSIF

WISF relies heavily on WSDL descriptions for its interaction with the service side. For that reason, we have to create a WSDL that contains the required type of information to interact with the WCF channel. An important difference from the classic “proxy” approach is that in this scenario the WSDL is interpreted at runtime and no type information is required at design time.

The first step is to create the WSIF client artifacts required to interact with the WCF listener. We are going to accomplish that using the service, operation and port classes available in WSIF.

            WSIFServiceFactory factory=  WSIFServiceFactory.newInstance();

            WSIFService service= factory.getService(WCF Service WSDL URL…, null, null, "http://tempuri.org/", "IMyService");

            WSIFPort port= service.getPort("BasicHttpBinding_IMyService");

            WSIFOperation operation = port.createOperation("Add");

The next step is to create the messages required to interact with the WCF listener.

            WSIFMessage input = operation.createInputMessage();

            WSIFMessage output = operation.createOutputMessage();

            WSIFMessage fault = operation.createFaultMessage();

Next, we must add the logic for populating the request message.  Given that our WCF Service uses document-literal encoding, we will build the message using the SOAPElement class instead rather than the XML-RPC classes.

                SOAPFactory msgFactory= SOAPFactory.newInstance();

                SOAPElement opElement= msgFactory.createElement("Add", "ns0", "http://tempuri.org/");

                SOAPElement param1Element= msgFactory.createElement("param1", "ns0", "http://tempuri.org/");

                SOAPElement param2Element= msgFactory.createElement("param2", "ns0", "http://tempuri.org/");

                param1Element.addTextNode("11");

                  param2Element.addTextNode("12");

               opElement.addChildElement(param1Element);

               opElement.addChildElement(param2Element);

                //Set the message part…

                input.setObjectPart("parameters", opElement);

Finally, we need to send the message and receive the response. For a request-response interaction we use the executeRequestResponseOperation method of the WSIFOperation class.

           operation.executeRequestResponseOperation(input, output, fault);

            SOAPBodyElement result= (SOAPBodyElement)output.getObjectPart("parameters");

The following SOAP message is produced by the WSIF client.

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">

        <To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://192.168.1.207:8081/MathWCF/Service.svc</To>

        <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IMyService/Add</Action>

    </s:Header>

    <env:Body>

        <ns0:Add xmlns:ns0="http://tempuri.org/">

            <ns0:param1>11</ns0:param1>

            <ns0:param2>12</ns0:param2>

        </ns0:Add>

    </env:Body>

</env:Envelope>

  

After the WCF listener code executes, the following SOAP message is produced.

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">

    <s:Header>

        <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/</Action>

    </s:Header>

    <s:Body>

        <AddResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org/">

            <AddResult>23</AddResult>

        </AddResponse>

    </s:Body>

</s:Envelope>

Where are we?

This article has illustrated how to achieve interoperability between WCF channels and the WSIF implementation in Oracle Application Server. Both technologies allow creating interactions with Web Services with no type information required at design time. WCF Channels and WSIF represent key components of the messaging layer for WCF and Oracle App Server Web Services. Achieving interoperability between those technologies opens the door for a lot of complex messaging scenarios.

Published Tuesday, April 10, 2007 10:02 PM by gsusx

Comments

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

<a href= bestpre.com ></a>

Tuesday, December 2, 2008 12:19 PM by Asina

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

<a href= spiritez.com ></a>

Friday, December 5, 2008 7:29 PM by Semil

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

Here are some of the latest valid <b>Godaddy promo codes</b>. I just used OK9 today to renew some domains and it worked awesome.

<b>OK7</b> - 10% Discount on any order

<b>OK8</b> - 20% Off $50 or More

<b>OK9</b> - 30% off Domain Renewals or New domain registration.

**Special Godaddy Code Expires 08/31/2009.

Go Daddy Promo Code <b>OK25</b> Save 25% on all Hosting plans or any order of $91 or more.

Friday, August 28, 2009 5:39 AM by Urinoucounc

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

I just book marked your blog on Digg and StumbleUpon.I enjoy reading your commentaries.

Sunday, October 31, 2010 7:08 PM by used 1988 suzuki samurai soft tops

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

You certainly deserve a round of applause for your post and more specifically, your blog in general. Very high quality material

Saturday, November 20, 2010 5:31 PM by IrrerceGeld

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

I just book marked your blog on Digg and StumbleUpon.I enjoy reading your commentaries.

Friday, December 24, 2010 11:04 AM by adwarefecro

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

I find myself coming to your blog more and more often to the point where my visits are almost daily now!

Monday, January 24, 2011 4:46 PM by eluchelereeva

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

I’ve been visiting your blog for a while now and I always find a gem in your new posts.  Thanks for sharing.

Sunday, February 6, 2011 5:36 PM by Poummadaurn

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

I just book marked your blog on Digg and StumbleUpon.I enjoy reading your commentaries.

Sunday, February 20, 2011 2:30 AM by audi s6

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

I’ve been visiting your blog for a while now and I always find a gem in your new posts.  Thanks for sharing.

Sunday, February 27, 2011 5:22 PM by anirwayjady

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

You certainly deserve a round of applause for your post and more specifically, your blog in general. Very high quality material

Sunday, March 6, 2011 3:31 AM by fouradarams

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

Very informative post. Thanks for taking the time to share your view with us.

Tuesday, March 22, 2011 6:24 PM by TerreFappaply

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

Message oriented interoperability between wcf channels and oracle application server wsif.. Corking :)

Saturday, May 21, 2011 6:49 AM by weblogs.asp.net

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

You certainly have some agreeable opinions and views. Your blog provides a fresh look at the subject.

Wednesday, October 26, 2011 2:39 PM by Sample Wedding Invitations

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

Very informative post. Thanks for taking the time to share your view with us.

Thursday, October 27, 2011 10:05 AM by How To Improve Credit Score

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

Hi there, i read your blog from time to time and i own a similar one and i was just curious if you get a lot of spam feedback? If so how do you stop it, any plugin or anything you can recommend? I get so much lately it's driving me insane so any help is very much appreciated.

Wednesday, December 14, 2011 4:10 AM by Pozycjonowanie

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

This it the important the you. That various or worse of to. is because Fertility these warts people.

Thursday, March 1, 2012 11:41 AM by buy bystolic online

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

qlCRaW I loved your blog.Thanks Again. Keep writing.

Thursday, April 5, 2012 7:46 PM by Request for Proposal

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

6VSgGX Say, you got a nice article.Much thanks again. Much obliged.

Saturday, April 14, 2012 2:06 PM by notebook review

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

This is one awesome blog article.Much thanks again. Great.

Monday, May 7, 2012 11:44 AM by serivce

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

确实文档上是如此说的。The following Oracle reeasels are supported:• Oracle 10g Release 2 (Oracle 10.2.0.1.0 or above)• Oracle 10g Release 1 (Oracle 10.1.0.5.0 or above)• Oracle 9i Release 2 (Oracle 9.2.0.8.0 or above)其实对于已经决心采用TT的应用来说,升级到9.2.0.8也不是什么大事儿了,呵呵。

Tuesday, May 8, 2012 7:49 PM by Teodora

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

thats a loonoog list. i think u dont need to know all of that it wont hurt if u do. but it would take a loonoog time and would be hard to keep upto date with all. of them. Also its good if you pick an alegence between Miscrosoft and Open source. if its microsoft you'll be doing ASP, sql server C#, WPF or open source it would be php, oracle, java. you need to learn basic web designing so u need html, cssdont bother about vb script and c ++. they are kinda outdated. pick one programming language and master it. i recommend c#  +3Was this answer helpful?

Friday, May 11, 2012 8:34 PM by Andy

# re: Message oriented interoperability between WCF channels and Oracle Application Server WSIF

SA8RVS Thanks again for the blog post.Much thanks again. Fantastic.

Monday, October 22, 2012 12:07 AM by cheap seo services