Files
deb-python-wsme/wsme/protocols/templates/wsdl.html
Christophe de Vienne 32d909a208 Add arrays support in soap
2011-10-07 15:16:21 +02:00

102 lines
4.2 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="${service_name}"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:py="http://genshi.edgewall.org/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
py:attrs="{'xmlns:tns' : tns, 'xmlns:types' : typenamespace, 'targetNamespace' : tns, 'xmlns:soapenc' : soapenc }">
<wsdl:types>
<xsd:schema elementFormDefault="qualified"
targetNamespace="${typenamespace}">
<!-- !Declare all of the complex types (user classes). -->
<xsd:complexType py:for="cls in complex_types"
name="${cls.__name__}">
<xsd:sequence>
<xsd:element py:for="attr, attrdef in list_attributes(cls)" name="${attr}"
type="${soap_type(attrdef.datatype)}"
minOccurs="${attrdef.mandatory and 1 or 0}"
maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<!-- !Declare the request/response pairs for each function -->
<py:for each="funcdef in funclist">
<xsd:element name="${soap_fname(funcdef)}">
<xsd:complexType>
<xsd:sequence>
<xsd:element py:for="farg in funcdef.arguments"
name="${farg.name}"
type="${soap_type(farg.datatype)}"
py:attrs="{'minOccurs': not farg.mandatory and '0' or None}"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="${soap_fname(funcdef)}Response">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="result"
type="${soap_type(funcdef.return_type)}"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</py:for>
<!-- !Declare all of the array types. -->
<xsd:complexType py:for="array in arrays" name="${soap_array(array)}">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="item" nillable="true"
type="${soap_type(array)}"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<!-- !Declare the request and response messages used for each func. -->
<py:for each="funcdef in funclist">
<wsdl:message name="${soap_fname(funcdef)}Request" py:attrs="{'xmlns':typenamespace}">
<wsdl:part name="parameters" element="types:${soap_fname(funcdef)}"/>
</wsdl:message>
<wsdl:message name="${soap_fname(funcdef)}Response" py:attrs="{'xmlns':typenamespace}">
<wsdl:part name="parameters" element="types:${soap_fname(funcdef)}Response"/>
</wsdl:message>
</py:for>
<!-- !Define the PortType for the service and all of the operations
(functions) declared in the service. -->
<wsdl:portType name="${service_name}_PortType">
<wsdl:operation py:for="funcdef in funclist" name="${soap_fname(funcdef)}">
<wsdl:documentation py:if="funcdef.doc">${funcdef.doc}</wsdl:documentation>
<wsdl:input message="tns:${soap_fname(funcdef)}Request"/>
<wsdl:output message="tns:${soap_fname(funcdef)}Response"/>
</wsdl:operation>
</wsdl:portType>
<!-- !Declare our service as a document/literal style service with http
transport. -->
<wsdl:binding name="${service_name}_Binding" type="tns:${service_name}_PortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation py:for="funcdef in funclist" name="${soap_fname(funcdef)}">
<soap:operation soapAction="${soap_fname(funcdef)}"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<!-- !Define our service's location. -->
<wsdl:service name="${service_name}">
<wsdl:documentation>WSDL File for ${service_name}</wsdl:documentation>
<wsdl:port binding="tns:${service_name}_Binding" name="${service_name}_PortType">
<soap:address
location="${baseURL}"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>