Source:
<code>public void invokeSOAP(String version, String destination, String soapAction, String soapMessage) throws SOAPException, TransformerException, ParserConfigurationException, FileNotFoundException, UnsupportedEncodingException { MessageFactory messageFactory = null; if (version.equals(SOAP12)) { messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL); } else { messageFactory = MessageFactory.newInstance(); } SOAPMessage message = messageFactory.createMessage(); MimeHeaders mimeHeaders = message.getMimeHeaders(); if (SOAP12.equals(version)) { <START> mimeHeaders.addHeader("Content-Type", "application/soap+_xml; charset=utf-8; action=\"" + soapAction+"\""); <END> } else { mimeHeaders.setHeader("SOAPAction", soapAction); } if (basicAuth) { addBasicAuthHeader(mimeHeaders, username, password); } SOAPPart soapPart = message.getSOAPPart(); String encoding = getEncoding(soapMessage); ByteArrayInputStream stream = new ByteArrayInputStream(soapMessage.getBytes(encoding)); StreamSource preppedMsgSrc = new StreamSource(stream); soapPart.setContent(preppedMsgSrc); message.saveChanges(); SOAPMessage reply = connection.call(message, destination); SOAPPart reSoapPart = reply.getSOAPPart(); if (reSoapPart != null && reSoapPart instanceof SOAPPartImpl) { ((SOAPPartImpl) reSoapPart).setSourceCharsetEncoding(encoding); } SOAPEnvelope reEnvelope = reSoapPart.getEnvelope(); SOAPHeader reHeader = reEnvelope.getHeader(); if (reHeader != null) { setReHeaderMessage(Doc2StringWithoutDeclare(extractContentAsDocument(reHeader))); } SOAPBody reBody = reEnvelope.getBody(); if (reBody.getFault() != null) { hasFault = true; setReFaultMessage(Doc2StringWithoutDeclare(extractContentAsDocument(reBody))); setReBodyMessage(null); } else { hasFault = false; if (reBody.getChildNodes().getLength() < 1) { setReBodyMessage(null); } else if (reBody.getChildNodes().getLength() == 1 && reBody.getChildNodes().item(0) instanceof javax.xml.soap.Text) { setReBodyMessage(null); } else { setReBodyMessage(Doc2StringWithoutDeclare(extractContentAsDocument(reBody))); } setReFaultMessage(null); } }</code><technical_language>I addHeader setHeader. both</technical_language>

Target:
public void invokeSOAP(String version, String destination, String soapAction, String soapMessage) throws SOAPException, TransformerException, ParserConfigurationException, FileNotFoundException, UnsupportedEncodingException { MessageFactory messageFactory = null; if (version.equals(SOAP12)) { messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL); } else { messageFactory = MessageFactory.newInstance(); } SOAPMessage message = messageFactory.createMessage(); MimeHeaders mimeHeaders = message.getMimeHeaders(); setSoapAction(version, soapAction, mimeHeaders); if (basicAuth) { addBasicAuthHeader(mimeHeaders, username, password); } SOAPPart soapPart = message.getSOAPPart(); String encoding = getEncoding(soapMessage); ByteArrayInputStream stream = new ByteArrayInputStream(soapMessage.getBytes(encoding)); StreamSource preppedMsgSrc = new StreamSource(stream); soapPart.setContent(preppedMsgSrc); message.saveChanges(); SOAPMessage reply = connection.call(message, destination); SOAPPart reSoapPart = reply.getSOAPPart(); if (reSoapPart != null && reSoapPart instanceof SOAPPartImpl) { ((SOAPPartImpl) reSoapPart).setSourceCharsetEncoding(encoding); } SOAPEnvelope reEnvelope = reSoapPart.getEnvelope(); SOAPHeader reHeader = reEnvelope.getHeader(); if (reHeader != null) { setReHeaderMessage(Doc2StringWithoutDeclare(extractContentAsDocument(reHeader))); } SOAPBody reBody = reEnvelope.getBody(); if (reBody.getFault() != null) { hasFault = true; setReFaultMessage(Doc2StringWithoutDeclare(extractContentAsDocument(reBody))); setReBodyMessage(null); } else { hasFault = false; if (reBody.getChildNodes().getLength() < 1) { setReBodyMessage(null); } else if (reBody.getChildNodes().getLength() == 1 && reBody.getChildNodes().item(0) instanceof javax.xml.soap.Text) { setReBodyMessage(null); } else { setReBodyMessage(Doc2StringWithoutDeclare(extractContentAsDocument(reBody))); } setReFaultMessage(null); } }