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 tested with the latest release in each of the 2.4, 2.5, 2.6, and 2.7 series prior to release.
PyXB is distributed through SourceForge. As of the 1.1.4 release, separated bundles are no longer distributed. The source distribution includes pre-built bindings for the common (core XML), WS-* (web services), and SAML (Security Assertion Markup Languge) bundles, as well as the user and API documentation. The OpenGIS bundle infrastructure is present, but due to the size of the bindings and archives is not pre-built.
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.