I'm using WebLogic 8.1 clientgen tool to generate needed classes to send soap request.The Web Service (based on spring-ws) that I try to connnect to uses Wss4jSecurityInterceptor for authentication. The config looks like this:
<bean id="wss4jSecurityInterceptor"
class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
<property name="validationActions" value="UsernameToken" />
<property name="validationCallbackHandler" ref="passwordValidationHandler" />
</bean>
<bean id="passwordValidationHandler"
class="org.springframework.ws.soap.security.wss4j.callback.SimplePasswordValidationCallbackHandler">
<property name="users">
<props>
<prop key="${user}">${password}</prop>
</props>
</property>
</bean>
Is it a correct way to add an authentication header?
private BirtService_PortType port;
private init( String serviceUrl,String username,String password) throws IOException{
BirtService_Impl service;
try {
service = new BirtService_Impl( serviceUrl );
port = service.getBirtService_PortType();
//here authentication part
Stub stub = (Stub)port;
stub._setProperty(Stub.USERNAME_PROPERTY, username);
stub._setProperty(Stub.PASSWORD_PROPERTY, password);
} catch (IOException e) {
log.error("Error while creating BirtService_Impl",e);
throw e;
}
sendRequest();
}
[java] 17:35:05,193 ERROR BirtClient:56-Error ocurred
[java] java.rmi.RemoteException: SOAP Fault:javax.xml.rpc.soap.SOAPFaultException: No WS-Security header found
[java] Detail:
[java] null; nested exception is:
[java] javax.xml.rpc.soap.SOAPFaultException: No WS-Security header found
[java] at birt.wsclient.BirtService_PortType_Stub.birt(BirtService_PortType_Stub.java:31)
[java] at birt.ws.client.BirtClient.getReport(BirtClient.java:51)
[java] at birt.ws.client.Main.main(Main.java:31)
[java] Caused by: javax.xml.rpc.soap.SOAPFaultException: No WS-Security header found
[java] at weblogic.webservice.core.ClientDispatcher.receive(ClientDispatcher.java:314)
[java] at weblogic.webservice.core.ClientDispatcher.dispatch(ClientDispatcher.java:144)
[java] at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:471)
[java] at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:457)
[java] at weblogic.webservice.core.rpc.StubImpl._invoke(StubImpl.java:303)
[java] at birt.wsclient.BirtService_PortType_Stub.birt(BirtService_PortType_Stub.java:26)