|
Page Edited :
CXF20DOC :
_javascript_
_javascript_ has been edited by Ken Geis (May 11, 2007). Change summary: typos Using Dynamic Languages to Implement ServicesOverview_javascript_, also known by its formal name ECMAScript, is one of the many dynamic languages that are growing in prevalence in development environments. It provides a quick and lightweight means of creating functionality that can be run on a number of platforms. Another strength of _javascript_ is that applications can be quickly rewritten. CXF provides support for developing services using _javascript_ and ECMAScript for XML(E4X). The pattern used to develop these services are similar to JAX-WS Provider implementations that handle their requests and responses (either SOAP messages or SOAP payloads) as DOM documents. Implementing a Service in _javascript_Writing a service in _javascript_is a two step process:
Defining the MetadataNormal Java providers typically use Java annotations to specify JAX-WS metadata. Since _javascript_ does not support annotations, you use ordinary _javascript_ variables to specify metadata for _javascript_ implementations. CXF treats any _javascript_ variable in your code whose name equals or begins with WebServiceProvider as a JAX-WS metadata variable. Properties of the variable are expected to specify the same metadata that the JAX-WS WebServiceProvider annotation specifies, including:
The _javascript_ WebServiceProvider can also specify the following optional properties:
Example 1 shows a metadata description for a _javascript_ service implementation. Example 1:_javascript_ Metadata var WebServiceProvider1 = { 'wsdlLocation': 'file:./wsdl/hello_world.wsdl', 'serviceName': 'SOAPService1', 'portName': 'SoapPort1', 'targetNamespace': 'http://apache.org/hello_world_soap_http', };
You deploy services into the container using the following command: java org.apache.cxf.js.rhino.ServerApp [ -a addressURL ] [ -b baseAddressURL ] file.js [ file2.js file3.jsx ... ] The org.apache.cxf.js.rhino.ServerApp class, shorted to ServerApp below, takes one or more _javascript_ files, suffixed with a .js, or E4X files, suffixed with a .jsx, and loads them into the CXF runtime. If ServerApp locates JAX-WS metadata in the files it creates and registers a JAX-WS Provider<DOMSource> object for each service. The Provider<DOMSource> object delegates the processing of requests to the implementation stored in the associated file. ServerApp can also take the name of a directory containing _javascript_ and E4X files. It will load all of the scripts that contain JAX-WS metadata, load them, and publish a service endpoint for each one. ServerApp has three optional arguments:
The optional arguments take precedence over any addressing information provided in {{EndpointAddress}}properties that appear in the JAX-WS metadata. For example, if you deployed a _javascript_ service using the command shown in Example 4, your service would be deployed at http://cxf.apache.org/goodness Example 4:Deploying a Service at a Specified Address java org.apache.cxf.js.rhino.ServerApp -a http://cxf.apache.org/goodness To deploy a number of services using a common base URL you could use the command shown in Example 5. If the service defined by hello_world.jsx had port name of helloWorld, ServerApp would publish it at http://cxf.apache.org/helloWorld Example 5:Deploying a Group of Services to a Base Address java org.apache.cxf.js.rhino.ServerApp -b http://cxf.apache.org You can also combine the arguments as shown in Example 6 and your service would be deployed at http://cxf.apache.org/goodness
|
Unsubscribe or edit your notifications preferences
