public SOAPEnvelope build(SOAPMessage soapMessage, Reader reader, boolean ignoreParseError) throws IOException, SOAPException { // Parse the XML input stream Element domEnv = null; try { InputSource inputSource = new InputSource( reader ); inputSource.setEncoding(getEncoding(soapMessage)); domEnv = DOMUtils.parse(inputSource); } catch (IOException ex) { if (ignoreParseError) { return null; } QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT; throw new CommonSOAPFaultException(faultCode, ex.getMessage()); } return build(soapMessage, domEnv); }
public SOAPEnvelope build(SOAPMessage soapMessage, Element domEnv) throws SOAPException { // Construct the envelope SOAPPartImpl soapPart = (SOAPPartImpl)soapMessage.getSOAPPart(); SOAPEnvelopeImpl soapEnv = new SOAPEnvelopeImpl(soapPart, (SOAPElementImpl)soapFactory.createElement(domEnv, false), false); DOMUtils.copyAttributes(soapEnv, domEnv); NodeList envChildNodes = domEnv.getChildNodes(); for (int i = 0; i < envChildNodes.getLength(); i++) { Node child = envChildNodes.item(i); short childType = child.getNodeType(); if (childType == Node.ELEMENT_NODE) { String elName = child.getLocalName(); if ("Header".equals(elName)) { buildSOAPHeader(soapEnv, (Element)child); } else if ("Body".equals(elName)) { buildSOAPBody(soapEnv, (Element)child); } else { log.warn(BundleUtils.getMessage(bundle, "IGNORE_ENVELOPE_CHILD", elName)); } } } return soapEnv; }
if (!checkEquals(soapBody.getPrefix(), domBody.getPrefix())) soapBodyElement = buildSOAPBodyElement(soapEnv, (Element)child); attachHRefElements = attachHRefElements || Constants.URI_SOAP11_ENC.equals(soapBody.getAttributeNS(envNS, "encodingStyle")); appendCommentNode(soapBody, child); appendTextNode(soapBody, child);
buildBodyElementDoc(soapBody, domBodyElement); soapBodyElement = buildBodyElementRpc(soapBody, domBodyElement); buildBodyElementDefault(soapBody, domBodyElement);
appendCommentNode(soapBodyElement, child); appendTextNode(soapBodyElement, child);
if (!checkEquals(soapHeader.getPrefix(), domHeader.getPrefix()))
appendCommentNode(soapBodyElement, child); appendTextNode(soapBodyElement, child);
public SOAPEnvelope build(SOAPMessage soapMessage, InputStream ins, boolean ignoreParseError) throws IOException, SOAPException { // Parse the XML input stream Element domEnv = null; try { InputSource inputSource = new InputSource(ins); inputSource.setEncoding(getEncoding(soapMessage)); domEnv = DOMUtils.parse(inputSource); } catch (IOException ex) { if (ignoreParseError) { return null; } log.error(BundleUtils.getMessage(bundle, "EXCEPTION_WHILE_BUILDING_ENVELOPE"), ex); QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT; throw new CommonSOAPFaultException(faultCode, ex.getMessage()); } return build(soapMessage, domEnv); }