Properly handle and replace wildcards
[pywsdlgen.git] / README
blob41ef8f4373e4119981754b8fdb81b3c4e4d8a616
1 PyWsdlGen
2 =========
5 Introduction
6 ------------
8 PyWsdlGen is a little tool to generate a Web Services Description
9 Language (WSDL) file from Python source files.
10 It parses a given Python source file and reads all public methods
11 defined in this file to generate a WSDL file to be used for example
12 for SOAP services implemented in Python.
15 Concept
16 -------
17 The idea behind this tool is to provide an easy way to generate WSDL files
18 from existing Python code. The generated WSDL file usually still need to
19 be edited to adjust for unknown data types like lists or dictionaries
20 which need to be mapped to complex types in SOAP.
21 Once you have generated a WSDL file, you can use other tools like ZSI
22 (Zolera SOAP Infrastructure, http://pywebsvcs.sourceforge.net/zsi.html)
23 to generate the necessary supporting code for a SOAP service
24 (or even client code).
25 So, this tool parses a Python source file which contains the basic API which
26 should be provided by the SOAP service and generates a valid WSDL file.
29 Usage
30 -----
32 Run PyWsdlGen as follows:
33 ./pywsdlgen --name "SomeGoodService" --url "http://localhost:12345" --output="WSDL" goodservice.py
36 This will parse the file "goodservice.py" for available public functions
37 and generate a WSDL file into the file "WSDL" which provides a service
38 named "SomeGoodService" which is meant to run on http://localhost:12345.
39 If you don't specify the --name option, the class name of the parsed file
40 is used.
43 You can also use a custom WSDL template file by using the parameter
44 --template followed by a filename. By default, the included
45 WSDL.template is used. If you want to use a custom template, it can
46 contain the following wildcards which will be substituted:
48 ${name}       - the name of the service
49 ${url}        - the destination URL of the service
50 ${messages}   - will be substituted by the parsed public functions
51 ${ports}      - will be substituted by the parsed public functions
52 ${operations} - will be substituted by the parsed public functions
55 Data types
56 ----------
58 The generated WSDL file must contain types for the various function
59 arguments and return values. PyWsdlGen tries to parse information about
60 the data types of the function arguments and return values from
61 doc strings. However, to get this working, the doc string need to be
62 in a recognisable format. Currently, only the following format
63 is supported:
65 def get_a_int(self, session_key, name, really):
66     """
67     Get a value
69     @param session_key (str)
70     @param name (str)
71     @param really (bool)
72     @return value (int)
73     """
74     return 0
76 Furthermore, only a few Python types can be mapped directly to
77 pre-defined types in the Web Services Description Language.
78 PyWsdlGen tries to map most of the known types, other types
79 such as lists, dicts, tuples or custom classes cannot be
80 mapped directly and so PyWsdlGen uses the non-existant type
81 '***unknown***' instead. In such cases, you need to edit the
82 generated WSDL manually and insert a type definition first
83 and then use this new type for the corresponding function.
86 License
87 -------
88 PyWsdlGen is distributed under the terms of the
89 GNU Lesser General Public License as published by the
90 Free Software Foundation; version 2 of the license.
91 A copy of this license can be found in the file COPYING included with
92 the source code of this program.
95 Ideas, questions, patches and bug reports
96 -----------------------------------------
97 Send them to me at enrico(dot)troeger(at)uvena(dot)de