350 Bounty và bánh quế cho người có thể giúp tôi!Giải mã thư với ứng dụng khách Spring Spring Service
Tôi đã đấu tranh với mã hóa dịch vụ Web Spring trong nhiều ngày và tôi không thể tìm ra cách để mã hóa Spring trên cơ thể thông báo hoạt động. Bất cứ khi nào tôi có máy chủ mã hóa thông báo kết quả, máy khách dường như không giải mã được nó trước khi nó cố gắng xác thực nó chống lại Lược đồ (XSD).
Here is the server side configuration
The server's xwss security configuration
The client's Spring configuration
Những gì tôi có thể làm là mã hóa cho người sử dụng thẻ và giải mã nó thành công. Tôi làm điều đó khi gửi dữ liệu từ máy khách đến máy chủ. Máy chủ sau đó giải mã mã thông báo người dùng và xác thực thông tin xác thực người dùng, hoạt động khá tốt.
Sự cố xảy ra nếu tôi thử và mã hóa phần thân của thư sẽ quay lại. Vấn đề xảy ra ở phía khách hàng. Có vẻ như khách hàng đang cố gắng xác thực thông báo trước khi nó giải mã nó, và do đó một lỗi xảy ra khi xác nhận hợp lệ đối với lược đồ.
[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
And here is the SOAP response itself.
Và đây là các tập tin bản đồ marshalling
<?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>
Tôi biết đó là rất nhiều thông tin, nhưng tôi figured tôi sẽ cung cấp tất cả mọi thứ. Thiết lập mã hóa của tôi có đúng không? Nó không thể mã hóa cơ thể của tin nhắn và giải mã nó ở phía khách hàng? Tại thời điểm này tôi đang mở cho hầu như bất kỳ gợi ý.
bạn vẫn chưa đưa ra toàn bộ thông tin;) Cung cấp cho stacktrace đầy đủ (hoặc ít nhất là cắt nó ở một nơi có ý nghĩa, không phải là bắt đầu) – Bozho
Đó là tất cả tôi nhận được một lỗi. Tôi không nhận được toàn bộ dấu vết ngăn xếp. Theo dõi ngăn xếp tôi nhận được là nó đang cố gắng xác thực thông báo chống lại XSD, nó sẽ không hoạt động trên dữ liệu được mã hóa. – Zoidberg
Có vẻ như DecryptionProcessor muốn biết sơ đồ về những gì nó đang giải mã, nhưng không. Trong xml mùa xuân của khách hàng của bạn, tôi không thấy các tham chiếu "lược đồ" đang được sử dụng ở đâu đó ... –