title: Java SOAP header tag and namespace only appears into response
body: <p>I have a WebService deployed into a server an one client doing requests aginst it. I have client and server certificates which established SSL connection and, in the server side, build a signature and then the client tries to verify it. 
  The problem is when the server signs the SOAP message it looks like this one:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
  &lt;S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope"&gt;
  &lt;S:Body&gt;
  &lt;ns2:ResponseMessage xmlns="urn:iec62325.504:messages:1:0" xmlns:ns2="http://iec.ch/TC57/2011/schema/message"&gt;
  &lt;ns2:Header&gt;
  &lt;ns2:Verb&gt;reply&lt;/ns2:Verb&gt;
  &lt;ns2:Noun&gt;QueryData&lt;/ns2:Noun&gt;
  &lt;ns2:Timestamp&gt;2016-11-17T15:44:51Z&lt;/ns2:Timestamp&gt;
  &lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;
  &lt;SignedInfo&gt;
  &lt;CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/&gt;
  &lt;SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/&gt;
  &lt;Reference URI=""&gt;
  &lt;Transforms&gt;
  &lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/&gt;
  &lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/&gt;
  &lt;/Transforms&gt;
  &lt;DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/&gt;
  &lt;DigestValue&gt;yLDpd7Nck0LUBDjoKHM/uh/iCad2v5GhFR+7GTWBNh0=&lt;/DigestValue&gt;
  &lt;/Reference&gt;
  &lt;/SignedInfo&gt;
      &lt;SignatureValue&gt;iovrYXAs+UttPJmu+5kZvnQ6P7XqhfrFd6nEgtArCRT/BwsIZlo6QYH5nCK/M67jCVTHcRso0KDa
  o/1YUeZLi6btLu0I9rNKrlXEp7x08ZRrG0sCqaGV//8AK4jnQDJ7TR4At0lfJg/JMniNAxmTCb3M
  Py6iP5t4LVlvRPVEb1G44uCzMTjtcseTEPJ+/k+CIsOqQ5zA4Srk05bMdkkse62bGqMPMoqBpU0K
  5r29Wl0ZXre/tIt5LJ/7el27MtaIqpo+9CgroFJZUIu6p8Em5p5/s4c5VknWCK2VZVGe7vhjHuiN
  vUlbVWV0DiXHC92jQ2Ty4BTMGABALY40h2V7Bg==&lt;/SignatureValue&gt;
  &lt;KeyInfo&gt;
  &lt;X509Data&gt;
  ...
  </code></pre>
  
  <p>When the message is catched by the handle of the client, it looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
  &lt;S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope" xmlns:env="http://www.w3.org/2003/05/soap-envelope"&gt;
  &lt;env:Header/&gt;
  &lt;S:Body&gt;
  &lt;ns2:ResponseMessage xmlns="urn:iec62325.504:messages:1:0" xmlns:ns2="http://iec.ch/TC57/2011/schema/message"&gt;
  &lt;ns2:Header&gt;
  &lt;ns2:Verb&gt;reply&lt;/ns2:Verb&gt;
  &lt;ns2:Noun&gt;QueryData&lt;/ns2:Noun&gt;
  &lt;ns2:Timestamp&gt;2016-11-17T15:44:51Z&lt;/ns2:Timestamp&gt;
  &lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;
  &lt;SignedInfo&gt;
  &lt;CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/&gt;
  ...
  </code></pre>
  
  <p>Something between send and receive is insertting this namespace: </p>
  
  <blockquote>
    <p>xmlns:env="http://www.w3.org/2003/05/soap-envelope"</p>
  </blockquote>
  
  <p>and this empty tag:</p>
  
  <blockquote>
    <p>&lt; env:Header/></p>
  </blockquote>
  
  <p>And for this, the client cannot verify the signature</p>
  
  <p>The WebService is generated by Netbeans wizard throug this wsdl with JAX-WS:</p>
  
  <pre><code>&lt;definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
      xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
      xmlns:cmsg="urn:iec62325.504:messages:1:0" xmlns:wss="urn:iec62325.504:wss:1:0"
      xmlns:msg="http://iec.ch/TC57/2011/schema/message" targetNamespace="urn:iec62325.504:wss:1:0"&gt;
      &lt;types&gt;
          &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
              &lt;xs:import namespace="urn:iec62325.504:messages:1:0"
                  schemaLocation="../xsd/urn-iec62325-504-messages-1-0.xsd"/&gt;
              &lt;xs:import namespace="http://iec.ch/TC57/2011/schema/message"
                  schemaLocation="../xsd/http-iec-ch-TC57-2011-schema-message.xsd"/&gt;
          &lt;/xs:schema&gt;
      &lt;/types&gt;
      &lt;message name="msgRequestMessage"&gt;
          &lt;part name="parameter" element="msg:RequestMessage"/&gt;
      &lt;/message&gt;
      &lt;message name="msgResponseMessage"&gt;
          &lt;part name="parameter" element="msg:ResponseMessage"/&gt;
      &lt;/message&gt;
      &lt;message name="msgFaultMsg"&gt;
          &lt;part name="msgFaultMessage" element="msg:FaultMessage"/&gt;
      &lt;/message&gt;
      &lt;portType name="port_TFEDI_type"&gt;
          &lt;operation name="request"&gt;
              &lt;input message="wss:msgRequestMessage"/&gt;
              &lt;output message="wss:msgResponseMessage"/&gt;
              &lt;fault name="msgFaultMessage" message="wss:msgFaultMsg"/&gt;
          &lt;/operation&gt;
      &lt;/portType&gt;
      &lt;binding name="binding_TFEDI" type="wss:port_TFEDI_type"&gt;
          &lt;soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/&gt;
          &lt;operation name="request"&gt;
              &lt;soap12:operation soapActionRequired="false" style="document"/&gt;
              &lt;input&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/input&gt;
              &lt;output&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/output&gt;
              &lt;fault name="msgFaultMessage"&gt;
                  &lt;soap12:fault name="msgFaultMessage" use="literal"/&gt;
              &lt;/fault&gt;
          &lt;/operation&gt;
      &lt;/binding&gt;
      &lt;service name="ServiceEME"&gt;
          &lt;port name="Service_EME_Port" binding="wss:binding_TFEDI"&gt;
              &lt;soap12:address location="http://example.com/WebService_EME/Service_EME"/&gt;
          &lt;/port&gt;
      &lt;/service&gt;
  &lt;/definitions&gt;
  </code></pre>
  
  <p>The service is working perfectly but i don't know how to avoid this tag.</p>
  
  <p>Thank you</p>