PyXB requires Python version 2.4 or higher (not including 3.x). Among other things the implementation relies on decorators (PEP 318) like @classref that are not present in earlier versions. The distribution is regularly tested with the latest release in each of the 2.4, 2.5, and 2.6 series.
PyXB is distributed in several forms through SourceForge. If all you want is the ability to generate bindings for XML schemas, use the PyXB-base release file. If you also want pre-built documentation, unpack the PyXB-doc release as well. For pre-built bundles, use the following:
File | Bundle Contents |
---|---|
PyXB-common | XHTML, other miscellaneous namespaces |
PyXB-opengis | The complete suite of OpenGIS schemas |
PyXB-wssplat | A wide variety of WS-* schemas |
If you want everything in one download, just get the PyXB-full distribution file.
Install in the usual manner:
python setup.py install
You can test the distribution with:
python setup.py test
which will run all the unit tests. Some of them will print warnings and other noise, but if at the end they all pass, don’t worry about it.
If you need more help with installation, see http://docs.python.org/install/index.html.
The pyxbgen script is used to translate XML schema and WSDL documents into Python data bindings. There are two key components to generating bindings:
There are many additional parameters; see Generating Binding Classes and pyxbgen Command Line Options.
The pyxbwsdl script is used to examine and operate on WSDL definition documents. In this release, it retrieves the WSDL document specified by the URI passed as an argument, and prints the available services with their operations and parameters. For example:
vmfed9[343]$ pyxbwsdl http://api.google.com/GoogleSearch.wsdl
Need to dynamically create schema
Importing pyxb.standard.bindings.soap
Attempting to load a namespace from /home/pab/pyxb/dev/pyxb/standard/bindings/raw/wsdl.wxs
Attempting to load a namespace from /home/pab/pyxb/dev/pyxb/standard/bindings/raw/soapenc.wxs
Attempting to load a namespace from /home/pab/pyxb/dev/pyxb/standard/bindings/raw/soap.wxs
Service: GoogleSearchService
Port GoogleSearchPort at http://api.google.com/search/beta2
doGetCachedPage (at action=urn:GoogleSearchAction)
Input: typens:doGetCachedPage
Output: typens:doGetCachedPageResponse
doSpellingSuggestion (at action=urn:GoogleSearchAction)
Input: typens:doSpellingSuggestion
Output: typens:doSpellingSuggestionResponse
doGoogleSearch (at action=urn:GoogleSearchAction)
Input: typens:doGoogleSearch
Output: typens:doGoogleSearchResponse
Currently, this is an unmaintained example. In the future, this script may provide a more powerful display of available services, and perhaps support for generating functions which interact with the service using the appropriate encoding.