h.andrew.vo
h.andrew.vo

Reputation: 31

Spyne SOAP - Process Request with ArrayType

I am reverse engineering an existing SOAP API and cannot figure out how to get the service working

Request:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soap:Body>
        <get_latest xmlns="SOAP/Server">
            <soapenc:Array soapenc:arrayType="xsd:int[2]" xsi:type="soapenc:Array">1
                <item xsi:type="xsd:int">25994</item>
                <item xsi:type="xsd:int">27424</item>
            </soapenc:Array>
        </get_latest>
    </soap:Body>
</soap:Envelope>

I've tried various variations of the following Code:

application = Application(
    [Service],
    tns='SOAP/Server',
    in_protocol=Soap11(validator='soft'),
    out_protocol=Soap11(pretty_print=True, polymorphic=True)
)

@rpc(Soapenc, _returns=Iterable(Integer))
    def get_latest(ctx, soapenc):
        return controllers.get_latest_by_numbers(soapenc)

class Item(ComplexModel):
    _type_info = {
        'item': Integer
    }   
class Soapenc(ComplexModel):
    __type_name__ = 'soapenc'
    items = Array(Item)

Tried to use Iterable(Integer) instead of the custom class, Iterable(Item) instead of Array. soapenc is always none. What am I doing wrong?

Upvotes: 0

Views: 28

Answers (0)

Related Questions