Error implementing WS Security in SOAP

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error implementing WS Security in SOAP

Jorge Zapata
Hi,

I am trying to use WS Security (Wss4jSecurityInterceptor) in a SOAP WebService client for signing and encrypting an XML message. I have followed the SOAP SSL sample to achieve this and already have tailored it to my own keystore. The code seems to be ok but when I run the test the following error comes out

Could not access header: HeaderElements must be namespace qualified;
 nested exception is com.sun.xml.messaging.saaj.SOAPExceptionImpl: HeaderElements must be namespace qualified

This is my context file:

<citrus-ws:client id="SoapEndPoint1"
                    request-url="${SoapEndPoint1.url}"
                   
                                                                               
                    timeout="5000"/>


<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate"> 
    <property name="interceptors"> 
          <ref bean="wsClientSecurityInterceptor"/> 
    </property> 
</bean> 
 
<bean id="wsClientSecurityInterceptor"  
    class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor"> 
    <property name="securementActions" value="Timestamp Signature Encrypt" /> 
     
    <property name="securementUsername" value="client" /> 
    <property name="securementPassword" value="" /> 
    <property name="securementSignatureCrypto" ref="clientCrypto"/> 
    <property name="securementEncryptionCrypto" ref="clientCrypto"/> 
   
     
    <property name="securementEncryptionUser" value="server"/> 
     
     
    <property name="validationActions" value="Signature" /> 
    <property name="validationSignatureCrypto" ref="clientCrypto"/> 
    <property name="securementEncryptionParts" value="{Content}{http://myUrl.com/intf/Corporative/DocumentManagement/Transmision/V1.0}namespace"/> 
</bean> 
 
<bean id="clientCrypto" class="org.springframework.ws.soap.security.wss4j.support.CryptoFactoryBean"> 
    <property name="keyStorePassword" value="password"/> 
    <property name="keyStoreLocation" value="classpath:src/test/resources/keys/keystore.jks"/> 
 </bean>   
                                                               
  <citrus-http:client id="SoapEndPoint2"
                    request-url="${SoapEndPoint2.url}"
                                                                               request-factory="sslRequestFactory"
                                                                               
                    timeout="5000"/>

I have validated that my message does actually have header elements well defined but still don't figure out why this is happening.

Thanks in advance, any help is appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: Error implementing WS Security in SOAP

Christoph Deppisch
Administrator
Can you please give the complete stacktrace information of that error? In addition to that logging information and small outline of your test actions might be helpful.

Thx