3.2. Step 2: Create a New WSRF Site

Now that we have defined the service's interface, we need to generate the Python skeleton of that interface. This skeleton will need to know what its own name is and what types of messages to accept, in this sense binding the abstract interface to a particular runnable instance. In order to do this, you will need to run the Python wsdl2web.py script, which will set up a new site.

3.2.1. wsdl2web.py

Copy and paste the WSDL presented above to a file called SimpleMath.wsdl.

Create the new Site.


% mkdir /tmp/SimpleMathSite
% cp SimpleMath.wsdl /tmp/SimpleMathSite
% cd /tmp/SimpleMathSite
% wsdl2web.py SimpleMath.wsdl --script=client.py
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/ZSI-2.0_rc2-py2.4.egg/ZSI/generate/wsdl2dispatch.py:436: UserWarning: Port(MathPort) operation(add) in Binding(MathBinding) soapAction() != WS-Action(http://www.globus.org/namespaces/examples/core/MathService_instance/MathPortType/addRequest) (1)
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/ZSI-2.0_rc2-py2.4.egg/ZSI/generate/wsdl2dispatch.py:436: UserWarning: Port(MathPort) operation(subtract) in Binding(MathBinding) soapAction() != WS-Action(http://www.globus.org/namespaces/examples/core/MathService_instance/MathPortType/subtractRequest)
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/ZSI-2.0_rc2-py2.4.egg/ZSI/generate/wsdl2dispatch.py:436: UserWarning: Port(MathPort) operation(getValueRP) in Binding(MathBinding) soapAction() != WS-Action(http://www.globus.org/namespaces/examples/core/MathService_instance/MathPortType/getValueRPRequest)
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/pyGridWare-1.2.0rc3-py2.4.egg/pyGridWare/utility/generate/Utility.py:47: UserWarning: portType(MathPortType) does not have a ResourceProperties declaration (2)
    
(1)
This warning can be safely ignored, the soapAction is unspecified so it doesn't have to match the WS-Action value.
(2)
This warning is informing us that there is no WSRP ResoureProperties declaration, this will be further elaborated on.

After the script has finished there will be several new files:


% ls
SimpleMath.wsdl (1)
client.py (2)
generated (3)
server-config.tac (4)
server-config.txt (5)
start-container.sh (6)
    
(1)
Original SimpleMath WSDL file
(2)
Barebones sample client script
(3)
Directory with all code generated from the WSDL
(4)
Twisted tac file, sets up a few core WSRF services.
(5)
Basic server configuration file
(6)
Script for starting the container

The generated service generated/SimpleMath/services/SimpleMath/MathService.py needs to be added to in order to make the service actually do what it promised to do, i.e. add an subtract integers. Because the service does not have a WSRP ResourceProperties declaration state will have to be managed by the service directly.