Wrt Matteo's message, I decided to revisit this as well, using the abstract
MessageChangeInterceptor at the stackoverflow link he included.
So, I have my interceptor constructor like this:
public MessageChangeInterceptor() {
super(Phase.PRE_STREAM);
List<String> interceptors = new ArrayList<String>();
interceptors.add(org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor.class.getName());
interceptors.add(SoapPreProtocolOutInterceptor.class.getName());
//addBefore(SoapPreProtocolOutInterceptor.class.getName());
addBefore(interceptors);
}
[...]
It's being setup in the jboss-cxf.xml config file like this:
<bean id="TestInterceptor"
class="com.akimeka.ws.common.interceptors.TestChangeInterceptor" />
<bean id="Sign_Response"
class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
<constructor-arg>
<map>
<entry key="action" value="Timestamp Signature Encrypt"/>
...
<jaxws:inInterceptors>
<bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
<ref bean="Sign_Request"/>
</jaxws:inInterceptors>
But, my problem is that I see the Soap message dumped out to my log, but it is
already encrypted.
So, my question is, how can I set this interceptor up to allow me access to the
Soap envelope before this occurs...
Again, using CXF 2.3.1 with JBoss 6.
Regards,
-- Andy
-----Original Message-----
From: Pampolini Matteo [mailto:[email protected]]
Sent: Tuesday, April 15, 2014 8:25 AM
To: [email protected]
Subject: Please help me with HTTP authentication/XML message modification
Hello there,
I'm developing an ONVIF client module that needs to make appropriate SOAP
requests to some remote devices. Usually these devices accept HTTP text or
digest authentication or both.
Sometimes it happens that their date/time is not synchronized with the one of
the client PC, thus authentication fails. However, ONVIF devices provide a
method to retrieve their current date/time to calculate an offset and then set
the right time inside the SOAP request.
The only way I found to achieve this is through an out interceptor that takes
the XML message and modifies the wsu:Created element accordingly. Googling a
lot I came to this link:
http://stackoverflow.com/questions/6915428/how-to-modify-the-raw-xml-message-of-an-outbound-cxf-request
The problem is that adding this interceptor, I can modify the XML message, but
I see no packet transmitted over the wire. If I just comment out the line:
message.getInterceptorChain().doIntercept(message);
the packet is transmitted, but my XML message to be modified is empty.
Any ideas? I really don't know how to go further...
Many thanks in advance,
Matteo
This email and any attachments are confidential to the intended recipient and
may also be privileged. If you are not the intended recipient please delete it
from your system and notify the sender. You should not copy it or use it for
any purpose nor disclose or distribute its contents to any other person.
Questa e-mail e tutti i suoi allegati sono da intendersi inviati in via
riservata all'effettivo destinatario e possono essere soggetti a restrizioni
legali. Se non siete l'effettivo destinatario o avete ricevuto il messaggio per
errore siete pregati di cancellarlo dal vostro sistema e di avvisare il
mittente. E' vietata la duplicazione, l'uso a qualsiasi titolo, la divulgazione
o la distribuzione dei contenuti di questa e-mail a qualunque altro soggetto.
Prima di stampare questa comunicazione consideratene, per favore, l'impatto
ambientale Please consider the environment before printing this email