0

I'm trying to sign the document request before sending it, but when retrieving request document through Document doc = soapMessage.getSOAPPart().getEnvelope().getOwnerDocument(); and passing it to sign method which will sign it and change the document with signature nodes, response I get is org.springframework.ws.soap.client.SoapFaultClientException: Validation failed with digest wrong.

But, when I debug the code with breakpoints, and I set the breakpoint inside the method doWithMessage (its replaced with lambda expression on the snippet below) in whatever line before certificationService.signDocument(doc, actionName, "Request", company);, I receive correct response, as expecting.

Am I missing something or what, because I can not find any similar issue on the web. I got stuck here...

snippet code below:

return webServiceTemplate.marshalSendAndReceive(
            config.getWebServiceUrl(),
            req,
            message -> {
                try {
                    SaajSoapMessage saajSoapMessage = (SaajSoapMessage) message;
                    SOAPMessage soapMessage = saajSoapMessage.getSaajMessage();
                    Document doc = soapMessage.getSOAPPart().getEnvelope().getOwnerDocument();

                    saajSoapMessage.setSoapAction(SoapClientConfig.ACTION_BASE_URL + actionName);

                    certificationService.signDocument(doc, actionName, "Request", company);
                    soapMessage.saveChanges();

                } catch (Exception e) {
                    e.printStackTrace();
                }
            });
fpeposhi
  • 31
  • 5

1 Answers1

0

Issue solved. I was using java 12, I don't know why that issue accured, but switching to java 8 solve it.

fpeposhi
  • 31
  • 5