April 2007 - Posts

Two news for the SOA Standards land:

·         The World Wide Web Consortium today released four SOAP 1.2 Second Editions as W3C Recommendations: Part 0: Primer, Part 1: Messaging Framework, Part 2: Adjuncts, and Specification Assertions and Test Collection. SOAP Version 1.2 provides the definition of the XML-based information that can be used for exchanging structured and typed information between peers in a decentralized, distributed environment

·         OASIS, the international standards consortium, today announced that its members have approved Web Services Context (WS-Context) version 1.0 as an OASIS Standard, a status that signifies the highest level of ratification. WS-Context defines an open framework for supporting coordinated and transactional compositions of multiple Web services applications.

Posted by gsusx | 1 comment(s)
Filed under: , ,

Check out Clemens Vasters and Stephen Forte comments about BizTalk Services.

Posted by gsusx | with no comments
Filed under: ,

The upcoming BizTalk Server R2 extends heavily the messaging capabilities of BizTalk Server.  Together with the rich messaging engine the WCF adapters and the WCF Line of Business Adapters SDK opens a whole new set of possibilities for developers. However, there is still some overlapping between the messaging features of BizTalk and WCF that developers must understand in order to apply the correct technology to a particular scenario. One of the most interesting scenarios with these characteristics is the interaction with MSMQ for achieving asynchronous and persistent messaging. Since the 2004 release BizTalk Server includes a MSMQ adapter for addressing this type of interaction. Now, with the WCF adapters included in R2 it is possible to use the WCF-NetMsmq and the WCF-Custom adapters for achieving similar scenarios. The question then becomes when to use one option versus the other.

The main difference between two approaches relies on the fact that the MSMQ adapter should be considered for pure MSMQ interaction whereas the WCF adapters should be used for Service Oriented interactions in which MSMQ is used as the persistent mechanism. I tried to put together a simple list that highlights some of these differences.

·         Contract-based interfaces: The use of the WCF-NetMsmq adapter makes the Service, Data and Message contracts available to the client at design time. In the case of the MSMQ adapter the clients does not have any type information at design time.

·         SOAP based messaging: The WCF-NetMsmq adapter uses SOAP as the encoding mechanism.

·         Message based security: The use of the WCF-NetMsmq adapter allows the use of WS-* security protocols for encrypting and signing parts of the SOAP message.

·         Other WS-* protocols: Although MSMQ natively addresses some aspects, such as persistent, transactionality and reliability, some WS-* protocols can be used with the WCF-NetMsmq adapter as a complement to MSMQ native features.

·         Session based messaging: WCF introduces the concept of a session as a mechanism to group a set of related messages together for processing by a single receiving application. This feature can be leveraged natively by the WCF-NetMsmq adapter.  

·         Batched messaging: (Do not confuse this with BizTalk batching): Similarly to Session based messaging, the WCF-NetMsmq adapter can take advantage of the TransactedBatchingBehavior WCF behavior to group unrelated messages in a single batch.

·         Poison message handling: WCF, and consequently the WCF-NetMsmq adapter, provides a rich set of options for handling poison messages after a message has exceeded the maximum number of delivery attempts to the application

Posted by gsusx | 4 comment(s)
Filed under: ,

Last August I was invited, with a few other Architects, to a .NET 3.5 Design Review hosted by the Connected Systems Division. That was the first time I saw the prototype of some “services” that the Connected Systems Division is working as part of a Software as a Service initiative. Today, the first CTP of “BizTalk Services” was officially released with two services “BizTalk Identity Service” and “BizTalk Connectivity Service”. Future releases plan to include the “BizTalk ServiceBus Services” and “BizTalk Workflow Services”

Posted by gsusx | with no comments
Filed under: ,

One of the major challenges in Real World SOA enterprise applications is the lack of semantic information associated with Service Contracts. For a while now the W3C folks have been working in different efforts for relating semantic web Standards (RDF, SPARK, etc) with Web Service basic standards (SOAP, WSDL, etc). One of those efforts Semantic annotations for WSDL and XML Schema has been announced as a W3C working draft.

Posted by gsusx | with no comments
Filed under: ,

My friend John Evdemon has been writing about the different components of a SOA Reference model. Check the first two posts here and here. Both articles emphasize in the idea of a SOA model based on capabilities that can evolve independently throughout the system lifetime.

Posted by gsusx | 4 comment(s)
Filed under: ,
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.

Last January 31th my good friends Javier and Carmen Mariscal were blessed with the birth of their second son, Daniel Mariscal. After two months, the baby got his first exposure to the Microsoft world.

DO NOT make any assumptions about the finger; he is too young for that.

 

Posted by gsusx | 3 comment(s)
Filed under:

BEA WebLogic 10 has been released. I am particularly impressed with the enhancements to the Web Services stack which includes:

-WS-Security 1.1
-WS-Secure Conversations
-SAML Token Profile
-Binary (MTOM) web service message attachments (for images or other binary data)
-10.0 Service Control now works with 8.1 Web services including callbacks  

Posted by gsusx | 1 comment(s)

Some good news in a middle of a crazy weekend for me.

I am really happy to announce that Microsoft awarded me as a BizTalk Server MVP for third consecutive year. I am really looking forward this year for doing as much contributions as I can to the developer community.

Posted by gsusx | with no comments
Filed under:
More Posts