Hi,

I have found a minor issue with soaplib, which doesn't handle properly the 
definition of an Application with multiple Services 

If I define a soap Application with three services (DefinitionBase) :



class Service1(DefinitionBase):
    @soap(String, _returns=String)
    def my_method(self, hello):
        return 'world'

class Service2(DefinitionBase):
    @soap(String, _returns=String)
    def my_other_method(self, guten):
        return 'tag'

class Service3(DefinitionBase):
    @soap(String, _returns=String)
    def my_last_method(self, bonjour):
        return 'monde'

app = soaplib.core.Application([Service1, Service2, Service3], 'tns', 
name='ExampleService')


The WSDL will only contain one <service> entry :

    <wsdl:service name="ExampleWebService">
        <wsdl:port name="ExampleWebService" binding="tns:ExampleWebService">
            <soap:address location="http://127.0.0.1:7003/ws/test/?wsdl"/>
        </wsdl:port>
        <wsdl:port name="ExampleWebService" binding="tns:ExampleWebService">
            <soap:address location="http://127.0.0.1:7003/ws/test/?wsdl"/>
        </wsdl:port>
        <wsdl:port name="ExampleWebService" binding="tns:ExampleWebService">
            <soap:address location="http://127.0.0.1:7003/ws/test/?wsdl"/>
        </wsdl:port>
    </wsdl:service>


I have attached a patch which fixes this issue ; let me know if I need to 
improve it one way or the other.

    <wsdl:portType name="Service1">
        <wsdl:operation name="my_method" parameterOrder="my_method">
            <wsdl:input name="my_method" message="tns:my_method"/>
            <wsdl:output name="my_methodResponse" 
message="tns:my_methodResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="Service1" type="tns:Service1">
        <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="my_method">
            <soap:operation soapAction="my_method" style="document"/>
            <wsdl:input name="my_method">
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="my_methodResponse">
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="Service1">
        <wsdl:port name="Service1" binding="tns:Service1">
            <soap:address location="http://127.0.0.1:7003/ws/test/?wsdl"/>
        </wsdl:port>
    </wsdl:service>
    <wsdl:portType name="Service2">
        <wsdl:operation name="my_other_method" parameterOrder="my_other_method">
            <wsdl:input name="my_other_method" message="tns:my_other_method"/>
            <wsdl:output name="my_other_methodResponse" 
message="tns:my_other_methodResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="Service2" type="tns:Service2">
        <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="my_other_method">
            <soap:operation soapAction="my_other_method" style="document"/>
            <wsdl:input name="my_other_method">
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="my_other_methodResponse">
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="Service2">
        <wsdl:port name="Service2" binding="tns:Service2">
            <soap:address location="http://127.0.0.1:7003/ws/test/?wsdl"/>
        </wsdl:port>
    </wsdl:service>
    <wsdl:portType name="Service3">
        <wsdl:operation name="my_last_method" parameterOrder="my_last_method">
            <wsdl:input name="my_last_method" message="tns:my_last_method"/>
            <wsdl:output name="my_last_methodResponse" 
message="tns:my_last_methodResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="Service3" type="tns:Service3">
        <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="my_last_method">
            <soap:operation soapAction="my_last_method" style="document"/>
            <wsdl:input name="my_last_method">
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="my_last_methodResponse">
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="Service3">
        <wsdl:port name="Service3" binding="tns:Service3">
            <soap:address location="http://127.0.0.1:7003/ws/test/?wsdl"/>
        </wsdl:port>
    </wsdl:service>

-- 
Raphaël Barrois

Attachment: soaplib_multiple_services.patch
Description: Binary data

_______________________________________________
Soap mailing list
[email protected]
http://mail.python.org/mailman/listinfo/soap

Reply via email to