December 2006 - Posts

As expected here are some predictions (not in order) for 2007:

o   OASIS finally approves WS-ReliableMessaging and we don’t hear about WS-Reliability anymore.

o   The rise of Semantic Web: We should see more vendors supporting RDF, SPARQL, etc and consequently more developers changing the way Web sites exposes data.

o   SaaS adoption keeps growing: We should expect to see more and more classic enterprise applications moving to SaaS models.

o   .NET 3.0 established itself as a foundation for other Microsoft products: You can argue that’s already true but we should see more products leveraging .NET 3.0 (particularly WCF, WF and Card Space). Among others BizTalk R2, Speech Server 2007, MIIS 3.5 already announced the use of .NET 3.0

o   SCA-JBI becomes an alternative to classic J2EE: Fortunately will be a clear fragmentation between the classic J2EE model (EJB, JMS, JNDI, etc) and the new series of SOA-based Standards (JBI, SCA, etc)

o   WS-* are finally implemented for Ruby On Rails, PHP and Python: WS-Addressing and WS-Security will be the first ones as always.

o   SOA Governance becomes real: Together with the rise of IT Web Services solutions. IT departments will start investing on SOA Governance Frameworks

o   The rise of resource-oriented services: I think we should stop thinking of resource-oriented services as just REST and start implementing more serious alternatives like WS-ResourceTransfer, WS-Resource Framework, RDF,  etc.

o   More Domain Specific Languages for vertical markets: Arguably some of the most notable DSLs have been applied to horizontal solutions (WSBPEL, XAML, WSCI, etc). I expect to see more architects designing DSLs to address Standard problems for vertical industries.

o   Two Connect opens 6 new consulting practices: This one is important enough for me to be on this list.

 

Posted by gsusx | with no comments
Filed under:

W3C just published the Web Services Policy assertion for authors. This document intends to provide some guidance for architects working with "Web Services Policy 1.5 - Framework" and "Web Services Policy 1.5 - Attachment" specifications to create domain specific assertions.

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

By Jesus Rodriguez 

This article is part of a series intended to illustrate WS-* protocols interoperability scenarios between Windows Communication Foundation (WCF) and different J2EE Web Services platforms. Particularly this article focus on MTOM interoperability between WCF and Oracle Application Server v10.1.3.

Binary data exchange using MTOM is a unique Web Services interoperability case given the specific problems that it tackles.  Other WS-* protocols presents a broader set of options allowing one to achieve different levels of interoperability. MTOM on the other hand is an exclusive scenario; services can either be or not be optimized with MTOM, but there is no intermediate level. This is why bidirectional MTOM interoperability between technologies is so important.

The first part of this article illustrated a MTOM interoperability scenario between a WCF client and an Oracle App Server Web Service.  The following section presents a complementary scenario using an Oracle App Server client and a WCF Service.

Implementation: Building a WCF Service that uses MTOM

The following code shows a WCF service that returns the contents of a file as a binary array.

[ServiceContract()]

    public interface IFileService

    {

        [OperationContract()]

        byte[] GetImg(string path);

    }

    public class FileService : IFileService

    {

        public byte[] GetImg(string path)

        {

            return File.ReadAllBytes(path);

        }

    }

To optimize the message exchange for this service using MTOM we need to configure the MTOM Encoding Binding element as part of the customBinding. In addition, to guarantee interoperability with Oracle App Server, the service should be configured to use Soap 1.2.

          <system.serviceModel>

                    <services>

                             <service name="wcfService.FileService" behaviorConfiguration="returnFaults">

                                      <host>

                                                <baseAddresses>

                                                          <add baseAddress="service address…"/>

                                                </baseAddresses>

                                      </host>

                                      <endpoint contract="wcfService.IFileService" binding="customBinding" bindingConfiguration="ProviderBinding" address="wcfmtomws"/>

                             </service>

                   </services>

                   <bindings>

                             <customBinding>

                                      <binding name="ProviderBinding">

                                                <mtomMessageEncoding  messageVersion="Soap12" />

                                                <httpTransport manualAddressing="false" maxBufferPoolSize="524288"

                        maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"

                        bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

                        keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"

                        realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"

                        useDefaultWebProxy="true" />

                                      </binding>

                             </customBinding>

                   </bindings>

                   <behaviors>

                             <serviceBehaviors>

                                      <behavior name="returnFaults" >

                                                <serviceMetadata httpGetEnabled="true" />

                                                <serviceDebug includeExceptionDetailInFaults="true" />

                                      </behavior>

                             </serviceBehaviors>

                   </behaviors>

          </system.serviceModel>

Implementation: Building an Oracle App Server client that uses MTOM

As we explained in the first part of this article, Oracle Application Server supports MTOM as part of its 10.1.3.1 release. The first step to create an MTOM client for the WCF service created on the previous section is to generate the proxy using the Web Service Proxy Wizard included in JDeveloper or the corresponding command-line tool. In order to interface with WCF using MTOM, the client code should set the MTOM_SUPPORT property to “True” either programmatically or using the configuration file. The following code shows a sample client that interacts with the WCF service created in the previous section.

    public static void CallWS()

    {

    try

    {

        wsprj.proxy.WSHttpBinding_IFileServiceClient binding = new wsprj.proxy.WSHttpBinding_IFileServiceClient();

        IFileService proxy= binding.getPort();

        ((OracleStub)proxy)._setProperty(ClientConstants.MTOM_SUPPORT, true);

         byte[] result= binding.getImg(file path…);

         System.out.println(result.length);

    }

    catch(Exception ex){}

    }

Running this client will produce the following SOAP request and response messages. As you might notice, the response message is optimized using MTOM.

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://tempuri.org/"><env:Body><ns0:GetImg><ns0:path>c:\temp\test2.file</ns0:path></ns0:GetImg></env:Body></env:Envelope>

SOAP request produced by the Oracle client

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body><GetImgResponse xmlns="http://tempuri.org/"><GetImgResult><xop:Include href="cid:http%3A%2F%2Ftempuri.org%2F1%2F633013057872812500" xmlns:xop="http://www.w3.org/2004/08/xop/include"/></GetImgResult></GetImgResponse></s:Body></s:Envelope>

SOAP response produced by the WCF service

Where are we?

MTOM provides a standard and an optimized mechanism to represent binary data in a SOAP envelope. The two parts of this article explained how to achieve MTOM interoperability between Microsoft WCF and Oracle Application Server. The first part explored an interoperability scenario using a WCF client and an Oracle App Server Web Service. This second part has complemented that scenario using a WCF Service with an Oracle App Server client.

By Jesus Rodriguez

This article is part of a series intended to illustrate WS-* protocols interoperability scenarios between Windows Communication Foundation (WCF) and different J2EE Web Services platforms. Particularly this article focus on MTOM interoperability between WCF and Oracle Application Server v10.1.3.1.

Optimizing XML data transmission: The need for interoperability

The use of XML vs. binary data has been the eternal argument since the early days of XML-RPC and the subsequent SOAP specifications. In some scenarios, XML data formats can add significant overhead compared with the processing of binary data.  This is cause for concern with many architects. However, the use of XML has made vendors agree for first time in a series of protocols and standards for data transmission.

To assume that binary messages are always smaller than XML messages is overlooking one of the most complex challenges in data transmission today. However, binary data is present in a significant percent of data exchange scenarios.

From the Web Services viewpoint, the standards to encode binary data as part of SOAP messages had been evolving for a few years now. However at every step of that evolution, the implementation of interoperable Web Services that can exchange binary data across multiple platforms had raised as an interesting and difficult challenge for developers. Finally, after WS-Attachments and DIME, MTOM has gained acceptance among the different vendors as the main protocol to represent optimized binary data in a SOAP envelope.

MTOM

MTOM, the acronym that identifies the unpronounceable Message Transmission Optimization Mechanism, enables you to send binary data as part of a SOAP message in an efficient and optimized manner.  The classic solution for embedding  binary data in a XML document is to use a base64 encoded representation. Although, the based64 format presents severe limitations in regards to optimizing a binary representation. These limitations are primarily due to the use of 6 out of every 8 bits to encode a base64 character. That factor alone represents a 4:3 extra encoding overhead plus the addition of extra characters. The result is a significant increase in the size of a base64 encoded string.

MTOM avoids this overhead, attaching the binary data to the XML file in the original format without any extra encoding. MTOM relies on the XML Optimized Processing (XOP) Standard as the serialization mechanism to represent binary data as a MIME/Multipart Related package. For more information about MTOM you should read this great post by John Evdemon.

Despite of the fact that MTOM is W3C Standard; the need for interoperable implementations is key for MTOM to become a widely adopted protocol. During the last year different vendors had provided MTOM implementations as part of their Web Services platforms making MTOM interoperability a need and a challenge for the industry. This is even more significant when dealing with Web Services interoperability between.NET and J2EE, given that both platforms have followed different evolution paths.

The following sections are intended to illustrate an interoperability scenario using Oracle App Server and Windows Communication Foundation (WCF).

MTOM and WCF

MTOM is supported in WCF as part of the encoder model. An encoder implements a set of basics rules to represent the message on the wire. Encoders exist at both the client and the service side and are typically configured using encoding binding elements.

Oracle App Server and MTOM

With the recent release of the Application Server 10.1.3.1, Oracle adds supports for MTOM in addition to the existent MIME and DIME attachments. MTOM is now supported at both the client and the service side, only however, using SOAP 1.2.

The following sections illustrate how to build an Oracle Web Service and a WCF client that exchange binary messages optimized using MTOM

Using MTOM in Oracle App Server

As the center of our example lets use the following Web Service that returns a byte[] representing a binary file.

public class FileTransmitter {

    public FileTransmitter() {

    }

    public byte[] GetImg(String path)

      {

          try {

                  ReadableByteChannel channel = new FileInputStream(path).getChannel();

                  ByteBuffer buf = ByteBuffer.allocateDirect(12000);

                  byte[] result= new byte[12000];

                  int numRead = 0;

                  while (numRead >= 0) {

                      buf.rewind();

                      numRead = channel.read(buf);

                      buf.rewind();

                      for (int i=0; i<numRead; i++) {

                          byte b = buf.get();

                          result[i]= b;

                      }

                    

                  }

                  return result;

              }

              catch (Exception e)

              {

                return null;

              }

      }

}

Without using MTOM the response of this Web Service looks like the following.

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://wsprj/types/"><env:Body><ns0:GetImgResponseElement><ns0:result>a2V5dG9vbCAtZ2Vua2

V5IC1hbGlhcyB0ZXN0IC1rZXlhbGcgIlJTQSIgLXNpZ2F

sZyAiU0hBMXdpdGhSU0EiIC1kbmFtZSAiQ049dGVzdCwgQz1VUyIgLWtleXBhc3MgdGVzdDEyMyA

ta2V5c3RvcmUgdGVzdC5qa3MgLXN0b3JlcGFzcyB0ZXN0MTIzDQoNCmtle

XRvb2wgLWNlcnRyZXEgLWFsaWFzIHRlc3QgLXQxMjMAAAAAAAAA ... binary file</ns0:result></ns0:GetImgResponseElement></env:Body></env:Envelope>

As you can see the entire file is serialized as a base64 string and embedded into the SOAP message.

In order to configure MTOM at the service side is necessary to set the mtom-support setting to true in the web services configuration file.

<oracle-webservices xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/oracle-webservices-10_0.xsd">

    <webservice-description name="OraMtomWS">

        <port-component name="OraMtomWSSoap12HttpPort">

        <mtom-support>true</mtom-support>

            <operations>

                <operation name="GetImg" input="{http://wsprj/types/}GetImgElement"/>

            </operations>

        </port-component>

    </webservice-description>

</oracle-webservices>

With those two simple steps the Web Service is ready to deploy to the Oracle Application Server.

Building the WCF client

The first step to create a WCF client is to generate the proxy using the SvcUtil tool. The following code is a sample client that invokes the Oracle Web Service.

static void Main(string[] args)

        {

            GetImgClient();

        }

        private static void GetImgClient()

        {

            OraMtomWSClient proxy = new OraMtomWSClient();

                byte[] result = proxy.GetImg("c:\\temp\\test2.file");

                Console.ReadLine();

         }

In order to achieve interoperability with Oracle App Server, the WCF client needs to encode the messages using SOAP 1.2 and MTOM. The following code illustrates the client configuration file.

<configuration>

          <system.serviceModel>

                   <bindings>

                             <customBinding>

                                      <binding name="OraMtomWSSoap12Http">

                                                <mtomMessageEncoding  messageVersion="Soap12" />

                                                <httpTransport manualAddressing="false" maxBufferPoolSize="524288"

                        maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"

                        bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

                        keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"

                        realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"

                        useDefaultWebProxy="true" />

                                      </binding>

                             </customBinding>

                   </bindings>

                   <client>

                             <endpoint address="http://server/WSInterop-WSPrj-context-root/OraMtomWSSoap12HttpPort"

                binding="customBinding" bindingConfiguration="OraMtomWSSoap12Http"

                contract="OraMtomWS" name="OraMtomWSSoap12HttpPort" />

                   </client>

          </system.serviceModel>

</configuration>

The above settings configure the server to receive MTOM messages using SOAP 1.2. Executing the client produces the following messages on the wire.

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body><GetImgElement xmlns="http://wsprj/types/"><path>file path…</path></GetImgElement></s:Body></s:Envelope>

Figure SOAP request produced by the WCF client

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

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://wsprj/types/"><env:Body><ns0:GetImgResponseElement><ns0:result>

<xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:7cfa880ad11d4faa90eadbc06de797c5"/></ns0:result></ns0:GetImgResponseElement>

</env:Body></env:Envelope>

Figure SOAP response produced by the Oracle Web Service

As you can see there is notable size difference between this response and the message produced when MTOM is not used. Regardless of the size factor, containing the message in its original binary format makes the MTOM message optimal when processing the binary data.

Where are we?

MTOM provides a standard and optimized mechanism to represent binary data in a SOAP envelope. This article explained the required steps create a Windows Communication Foundation client that can achieve MTOM interoperability with an Oracle Application Server web Service.  The second part of this article will complement this scenario demonstrating interoperability between Oracle client and a Windows Communication Foundation service.

In the last few weeks I’ve received a few questions from readers regarding the .NET Adapter Framework 3.0 and its relationship with BizTalk and WCF. I think the main argument is weather WCF presents a strong channel model on its own to cover the functionalities that the adapter framework provides.

WCF provides a solid and extensible channel model to handle messaging-related operations like (WS-* protocols, multi-transport, etc). Is a fact that extending the WCF channel model we can implement interactions with LOB applications. However that doesn’t mean WCF itself presents a framework oriented to model those types of interactions. This is precisely the role of the .NET 3.0 adapter framework. It extends WCF channel model with a set of operations that are common for interactions with LOB applications like: Connection Management, Metadata Management, Metadata Search, Metadata Browsing, etc.

Bottom line the .NET 3.0 Adapter Framework should be seen as a complement to the WCF channel model with LOB interaction components; not as a 100% replacement of the existing BizTalk Adapter Framework.

On future posts I will cover the relations/differences between the .NET 3.0 Adapter Framework and the BizTalk Adapter Framework.

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

I am happy to see this progress:

The Web Services Interoperability Organization (WS-I) announced the publication of three new Working Group Drafts: the Basic Profile 1.2, Basic Security Profile 1.1 and the Reliable Secure Profile 1.0 Usage Scenarios. Advancement of these documents to Working Group Draft status is an invitation to the Web services community to provide technical feedback.

Posted by gsusx | with no comments

On this post Dare summarized an interesting discussion about REST and Message Security

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

Based on some request from customers we decided to make available a version of the SalesForce.com adapter for BizTalk Server 2004. The trial edition is currently available at AdapterWorx. Also we will be announcing our first Adapter built on the new R2 Adapter Framework very soon.  If you have access to the R2 bits (TAP Program, BizTalk MVPs, Microsoft employees, etc) and you are interested in testing this new adapter please drop me a line at jrodriguez@twoconnect.com

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