Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

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 and to use it.

...

The code generator generates a function for each operation. Unless the operation is one way, the function will take two callback parameters, plus the parameters for the operation itself. The first two parameters are the success callback and the error callback. OneWay operations have no callbacks, ; they are "fire and forget."

...

If you have a choice in the matter, and you are using Document/Literal, the present author recommends bare as opposed to wrapped methods. This pushes all the type management from the front end (JAX-WS or Simple) to the data binding (JAXB or Aegis). The data bindings offer much clearer configuration control over namespaces, minOccurs, and such than the frontends.

...

Code Block
javascript
javascript

function errorCallback(httpStatus, httpStatusText) 
{
	globalErrorStatus = httpStatus; // integer HTTP status
	globalStatusText = httpStatusText; // Textual HTTP status
}

function successCallback(responseObject) 
{
// the parameter is an object of the type declared for the
// method.
	globalResponseObject = responseObject;
}

function compliantTest(url)
{
    var intf;
    // class for the service.
    intf = new org_apache_cxf_javascript_fortest_SimpleDocLitBare();
    intf.url = url;
    var bareParam = new my_param_class_object();
    bareParam.setWhatever(someValue);
    // ...
    intf.compliant(successCallback, errorCallback, bareParam); 
}

...

xs:any Example: Using a Described Type

The following function calls a Document/Literal/Bare method. The bare parameter element is declared as:

...

This particular xs:any allows any single XML element from some namespace other than the target namespace of the schema containing 'acceptAny1'.
(Note that JAXB only supports xs:any for ##other, and interprets it to forbid unqualified elements. If you need more flexibility, consider
another data binding.)

...

For the xs:any element, it creates an object of type org_apache_cxf_any_holder. This type, defined in cxf-utils.js, holds an object for an element
defined in the WSDL's schemas. To construct one, you supply the URI and local names of the element, and then the value. For built-in types, use the XML Schema URI
(http://www.w3.org/2001/XMLSchemaImage Removed) and the name of the type (e.g. 'string').

...

What if your xs:any calls for more than one item? You supply an array of holders, since each holder could be some different element..h3

xs:any Using Raw XML

CXF also allows you to provide the XML yourself. The XML you provide must be valid. If the elements are qualified, you must
define the namespace definitions with appropriate xmlns attributes. Here is an example. Note in this example that the
element is qualified; it lives in the uri:iam namespace. JAXB does not permit unqualified elements , (at least in the current version
of the reference implementation that CXF uses).

If your xs:any accept accepts multiple elements, you supply a single holder with a XML fragment containing multiple elements.

...