i have looked at examples :
- http://pywebsvcs.svn.sourceforge.net/viewvc/pywebsvcs/trunk/wstools/
- http://pywebsvcs.sourceforge.net/cookbook.pdf
and googled, but could not find a single usable example.
i have looked at examples :
and googled, but could not find a single usable example.
reference: (Thanks to Doug Hellmann ) building soap service
The Zolera Soap Infrastucture (ZSI), is a part of the pywebsvcs project. It provides complete server and client libraries for working with SOAP. To use it, a developer writes the WSDL file (by hand or using a WSDL editor), and then generates Python source for the client and stubs for the server. The data structures defined in the WSDL file are converted into Python classes that can be used in both client and server code.
we implemented a simple echo service that returns as output whatever it gets as input from the client. Listing 1 contains the hand-crafted WSDL inputs for the ZSI version of this service.
Listing 1
To generate the client and server code from the WSDL, feed it into the wsdl2py program (included with ZSI). To add support for complex types, add the -b option, but it isn’t required for this simple example. wsdl2py will, in response, produce three files:
Listing 2
EchoServer_client.py is the code needed to build a client for the SimpleEcho web service.
Listing 3
EchoServer_server.py contains code needed to build the SimpleEcho web service server.
Listing 4
EchoServer_types.py has type definitions used by both the client and server code.
Once generated, these files are not meant to be edited, because they will be regenerated as part of a build process whenever the WSDL input changes. The code in the files grows as more types and calls are added to the service definition.
The implementation of the server goes in a separate file that imports the generated code. In the example, the actual service is on lines 18–25 of Listing 5. The @soapmethod decorator defines the input (an EchoRequest) and the output (an EchoResponse) for the call. In the example, the implementation of soap_Echo() just fills in the response value with the request value, and returns both the request and the response. From there, ZSI takes care of building the SOAP response and sending it back to the client.
Listing 5
Listing 6 includes a sample of how to use the ZSI client libraries to access the servers from the client end. All that needs to be done is to create a handle to the EchoServer web service, build an EchoRequest, send it off to the web service, and read the response.