How to validate multiref with spyne?

89 views Asked by At

I need to validate a multiRef document using spyne

This is the request send to spyne SOAP server

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <ns1:test xmlns:ns1="urn:Service3" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
            <clientInfo href="id0"/>
        </ns1:test>
        <multiRef xmlns:ns2="http://myexample.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:TClientInfo">
            <os xsi:type="xsd:string">Windows</os>
        </multiRef>
    </soapenv:Body>
</soapenv:Envelope>

This is the response

My class 

class TC(ComplexModel):
    os = String

class TestRequest(ComplexModel):
    clientInfo = TC

This is the decorator I am using

 @rpc(TestRequest, _returns=TestRequest, _body_style='bare')

application is configured starting with

application = Application([RsMasterGamingService3], 'urn:RsMasterGamingService3', in_protocol=Soap11(validator='soft'), out_protocol=Soap11())

but response is

<?xml version='1.0' encoding='UTF-8'?>
<soap11env:Envelope xmlns:soap11env="http://schemas.xmlsoap.org/soap/envelope/">
    <soap11env:Body>
        <soap11env:Fault>
            <faultcode>soap11env:Client.ValidationError</faultcode>
            <faultstring>The value 'ns2:TClientInfo' could not be validated.</faultstring>
            <faultactor></faultactor>
        </soap11env:Fault>
    </soap11env:Body>
</soap11env:Envelope>
1

There are 1 answers

0
Max Stainer On

solved using AnyDict

Class TestRequest(AnyDict):
    clientInfo = TC