2

Django + Spyne 2.11/2.12.x を使用して既存の Axis 1.4 サービスをエミュレートしようとしていますが、特定の名前空間プレフィックス (wsse / wsu) を持つ WS-security タイムスタンプ トークンが必要です。これを、すでに正しく動作する suds デジタル署名プラグイン (sudssigner) と一緒に使用します。

動的SOAPヘッダーをspyneに追加する推奨方法は何ですか?

具体的な名前空間プレフィックスの使用を強制するにはどうすればよいですか?

更新: WS 応答は、次の例にできるだけ近いものにする必要があります。

<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header>
        <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
            <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-15452452">
                <wsu:Created>2016-02-01T10:14:54.517Z</wsu:Created>
                <wsu:Expires>2016-02-01T10:19:54.517Z</wsu:Expires>
            </wsu:Timestamp>
            <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="Signature-2088192064">
                <ds:SignedInfo>
                    <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
                    <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
                    <ds:Reference URI="#Id-1052429873">
                        <ds:Transforms>
                            <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
                        </ds:Transforms>
                        <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
                        <ds:DigestValue>...</ds:DigestValue>
                    </ds:Reference>
                    <ds:Reference URI="#Timestamp-15452452">
                        <ds:Transforms>
                            <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
                        </ds:Transforms>
                        <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
                        <ds:DigestValue>...</ds:DigestValue>
                    </ds:Reference>
                </ds:SignedInfo>
                <ds:SignatureValue>
...
                </ds:SignatureValue>
                <ds:KeyInfo Id="KeyId-8475839474">
                    <wsse:SecurityTokenReference xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="STRId-680050181">
                        <wsse:KeyIdentifier EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier">...</wsse:KeyIdentifier>
                    </wsse:SecurityTokenReference>
                </ds:KeyInfo>
            </ds:Signature>
        </wsse:Security>
    </soapenv:Header>
    <soapenv:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Id-1052429873">
...
    </soapenv:Body>
</soapenv:Envelope>

事前にサンクス。

4

1 に答える 1

0

動的SOAPヘッダーをspyneに追加する推奨方法は何ですか?

Spyne はすでに動的 SOAP ヘッダーを実装しています。Spyne を使用して応答に SOAP ヘッダーを追加する方法についてお問い合わせの場合は、こちらの例を参照してください。

https://github.com/arskom/spyne/blob/dec5286212602fb793db10ea67c5a1bdcad36315/spyne/test/interop/server/_service.py#L144

具体的な名前空間プレフィックスの使用を強制するにはどうすればよいですか?

「具体的な名前空間プレフィックス」とは何ですか? オブジェクトを名前空間 (具体的かどうかにかかわらず) に入れたい場合は、それらを名前空間に入れます。

class SomeClass(ComplexModel):
    __namespace__ = "https://a.very.concrete/namespace"

    i = Integer
    s = Unicode
    # etc
于 2016-02-01T18:45:28.203 に答える