_javascript_ Client Code has been edited by Benson Margulies (Dec 14, 2007).

(View changes)

Content:

Structure of the Code

There are three types of _javascript_ code:

  • Utilities
  • Schema
  • Service

Utilities

The utilities code is a fixed set of _javascript_ that provides some browser compatibility and XML management. This code is delivered in the distribution in the file etc/cxf-utils.js. If you are using the ?js URL handler, it is delivered at the beginning of the response (unless you add ?nojsutils to the URL). If you are generating _javascript_ using the tools, it is up to you to copy this file use it.

Schema Code

The Schema code generates one object for each 'bean' used in your service. This code is organized by XML Schema. The code for each schema starts with a comment like:

//
// Definitions for schema: http://apache.org/hello_world_soap_http/types
//  file:/home/benson/cxf/trunk/distribution/src/main/release/samples/js_browser_client/wsdl/hello_world.wsdl#types1
//

The generator generates a _javascript_ constructor for each global complex type and element in the schema. Generally, you will find that the service methods are defined in terms of types, not elements. However, depending on whether you use Document or RPC, and depending on exactly how you configure your parts and types, you may find that a particular method is defined in terms of an 'element'-based _javascript_ type instead of a 'type'-based class.

A typical type looks like:

function apache_org_hello_world_soap_http_types_sayHiResponse () {
    this._responseType = '';
}

function apache_org_hello_world_soap_http_types_sayHiResponse_getResponseType() { return this._responseType;}
apache_org_hello_world_soap_http_types_sayHiResponse.prototype.getResponseType = apache_org_hello_world_soap_http_types_sayHiResponse_getResponseType;
function apache_org_hello_world_soap_http_types_sayHiResponse_setResponseType(value) {this._responseType = value;}
apache_org_hello_world_soap_http_types_sayHiResponse.prototype.setResponseType = apache_org_hello_world_soap_http_types_sayHiResponse_setResponseType;

Reply via email to