title: Spring-ws how to add an attribute to soap action in request body
body: <p>I'm using Spring-WS to consume a following wsdl:
  <a href="https://pz.gov.pl/pz-services/SignatureVerification?wsdl" rel="nofollow noreferrer">https://pz.gov.pl/pz-services/SignatureVerification?wsdl</a>
  I've generated java classes to do this just like in this tutorial: <a href="https://spring.io/guides/gs/consuming-web-service/" rel="nofollow noreferrer">https://spring.io/guides/gs/consuming-web-service/</a></p>
  
  <p>Documentation of this wsdl file specifies, that a request has to have an attributes callId, and requestTimestamp set just like in the following example:</p>
  
  <p><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:tpus="http://verification.zp.epuap.gov.pl"&gt;
       &lt;soapenv:Header/&gt;
       &lt;soapenv:Body&gt;
       &lt;tpus:verifySignature callId="6347177294896046332" requestTimestamp="2014-06-30T12:01:30.048+02:00"&gt;
           &lt;tpus:doc&gt;PD94bWwgdmVyc2E+&lt;/tpus:doc&gt;
               &lt;tpus:attachments&gt;
                   &lt;tpus:Attachment&gt;
                      &lt;tpus:content&gt;PD94bWwgdmVyc2+&lt;/tpus:content&gt;
                        &lt;tpus:name&gt;podpis.xml&lt;/tpus:name&gt;
                   &lt;/tpus:Attachment&gt;
               &lt;/tpus:attachments&gt;
       &lt;/tpus:verifySignature&gt;
       &lt;/soapenv:Body&gt;
      &lt;/soapenv:Envelope&gt;</code></p>
  
  <p>My request looks like this:</p>
  
  <pre><code>&lt;SOAP-ENV:Envelope
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &lt;SOAP-ENV:Header/&gt;
  &lt;SOAP-ENV:Body
              xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="id-82BA5532C"&gt;
              &lt;ns3:verifySignature
                  xmlns:ns3="http://verification.zp.epuap.gov.pl"
                  xmlns=""&gt;
                  &lt;doc&gt;PD94bWwgdmVyc2E+&lt;/doc&gt;
                  &lt;attachments&gt;
                      &lt;Attachment&gt;
                          &lt;content&gt;PD94bWwgdmVyc2+&lt;/content&gt;
                          &lt;name&gt;podpis.xml&lt;/name&gt;
                      &lt;/Attachment&gt;
                  &lt;/attachments&gt;
              &lt;/ns3:verifySignature&gt;
          &lt;/SOAP-ENV:Body&gt;
      &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>So as you can see i lack the callId and requestTimestamp attributes. How i can add them if my code to send the request looks like this?</p>
  
  <pre><code>public class TrustedProfileValidator extends WebServiceGatewaySupport {
  private static final Logger tpLogger = Logger.getLogger(TrustedProfileValidator.class);
  
  /**
   * Trusted profile validator constructor
   */
  public TrustedProfileValidator() {
      tpLogger.info("Trusted profile validator service.");
  }
  
  public VerifySignatureResponse validate(byte[] documentInByte64, ArrayOfAttachment arrayOfAttachments) {
      tpLogger.info("Checking trusted profile validation");
      VerifySignature request = new VerifySignature();
      request.setDoc(documentInByte64);
      request.setAttachments(arrayOfAttachments);
  
      return (VerifySignatureResponse) getWebServiceTemplate().marshalSendAndReceive(
              "https://int.pz.gov.pl/pz-services/SignatureVerification", request,
              new SoapActionCallback("verifySignature"));
  }
  </code></pre>
  
  <p>}</p>