JavaScript Client Configuration
Skip to end of metadata
Go to start of metadata

If you want to use the JavaScript client generator, your first decision is whether to generate JavaScript files with the tools or whether to use the ?js URL handler. Using the tools has some advantages: you can easily read the JavaScript and see the generated API, and you don't use runtime CPU time generating the JavaScript. On the other hand, you have to juggle the JavaScript files. A more serious issue applies to code-first services. It can be tricky to ensure that you configure java2js with exactly the same configuration that your service establishes at runtime.

In either case, the only configurable item, in the JavaScript client generator is the mapping of namespace URIs to JavaScript object name prefixes. As of this writing, you can configure this either in the Spring configuration (or API) of your endpoint, or as command-line options to java2js. We expect to modify this to work with a WSDL/Spring schema extension, so early adopters may prefer to live with the default mapping at this time.

If you are planning to use the ?js URL handler, you must configure it onto your bus. If you use cxf.xml or cxf-servlet.xml to configure your services, the ?js URL handler will be included along with all the other bus extensions. If you build your own Spring configuration, you have to include META-INF/cxf/cxf-extension-javascript-client.xml in your bean configuration. If you are configuring a bus the hard way, add org.apache.cxf.javascript.JavascriptQueryHandlerRegistry to the bus and it will register the handler.

Labels
  • No labels