⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 soapenvelope.java

📁 Java有关XML编程需要用到axis 的源代码 把里面bin下的包导入相应的Java工程 进行使用
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        }    }    /**     * Add an element to the trailer     * @param element     */     public void addTrailer(MessageElement element)    {        if (log.isDebugEnabled())            log.debug(Messages.getMessage("removeTrailer00"));        element.setEnvelope(this);        trailers.addElement(element);        _isDirty = true;    }    /**     * Get a header by name (always respecting the currently in-scope     * actors list)     */    public SOAPHeaderElement getHeaderByName(String namespace,                                             String localPart)        throws AxisFault    {        return getHeaderByName(namespace, localPart, false);    }    /**     * Get a header by name, filtering for headers targeted at this     * engine depending on the accessAllHeaders parameter.     */    public SOAPHeaderElement getHeaderByName(String namespace,                                             String localPart,                                             boolean accessAllHeaders)        throws AxisFault    {        if (header != null) {            return header.getHeaderByName(namespace,                                          localPart,                                          accessAllHeaders);        } else {            return null;        }    }    /**     * Get a body element given its name     * @param namespace     * @param localPart     * @return     * @throws AxisFault     */     public SOAPBodyElement getBodyByName(String namespace, String localPart)        throws AxisFault    {        if (body == null) {            return null;        } else {            return body.getBodyByName(namespace, localPart);        }    }    /**     * Get an enumeration of header elements given the namespace and localpart     * @param namespace     * @param localPart     * @return     * @throws AxisFault     */     public Enumeration getHeadersByName(String namespace, String localPart)        throws AxisFault    {        return getHeadersByName(namespace, localPart, false);    }    /**     * Return an Enumeration of headers which match the given namespace     * and localPart.  Depending on the value of the accessAllHeaders     * parameter, we will attempt to filter on the current engine's list     * of actors.     *     * !!! NOTE THAT RIGHT NOW WE ALWAYS ASSUME WE'RE THE "ULTIMATE     * DESTINATION" (i.e. we match on null actor).  IF WE WANT TO FULLY SUPPORT     * INTERMEDIARIES WE'LL NEED TO FIX THIS.     */    public Enumeration getHeadersByName(String namespace, String localPart,                                        boolean accessAllHeaders)        throws AxisFault    {        if (header != null) {            return header.getHeadersByName(namespace,                                           localPart,                                           accessAllHeaders);        } else {            return new Vector().elements();        }    }    /** Should make SOAPSerializationException?     */    public void outputImpl(SerializationContext context)        throws Exception    {        boolean oldPretty = context.getPretty();        context.setPretty(true);        // Register namespace prefixes.        if (namespaces != null) {            for (Iterator i = namespaces.iterator(); i.hasNext(); ) {                Mapping mapping = (Mapping)i.next();                context.registerPrefixForURI(mapping.getPrefix(),                                             mapping.getNamespaceURI());            }        }        Enumeration enumeration;        // Output <SOAP-ENV:Envelope>        context.startElement(new QName(soapConstants.getEnvelopeURI(),                                       Constants.ELEM_ENVELOPE), attributes);                // Output <SOAP-ENV:Envelope>'s each child as it appears.        Iterator i = getChildElements();        while (i.hasNext()) {                        NodeImpl node = (NodeImpl)i.next();                        if (node instanceof SOAPHeader) {                header.outputImpl(context);            } else if (node instanceof SOAPBody) {                body.outputImpl(context);                            } else if (node instanceof MessageElement) {                ((MessageElement)node).output(context);            } else {                node.output(context);            }            }                // Output trailers        enumeration = trailers.elements();        while (enumeration.hasMoreElements()) {            MessageElement element = (MessageElement)enumeration.nextElement();            element.output(context);            // Output this independent element        }        // Output </SOAP-ENV:Envelope>        context.endElement();        context.setPretty(oldPretty);    }    /**     * Get the soap constants for this envelope     * @return     */     public SOAPConstants getSOAPConstants() {        return soapConstants;    }    /**     * Set the soap constants for this envelope     * @param soapConstants     */     public void setSoapConstants(SOAPConstants soapConstants) {        this.soapConstants = soapConstants;    }    /**     * Get the schema version for this envelope     * @return     */     public SchemaVersion getSchemaVersion() {        return schemaVersion;    }     /**     * Set the schema version for this envelope     * @param schemaVersion     */     public void setSchemaVersion(SchemaVersion schemaVersion) {        this.schemaVersion = schemaVersion;    }    /**     * Add a soap body if one does not exist     * @return     * @throws SOAPException     */     public javax.xml.soap.SOAPBody addBody() throws SOAPException {        if (body == null) {            body = new SOAPBody(this, soapConstants);            _isDirty = true;            body.setOwnerDocument(getOwnerDocument());            return body;        } else {            throw new SOAPException(Messages.getMessage("bodyPresent"));        }    }    /**     * Add a soap header if one does not exist     * @return     * @throws SOAPException     */     public javax.xml.soap.SOAPHeader addHeader() throws SOAPException {        if (header == null) {            header = new SOAPHeader(this, soapConstants);            header.setOwnerDocument(getOwnerDocument());            return header;        } else {            throw new SOAPException(Messages.getMessage("headerPresent"));        }    }    /**     * create a Name given the local part     * @param localName     * @return     * @throws SOAPException     */     public javax.xml.soap.Name createName(String localName)        throws SOAPException {        return new PrefixedQName(null, localName,  null);    }    /**     * Create a name given local part, prefix and uri     * @param localName     * @param prefix     * @param uri     * @return     * @throws SOAPException     */     public javax.xml.soap.Name createName(String localName,                                          String prefix,                                          String uri)        throws SOAPException {        return new PrefixedQName(uri, localName, prefix);    }    /**     * Get the soap body     * @return     * @throws SOAPException     */     public javax.xml.soap.SOAPBody getBody() throws SOAPException {        return body;    }    /**     * Get the soap header     * @return     * @throws SOAPException     */     public javax.xml.soap.SOAPHeader getHeader() throws SOAPException {        return header;    }    public void setSAAJEncodingCompliance(boolean comply) {        this.body.setSAAJEncodingCompliance(comply);    }        public Node removeChild(Node oldChild) throws DOMException {        if(oldChild == header) {            header = null;        } else if(oldChild == body) {            body = null;        }        return super.removeChild(oldChild);    }    public Node cloneNode(boolean deep)    {        SOAPEnvelope envelope = (SOAPEnvelope)super.cloneNode( deep );        if( !deep )        {            envelope.body = null;            envelope.header = null;        }        return envelope;    }    protected void childDeepCloned( NodeImpl oldNode, NodeImpl newNode )    {        if( oldNode == body )        {            body = (SOAPBody)newNode;            try {                body.setParentElement(this);            } catch (SOAPException ex) {                // class cast should never fail when parent is a SOAPEnvelope                log.fatal(Messages.getMessage("exception00"), ex);            }        }        else        if( oldNode == header )        {            header = (SOAPHeader)newNode;        }    }        public void setOwnerDocument(org.apache.axis.SOAPPart sp) {        super.setOwnerDocument(sp);        if(body != null) {            body.setOwnerDocument(sp);            setOwnerDocumentForChildren(((NodeImpl)body).children, sp);        }        if(header != null){            header.setOwnerDocument(sp);            setOwnerDocumentForChildren(((NodeImpl)body).children, sp);        }    }        private void setOwnerDocumentForChildren(List children, org.apache.axis.SOAPPart sp) {    	if (children == null) {            return;        }        int size = children.size();        for (int i = 0; i < size; i++) {            NodeImpl node = (NodeImpl) children.get(i);            node.setOwnerDocument(sp);            setOwnerDocumentForChildren(node.children, sp);  // recursively    	}    }    public void setRecorded(boolean recorded) {        this.recorded = recorded;    }    public boolean isRecorded() {        return recorded;    }    public void setDirty(boolean dirty) {        if (recorder != null && !_isDirty && dirty && isRecorded()){            recorder.clear();            recorder = null;        }        setDirty();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -