Applying The Web Services Invocation Framework
Calling Services Independent Of Protocols
Service call independent of the agreement
Paul Fremantle (pzf@uk.ibm.com) Senior Software Engineer, IBM Application and Integration MiddleWare01 Jun 2002
The Web Service Call Framework provides a web service call mode that is not related to the location of the transport protocol and service. To some extent, WSIF can be called not based on SOAP-based simple application development. Learn about the latest changes in the Apache Software Group publishing WSIF.
Introduction
The Web Service Call Framework (WFIS) is a simple Java API for calling Web services, and whether it is provided regardless of the service. It puts developers, liberates from the restraints that must serve some particular transport protocols and service environment. Therefore, it provides an API to provide independent binding to access a variety of web services. It allows no root or completely to call the web service, which is based on a technology that checks service metadata at runtime. It also allows you to be allowed to insert an upgrade task binding at runtime. If you use the WSIF provider permit, you can insert a new binding in real time. It can also choose a binding extended period calling service until it is running again. Finally, it is based on WSDL, so he can call the services described in any WSDL.
WSIF was originally released in October 2001 AlphaWorks. AlphaWorks has been downloaded more than 4,000 times since I was released. One of the WSIF's founders wrote two very good articles to describe their creation of WSIF and its use, recommend everyone to read (see Web Service Invocation Sans Soap, Part 1 and 2).
This article complies with the Apache Software Foundation for WSIF donation requirements. The WSIF source code is donated by the Apache XML project and is done in Axis Work sponsorship. You can get in the Apache CVS directory, the directory name is XML-AXIS-WSIF. The code is at http://cvs.apache.org/viewcvs.cgi/xml-axis-wsif.
In this article, I will pay attention to the Motivation, use and architecture of WSIF. Since AlphaWorks is released, WSIF is summarized, and this article also contains some experimental and future views. But before this, I will quickly return to WSDL.
Some Background On WSDL
Web Services Description Language (WSDL) has scalable from the beginning. In WSIF, the designer separates the interface and service.
One service in WSDL is clearly defined as three parts:
1. The PortType defines the abstract interface provided by the service. A porttype defines a series of operations. Each operation can be subjected to in-out, in-only, out-only, and out-in (seek). Each operation defines an input or output message. A message is defined as a series of parts, each section contains a SCHEMA definition type.
2. The Binding A binding defines how abstract porttype and a service data format and protocol are mapped. For example, SOAP binding defines the encoding mode, the namespace (target URI) of SOAP Action Header, Body, and more.
3. The Port It defines the actual location (EndPoint) where the service is located, for example, the HTTP URL available on the SOAP server. Now WSDL, each port is there, only one binding, each binding has only one porttype. Converse (more important), each service (portType) can contain multiple ports, each with a location and binding to access that service.
When we design WSIF, we will use it as a mirror of WSDL because we need WSDL-based API instead of direct SOAP. WSIF is a framework effectively supports transmission and formatting. Provider in WSIF supports SOAP.
WSDL is equipped with SOAP after WSDL, compared to SOAP, which is capable of building additional services. Typically, web services are constructed in existing applications, such as Java classes, enterprise Java Beans, or COM objects. These components are sometimes encapsulated into applications running in a particular system, such as a large machine transaction system. By extending the WSDL to describe the existing component model, we can get the inheritance relationship between the exposed SOAP-Available service and the following components, ... ... In fact, there is more use for existing components, and it has more purposes - it adds a description of the service framework for existing component models.
MotiVation for WSIF
The motivation to propose WSIF is that we want to see "architectural service" apps more extensive, not just SOAP. Now, there is a large number of different protocols, transmission and distributed computing techniques to provide more things than SOAP, especially in management, transaction security, and service quality (QoS). The reason why SOAP can be launched, mainly because of capital investment. Many companies have invested a lot of funds, such as CORBA, they certainly hoped to continue to use these technologies. On the other hand, there is a unique advantage that uses SOAP's Web services - describes and discovered architectures. Anyone can download the WSDL document from the UDDI directory or an InsPection document, and use a normal tool to generate the code to use the service, regardless of whether the service is in the local area or through the Internet. The use of scripting languages also makes other tools - such as language (XLANG and WSFL), such as some composition and design services.
We really wanted to make the extensibility and structure of WSDL real. WSDL allows us to describe existing systems using extensibility elements. For example, we have written WSDL extensions to describe transactions in CICS and IMS using connectors, calls to remote stateless session Enterprise JavaBeans, AS Well As SOAP AND NON-SOAP Messages over JMS-based Messaging Systems. However, While Describing Things IS Useful, IT ISN't As Useful As Executing Them.
Now, WSDL is more than just a description layer - it has been used in some tools, which use WSDL description to generate the reomb of the access service. So, if we add a description for non-SOAP systems, we will lose those benefits. WSIF is an insertable framework that allows the provider to insert. A Provider is a code that supports WSDL extensions and can call services through specific execution. This means that the client's code is not related to (server-side), which only relies on the porttype of the service. WSIF also supports latency binding, namely a new Provider and descriptions can be obtained at runtime, and some clients can use this new importation. Finally, WSIF allows clients to choose from Infrastructure and Runtime proxy ports, which allows users to select Implementation on the quality characteristics and business policies. The structure of the WSDL allows a web service to have multiple Implementations, and multiple ports share a porttype. In other words, WSDL allows the same port to be bound to SOAP and IIOP. We hope that our API allows the same client code to access any binding that can be obtained - if the code is written for PortType, then it should be deployed or configured (or code selection) when the port and binding are used.
We put forward the request for WSIF, it must:
1. Support Any Valid WSDL Extensions. Supports any legal WSDL extension.
2. Support Dynamic Invocation Of WSDL-Described Services. Dynamic calls for WSDL-Description Services.
3. Support an API Based ON WSDL Porttypes supports APIs based on WSDL port types.
4. Allow Late Binding to Different Formats and Transports. Allows delay in binding different data formats and transmission.
5. Support Both Compiled and Dynamic Approaches. Support compilation and dynamic approaches.
6. Support Minimum Code Deployment Scenarios (N Providers, No Per-Service Code). Supports minimum code deployment scenarios (N Provider, No Persevice Code).
7. Support Different In-Memory Representations of Service Request Data.
WSIF USAGE
There are two usage of WSIF: the model and dynamic call interface (DII) based on the stub.
Stub Model is based on the stub-based model allows users to use generic programming models to call business functions on the server. Mapping from the WSDL interface to the Java definition interface has been specified - in the JAX-RPC standard. Some people try to integrate the WSIF model with JAX-RPC through the JCP / JSR process, but WSIF is always too tested from this perspective. We can only be loose integration. JAX-RPC defines the service interface of the service definition interface (SDI) - stub. WSIF also defines an interface to use the same SDI like JAX-RPC. So, although WSIF and JAX-RPC cannot share interfaces, they share tools (for example, Axis WSDL2JAVA). Listing 1 is an example of a stub model.
1 WSIFSERVICE SQ = ServiceFactory.newinStance (). GetService ("http://my.com/svcs/stockquote.wsdl"); 2 myservice mysvcstub = sq.getstub ("soap", myservice.class; 3 mysvcstub.mymethod (); Dynamic Invocation InterfaceDII and WSDL are very similar. In WSDL, each operation has an input message and an optional output or error message. In WSIF, we divided similar levels. Basically, it is basically corresponding. In fact, our first iteration is one or one, but we summarize more logical (simple) simple. The correspondence is as shown in Table 1: Correspondency of WSDL and WSIF Entities.
Table 1: Correspondence of WSDL and WSIF Entities
WSDLWSIF (WSIL / UDDI) WSIFServiceFactory or JNDISERVICEWSIFACEPORTWSIFPORTBIND (None) OperationWSIperationMessagewsifMessagePart (no correspondence)
You need to use DII:
Select a port. Select a port Create An Operation. Create a Create and Populate the in-message. Create and assemble the input message. Execute the Operation. Execution Read The Response Data from the out-message. Read response data from the output message.
A simple example is shown in Listing 2.
1 WSIFSERVICE SQ = ServiceFactory.NewInstance (). GetService ("http://my.com/svcs/stockquote.wsdl"); 2 wsifport defport = sq.getport (); 3 wsifoperty getq = defport.createOperation ("getquote" ); 4 WSIFMessage inMessage = getQ.createInputMessage (); 5 inMessage.setStringPart ( "symbol", "IBM"); 6 ... 7 getQ.executeRequestResponse (inMessage, outMsg, fltMsg); 8 outMessage.getFloatPart ( "value" );
One of the characteristics of the AlphaWorks published in the AlphaWorks is a command line parameter tool - Dynamic Invoker, this tool can call any interface with a simple type of Web service. Our usual request is that the parameter uses a dynamic call service of complex types. WSIF is based on this ideological design, but for the first iteration, we only support the service of JavaBean components, so if you don't have a suitable JavaBean component, you will not be able to call the service. As a remedy, we have developed a series of classes called JROM (initially it supported the Java Record Object Model (JROM), which is declared by the Jay-ROM, but now it is just a name). JROM is an abstract tree structure that can represent many SCHEMA complex types in memory. JROM is a lightweight DOM, and each leaf node of its tree assembly is a basic type (unlike DOMs are strings). Dynamic calls are used to use JROM with WSIF, and even allow Java types that do not match the SCHEMA complex type in ClassPath. This is a very powerful way, especially when building a dynamic web service system, such as gateways, flow engines, and testing clients. Not all Provider supports JROM, but we joined JROM support in Apachesoap Provider.
JROM is not part of the WSIF open source project, but it can be obtained from AlphaWorks, see www.alphaworks.ibm.com/tech/JROM.
The architecture of WSIF ArchitectureWsif is based on some factory. The reason for using the factory is that this can hide the object is "static" or "dynamic". In static cases, the object is created to provide specific ports, messages or operations. Implementation can be established quickly when static. In dynamic conditions, the object uses WSDL to describe specific ports, operations, or messaging at runtime. At present, WSIF is mainly used for dynamic objects, just like we originally designed them. We divide WSIF into different dynamics.
Fully Dynamic Architecture Complete Dynamic Architecture
In the stream control engine, the stream is described as an XML document. The flow engine handles messages before sending messages to give a new service. The deployed code is a provike each binding type. Therefore, this is a B structure, B is some different WSDL binding extensions.
The Semi-Dynamic Architecture Half-Dynamic Architecture Half-binding architecture defines the message of PortType being static, but the binding itself is dynamic. This requires the code to deploy PortType, and each bind a provider. Therefore, this is a P B structure, where P is some PORTYPE, B is some WSDL bindings. When the interface changes, the compiled message must be deployed.
Static Architecture Static Architecture WSDL Binding and Port is static compilation. In this case, the default port defined in Tooling Time is compiled. The code deployment is an entity for each binding instance, so it can be considered as a P × B structure.
Changes Since The AlphaWorks Release Release The AlphaWorks Release The AlphaWorks Release. You Are Encouraged To Look At The Open Source Code Tree Yourself. The Main Changes Are:
Simplification of the WSIFMessage and WSIFPart model. We removed the WSIFPart interface and merged it into WSIFMessage. In order to capture different styles of using WSIFMessage, we added a method getRepresentationStyle (). Renaming of the PortFactory object to Service. Addition of a ServiceFactory interface . Change from using the PortTypeCompiler to using the J2SE 1.3 dynamic proxy support Addition of new bindings and transports -... SOAP over JMS, EJB binding, Apache Axis-based SOAP provider Support for tracing and logging activity Support for dynamic registration of new Providers Using The J2se Jar Service Provider Spec (See Resources) .Experimental additions to WSIF Currently WSIF has many research fields, asynchronous requests - response messages and context-aware messages are two.
Asynchronous Request-Response now has an asynchronous request-response model, which is processed in different running threads that caused by the request. To support it, the requester register a return object or handle that is called when the response arrives.
When the request message is sent, the handle object is passed to the WSIFOPERATION. WSIF provides a related service to store handles instead of providing an Identifier. WSIFOPERATION Calls WSIF-related services, this service stores the corresponding ID used by the service itself and the request handle. This has the interior of the current transaction. If the user requests a transaction queue, then these work is done in the current transaction.
WSIFOPERATION and WSIFRESPONSEHANDLE objects are serialized, so the status of the handle object can be held, even if the system error can be held even when responding and requesting is in response and requesting. The corresponding services are also insertable, while other features, such as atomic transactions, and persistence ensures high reliability.
When a delay port response, the listening thread will capture it and passed to the WSIFOPERATION used as the store. Operation includes distributing the response into a WSIFMESSAGE logic and executes the handle function executeasyncResponse (), which is parameter in Outmessage. The listening thread runs on different matters, these transactions source from the original request. The response also splits transactions and requests.
For example, Listing 3 shows how a handle comes with an implementation (IMPLEMENT) interface class WSIFRESPONSEHANDLER. This handler is used to explain the response message and the response value.
Listing 3. Implementing an asynchronous handler in wsif
1 public class QuoteHandler implements WSIFResponseHandler {2 3 protected String symbol = null; // local storage of the symbol we wanted quoted4 public void setSymbol (String value) {symbol = value}; 5 public void executeAsyncResponse (WSIFMessage out, WSIFMessage fault) { 6 // this Simplified Example Assumes No Failures and That The Symbol Has Been Set Correctly7 Float QuoteValue = OUT.GETPART ("Quote"); 8 Updatequotedb (Symbol, QuoteValue); 9} Service call such as Listing 4
Listing 4. Invoking a Service Asynchronously with WSIF
1 String symbol = "IBM"; 2 QuoteHandler quoteHandler = new QuoteHandler (); 3 quoteHandler.setSymbol (symbol); // the handler needs to know the symbol when it gets executed later.4 5 WSIFMessage inMessage; 6 WSIFOperation quoteOperation; 7 ... 8 INMESSAGE.SETXXXPART (...) // set up inMessage for Invocation9 Quoteoperation.executeasyncRequestResponse (Inmessage, Quotehandler);
Content-Aware Message Content - Reminder Message We also want to support settings and use context. W3C's Web Services Working Group also discussed this topic, but there is no specified grammar and semantics.
For example, a SOAP / HTTP port may require an HTTP username and password. This information is very special for service calls, but it is usually not part of the service parameters. In general, context is defined as a series of Name-Value pairs. However, the web service needs to define the data type using the XML Schema type. Use "Name-Value to" indicate the method of the context to replace the method of WSIFMessage - a set of named Parts, each part equivalent to one XML Schema Type instance. This is slightly more than the concept of use of the attribute, but more maintained the feature of WSDL and WSIF.
The methods setContext () and getContext () on a WSIFPort and WSIFOperation allow the application programmer or stub to pass context information to the binding The Port implementation may use this context -.. For example to update a SOAP header There is no definition of How a port may utilize the context.
The setContext () and getContext () functions on WSIFPORT and WSIFOPERATION allow the application to be bound by context information. The implementation of Port is also used in these contexts - such as upgrading a SOAP header. But how Port is not defined using the context. Ideas for the futureThere are a number of areas in WSIF we would like to see work on to improve its functionality and usefulness. First, we would like to have refactoring capabilities to separate the transport from message formatting. We have defined a WSIFFormatter class to allow Access to and conversion of the data INTO a Native Format.
Next, an abstract tree representation of the data in aa message would be useful. Currently, we mainly use compiled classes from the schema to carry the service parameters in WSIFMessage. However, in one implementation of WSIF, the Web Services Gateway (see Resources) WE Use An Abstract Tree Notation Called Jrom That Closely Maps to an XML Schema.
We would also like to see more and better providers for the many types of transports and object systems that exist. Finally, an implementation of WSIF in C or C would certainly be helpful to developers creating services in those languages.
Summary Summary WSIF is an open source-oriented framework that allows SOAP and non-SOAP services to be defined in WSDL and call with ordinary ways. WSIF defines an insertable interface (provider interface) to support new transfer and protocols. By supporting proxy interfaces and dynamic call interfaces, WSIF enables end users and system software developers to use multiple protocols to support interfaces provided by WSIF. WSIF supports delay binding, so that the service can be re-bound to a new protocol without changing the code. The Open Source WSIF CodeBase Includes Providers for Java, EJB, AND SOAP (Over HTTP and JMS). Wsif Has BEEN USED IN WebSphere Enterprise Edition 4.1 and Versata's Logic Server WebServices Add-on.
AcknowledgmentsThe main contributors to the WSIF release, in alphabetical order, are: Aleksander A. Slominski, Anthony Elder, Dieter Koenig, Gerhard Pfau, Jeremy Hughes, Mark Whitlock, Matthew J. Duftler, Michael Beisiegel, Nirmal Mukhi, Owen Burroughs, Paul Fremantle , Piotr przybylski, and Sanjiva Weerawaranaresources
Check out Web services invocation sans SOAP, Part 1 and Part 2.Web Services invocation framework on Apache Software Foundation. Check out the JROM project on alphaWorks.The W3C Note on WSDL. The J2SE JAR service provider specification allows dynamic registration of new providers.
About the authorPaul Fremantle is an architect in IBM's Hursley Laboratory, working on Web services components in IBM WebSphere Application Server, as well as open source projects such as WSDL4J and WSIF Paul is the co-lead of the Java standard JSR110:. Java APIs for WSDL. Paul previously worked as a WebSphere specialist in the software group and as an architect in IBM Global Services. Before joining IBM, Paul worked as a consultant in the pharmaceutical industry. His publications include articles on porting EJBs from WebLogic to WebSphere, and a Redbook, "The XML Files: Using XML and XSL in WebSphere." Paul has presented at ApacheCon, XML Europe, Software Architecture, and other industry conferences He has an MA in Mathematics and Philosophy and an M.Sc in Computation from.
Oxford
University
YOU CAN Contact Paul At Pzf@uk.ibm.com.