Web Services InteroperabilityWritten by Senthil Krishnamurthy from Aspire System (India) Pvt. Ltd.
Interoperability is one of main promises of Web services. Web services are designed to be independent of underlying operating system and programming language. In this article we will address some basic web services interoperability issues that are useful for developers. We will focus on two most popular platforms - Java and Microsoft C#. Introduction More and more we're finding that WSDL lies at heart of Web services interoperability. WSDL is description language for Web services. Usually a WSDL document is automatically generated by Web services framework tools (e.g., Axis, WASP WSDLCompiler) from code written in a particular programming language. Developers can use WSDL document to generate client-side stubs or proxies, which provide convenient access to Web services. Thus key to enabling seamless Web services interoperability is ability of one Web services framework to consume WSDL documents generated by other frameworks. The WSDL interoperability effort is just taking off. You can see further details at http://soap.systinet.net/interop/wsdl/index.html. How to not get trapped The following subchapters give you some basic tips on how to write interoperable Web services using today's Web services frameworks. These tips may significantly ease your life as well as lives of other developers who will use your Web services. Hopefully some of those tips will be outdated soon. Keep your types simple - avoid advanced XML Schema constructs The XML Schema standard is very complex and difficult to implement. Moreover, XML Schema processing is quite time consuming, so many frameworks sacrifice full XML Schema support for performance. Some advanced XML Schema constructs (e.g., choice) are quite hard to express in a programming language, and few Web services frameworks support them. So key success factor in Web services interoperability is to use basic data types, such as primitive data types, arrays, and structures. As a best practice, decompose complex types in your interfaces into simple and clean interfaces with basic data types. Also avoid using specific techniques (e.g. INOUT parameter passing) that aren't widely supported. Sample Architecture Let we see architecture of my sample application which uses web services along with messaging concepts. Here 3 web services are used. Two web services, Place Order and Get Order are developed and deployed in Java environment and another one, Send Message is in C# environment. The Ordering System calls Place Order web service to place an item to order. The Place Order web service stores that item and notifies Java Expeditor Client through JMS. After intimation message has come from JMS Java Expeditor Client calls Get Order web service to retrieve ordered items and details. The same Place Order web service calls another web service, Send Message to send message to MSMQ, then Notification message is sent to C# Expeditor Client from MSMQ. After intimation message has come from MSMQ, C# Expeditor Client calls Get Order web service to retrieve ordered items and details. Here functionality of Java Expeditor and C# Expeditor Client are same except that they are developed in different platform to illustrate interoperability of web services. So here its proved that web service Get Order, which is developed and deployed in Java environment is accessed from C# Expeditor client and web service Send Message, which is developed and deployed in C# environment is accessed from Place Order web service of Java environment. Accessing Java Web Service from C# To invoke Get Order web service in C# Expeditor Client application, we are going to Add Web Reference to Get Order web service. The steps to be followed to do this are, 1. In Project menu, click Add Web Reference…
| | Serialize this - Saving Objects in PHPWritten by Kevin Davies
When building my website "Crossword Heaven" I came across a problem. I created a PHP object called "crossword" but needed to save information in object to a database. Now considering that this object contained a lot of information this was not an easy thing to do. Or was it?The answer: serialize(). What serialize() function does is take something like an array or object and converts it into a string that can be stored in a database. All I had to do so that I could save crossword object is something like "serialize($crossword)." Easy! Some words of warning though. If you're using a version of PHP less than version 4 watch out because only properties get saved, not methods. Here's a peek at actual code: $data = addslashes(serialize($crossword)); $name=""; if(isset($xwordInfo['xword_name'])){ $name = $xwordInfo['xword_name']; } $today = date('Y-m-d H-i-s'); $sql = "INSERT INTO `xword` ( `xword_id` , `xword_obj` , `xword_name`, `xword_owner`, `xword_width`, `xword_height`,`xword_date`) VALUES ('', '" . $data . "', '$name', '$owner', '$width', '$height', '$today');"; And here's SQL to create table 'xword': CREATE TABLE `xword` ( `xword_id` int(11) NOT NULL auto_increment, `xword_obj` blob NOT NULL, `xword_name` varchar(100) NOT NULL default '', `xword_owner` varchar(100) NOT NULL default '', `xword_width` int(11) NOT NULL default '0', `xword_height` int(11) NOT NULL default '0', `xword_date` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`xword_id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ;
|