Problema de seguridad de WS

I'm trying to call a web service that uses Axis2 and SOAP 1.2 (axis 2 only) using Spring-integration and Spring-ws-core. The issue is that it returns an error:

15:15:14,128 TRACE SaajUtils:184 - SOAPElement [com.sun.xml.internal.messaging.saaj.soap.ver1_1.Fault1_1Impl] implements SAAJ 1.3
org.springframework.integration.MessageHandlingException: error occurred in message handler [org.springframework.integration.ws.SimpleWebServiceOutboundGateway#14683c0]
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:79)
    at org.springframework.integration.handler.MessageHandlerChain$1.send(MessageHandlerChain.java:154)
    at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)
    at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendMessage(AbstractReplyProducingMessageHandler.java:175)
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:159)
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.produceReply(AbstractReplyProducingMessageHandler.java:124)
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleResult(AbstractReplyProducingMessageHandler.java:118)
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:100)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
    at org.springframework.integration.handler.MessageHandlerChain.handleMessageInternal(MessageHandlerChain.java:137)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:114)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:101)
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:61)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)
    at com.csc.billingux.WebServiceClient.sendRequesttoService(WebServiceClient.java:40)
    at com.csc.billingux.rest.AccountServiceAdapter.accountService(AccountServiceAdapter.java:47)
    at com.csc.ControllerServlet.doPost(ControllerServlet.java:47)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.ws.soap.client.SoapFaultClientException: WSDoAllReceiver: Incoming message does not contain required Security header
    at org.springframework.ws.soap.client.core.SoapFaultMessageResolver.resolveFault(SoapFaultMessageResolver.java:37)
    at org.springframework.ws.client.core.WebServiceTemplate.handleFault(WebServiceTemplate.java:774)
    at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:600)
    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:537)
    at org.springframework.integration.ws.SimpleWebServiceOutboundGateway.doHandle(SimpleWebServiceOutboundGateway.java:88)
    at org.springframework.integration.ws.AbstractWebServiceOutboundGateway.handleRequestMessage(AbstractWebServiceOutboundGateway.java:176)
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:97)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
    ... 37 more

What my analysis is that it is using SOAP 1.3 instead of 1.2. I have provided even the configuration for specifying the SOAP version 1.2:

<beans:bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">     
    <beans:property name="soapVersion">         
    <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_12"/>  
    </beans:property>
    </beans:bean> 

Do I need to include any specific jar (specific jar for axis 2) so that it uses SOAP 1.2?

preguntado el 31 de julio de 12 a las 10:07

1 Respuestas

You are misinterpreting the stack trace. This is the key line

Incoming message does not contain required Security header

It's nothing to do with SAAJ or SOAP.

Respondido 31 Jul 12, 13:07

Indeed, AFAIK. there is not SOAP 1.3 - jddsantaella

ok so what might be thereason for this error am i missing some jars - NAZAR REHMAN

You need to add a security header. Try googling WS-Security (take a deep breath first) - Artbristol

If you can help in giving some specific link which adds security header in spring configuration - NAZAR REHMAN

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.