Entschlüsseln einer Nachricht mit einem Spring Web Service-Client

350 Kopfgeld und Waffeln an die Person, die mir helfen kann!

Ich habe mit gekämpftFrühling Webdienst-Verschlüsselung seit Tagen und ich kann nicht herausfinden, wie die Spring-Verschlüsselung für den Nachrichtentext funktioniert. Immer wenn der Server die resultierende Nachricht verschlüsselt, scheint der Client sie nicht zu entschlüsseln, bevor er versucht, sie anhand des Schemas zu validieren (XSD).

Hier ist die serverseitige Konfiguration

Die xwss-Sicherheitskonfiguration des Servers

Die Spring-Konfiguration des Clients

Xwss-Konfiguration des Clients

Ich kann das Benutzertoken verschlüsseln und erfolgreich entschlüsseln. Das mache ich, wenn ich Daten vom Client zum Server sende. Der Server entschlüsselt dann das Benutzertoken und authentifiziert die Benutzeranmeldeinformationen, was recht gut funktioniert.

Das Problem tritt auf, wenn ich versuche, den Text der zurückkommenden Nachricht zu verschlüsseln. Das Problem tritt auf der Clientseite auf. Es scheint, dass der Client versucht, die Nachricht zu validieren, bevor sie entschlüsselt wird. Daher tritt beim Validieren anhand des Schemas ein Fehler auf.

[Fatal Error] :1:192: The prefix "ns0" for element "ns0:HolidayListResponse" is not bound.
11-Dec-2009 7:45:32 AM com.sun.xml.wss.impl.apachecrypto.DecryptionProcessor decryptElementWithCipher
SEVERE: WSS1203: Exception [ The prefix "ns0" for element "ns0:HolidayListResponse" is not bound. ] while trying to decrypt message

Und hier ist die SOAP-Antwort selbst.

Und hier ist die Marshalling-Mapping-Datei

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
                         "http://castor.org/mapping.dtd">
<mapping>
    <field-handler name="dateHandler" class="com.mycompany.hr.handlers.DateFieldHandler" />
    <field-handler name="dateHandler2" class="com.mycompany.hr.handlers.DateFieldHandler" />
    <class name="com.mycompany.hr.data.Holiday">
        <map-to ns-uri="http://mycompany.com/hr/schemas" ns-prefix="ns0" xml="Holiday" />
        <field name="from" type="string" handler="dateHandler">
            <bind-xml name="StartDate" node="element" />
        </field>
        <field name="to" type="string" handler="dateHandler2">
            <bind-xml name="EndDate" node="element" />
        </field>
    </class>
    <class name="com.mycompany.hr.data.Employee">
        <map-to ns-uri="http://mycompany.com/hr/schemas" ns-prefix="ns0" xml="Employee" />
        <field name="number" type="java.lang.Integer">
            <bind-xml name="Number" node="element" />
        </field>
        <field name="firstName" type="java.lang.String">
            <bind-xml name="FirstName" node="element" />
        </field>
        <field name="lastName" type="java.lang.String">
            <bind-xml name="LastName" node="element" />
        </field>
    </class>
    <class name="com.mycompany.hr.data.HolidayRequest">
        <map-to ns-uri="http://mycompany.com/hr/schemas" ns-prefix="ns0" xml="HolidayRequest" />
        <field name="holiday" type="com.mycompany.hr.data.Holiday">
            <bind-xml name="Holiday" node="element" />
        </field>
        <field name="employee" type="com.mycompany.hr.data.Employee">
            <bind-xml name="Employee" node="element" />
        </field>
    </class>

    <class name="com.mycompany.hr.data.HolidayConfirmation">
        <map-to ns-uri="http://mycompany.com/hr/schemas" ns-prefix="ns0" xml="HolidayConfirmation" />
        <field name="confirmationCode" type="java.lang.Integer">
            <bind-xml name="ConfirmationCode" node="element" />
        </field>
        <field name="confirmationMessage" type="java.lang.String">
            <bind-xml name="ConfirmationMessage" node="element" />
        </field>
    </class>

    <class name="com.mycompany.hr.data.HolidayResponse">
        <map-to ns-uri="http://mycompany.com/hr/schemas" ns-prefix="ns0" xml="HolidayResponse" />
        <field name="confirmation" type="com.mycompany.hr.data.HolidayConfirmation">
            <bind-xml name="HolidayConfirmation" node="element" />
        </field>
    </class>
    <class name="com.mycompany.hr.data.HolidayListRequest">
        <map-to ns-uri="http://mycompany.com/hr/schemas" ns-prefix="ns0" xml="HolidayListRequest" />
        <field name="id" type="java.lang.Integer">
            <bind-xml name="userId" node="element" />
        </field>
    </class>
    <class name="com.mycompany.hr.data.HolidayListResponse">
        <map-to ns-uri="http://mycompany.com/hr/schemas" ns-prefix="ns0" xml="HolidayListResponse" />
        <field name="holidays" type="com.mycompany.hr.data.Holiday" collection="vector">
            <bind-xml name="Holiday" node="element" />
        </field>
    </class>
</mapping>

Ich weiß, es sind viele Informationen, aber ich dachte, ich würde alles liefern. Ist mein Verschlüsselungssetup korrekt? Ist es nicht möglich, den Nachrichtentext auf der Clientseite zu verschlüsseln und zu entschlüsseln? An dieser Stelle bin ich für fast alle Vorschläge offen.

Antworten auf die Frage(2)

Ihre Antwort auf die Frage