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

📄 soapservice.java

📁 Java有关XML编程需要用到axis 的源代码 把里面bin下的包导入相应的Java工程 进行使用
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        return true;    }    public Style getStyle() {        return serviceDescription.getStyle();    }    public void setStyle(Style style) {        serviceDescription.setStyle(style);    }    public Use getUse() {        return serviceDescription.getUse();    }    public void setUse(Use style) {        serviceDescription.setUse(style);    }    public ServiceDesc getServiceDescription() {        return serviceDescription;    }    /**     * Returns a service description with the implementation class filled in.     * Syncronized to prevent simutaneous modification of serviceDescription.     */    public synchronized ServiceDesc getInitializedServiceDesc(                                                     MessageContext msgContext)            throws AxisFault {        if (!serviceDescription.isInitialized()) {            // Let the provider do the work of filling in the service            // descriptor.  This is so that it can decide itself how best            // to map the Operations.  In the future, we may want to support            // providers which don't strictly map to Java class backends            // (BSFProvider, etc.), and as such we hand off here.            if (pivotHandler instanceof BasicProvider) {                ((BasicProvider)pivotHandler).initServiceDesc(this, msgContext);            }        }        return serviceDescription;    }    public void setServiceDescription(ServiceDesc serviceDescription) {        if (serviceDescription == null) {            // FIXME: Throw NPE?            return;        }        this.serviceDescription = serviceDescription;        //serviceDescription.setTypeMapping((TypeMapping)this.getTypeMappingRegistry().getDefaultTypeMapping());    }    public void setPropertyParent(Hashtable parent)    {        if (options == null) {            options = new LockableHashtable();        }        ((LockableHashtable)options).setParent(parent);    }    /**     * Generate WSDL.  If we have a specific file configured in the     * ServiceDesc, just return that.  Otherwise run through all the Handlers     * (including the provider) and call generateWSDL() on them via our     * parent's implementation.     */    public void generateWSDL(MessageContext msgContext) throws AxisFault {        if (serviceDescription == null ||                serviceDescription.getWSDLFile() == null) {            super.generateWSDL(msgContext);            return;        }        InputStream instream = null;        // Got a WSDL file in the service description, so try and read it        try {            String filename= serviceDescription.getWSDLFile();            File file=new File(filename);            if(file.exists()) {                //if this resolves to a file, load it                instream = new FileInputStream(filename);            } else if(msgContext.getStrProp(Constants.MC_HOME_DIR)!=null){                String path = msgContext.getStrProp(Constants.MC_HOME_DIR) +'/' + filename;                file = new File(path);                if(file.exists()) {                    //if this resolves to a file, load it                    instream = new FileInputStream(path);                }            }                        if(instream == null) {                //else load a named resource in our classloader.                 instream = ClassUtils.getResourceAsStream(this.getClass(),filename);                if (instream == null) {                    String errorText=Messages.getMessage("wsdlFileMissing",filename);                    throw new AxisFault(errorText);                }            }            Document doc = XMLUtils.newDocument(instream);            msgContext.setProperty("WSDL", doc);        } catch (Exception e) {            throw AxisFault.makeFault(e);        } finally {            if(instream!=null) {                try {                    instream.close();                } catch (IOException e) { }            }        }    }    /*********************************************************************     * Administration and management APIs     *     * These can get called by various admin adapters, such as JMX MBeans,     * our own Admin client, web applications, etc...     *     *********************************************************************     */    /** Placeholder for "resume this service" method     */    public void start()    {        isRunning = true;    }    /** Placeholder for "suspend this service" method     */    public void stop()    {        isRunning = false;    }    /**     * Is this service suspended?     * @return     */     public boolean isRunning() {        return isRunning;    }        /**     * Make this service available on a particular transport     */    public void enableTransport(String transportName)    {        if (log.isDebugEnabled()) {            log.debug(Messages.getMessage(                "enableTransport00", "" + this, transportName));        }        if (validTransports == null)            validTransports = new Vector();        validTransports.addElement(transportName);    }    /**     * Disable access to this service from a particular transport     */    public void disableTransport(String transportName)    {        if (validTransports != null) {            validTransports.removeElement(transportName);        }    }    public boolean needsHighFidelityRecording() {        return highFidelityRecording;    }    public void setHighFidelityRecording(boolean highFidelityRecording) {        this.highFidelityRecording = highFidelityRecording;    }    // see org.apache.axis.attachments.Attachments    public int getSendType() {        return sendType;    }    public void setSendType(int sendType) {        this.sendType = sendType;    }    public void invoke(MessageContext msgContext) throws AxisFault {        HandlerInfoChainFactory handlerFactory = (HandlerInfoChainFactory) this.getOption(Constants.ATTR_HANDLERINFOCHAIN);        HandlerChainImpl handlerImpl = null;        if (handlerFactory != null) handlerImpl = (HandlerChainImpl) handlerFactory.createHandlerChain();        boolean result = true;        try {            if (handlerImpl != null) {                try {                    result = handlerImpl.handleRequest(msgContext);                }                catch (SOAPFaultException e) {                    msgContext.setPastPivot(true);                    handlerImpl.handleFault(msgContext);                    return;                }            }            if (result) {                try {                    super.invoke(msgContext);                } catch (AxisFault e) {                    msgContext.setPastPivot(true);                    if (handlerImpl != null) {                        handlerImpl.handleFault(msgContext);                    }                    throw e;                }            } else {                msgContext.setPastPivot(true);            }            if ( handlerImpl != null) {                handlerImpl.handleResponse(msgContext);            }        } catch (SOAPFaultException e) {            msgContext.setPastPivot(true);            throw AxisFault.makeFault(e);        } catch (RuntimeException e) {            SOAPFault fault = new SOAPFault(new AxisFault("Server", "Server Error", null, null));            SOAPEnvelope env = new SOAPEnvelope();            env.addBodyElement(fault);            Message message = new Message(env);            message.setMessageType(Message.RESPONSE);            msgContext.setResponseMessage(message);            throw AxisFault.makeFault(e);        }        finally {            if (handlerImpl != null) {                handlerImpl.destroy();            }        }    }}

⌨️ 快捷键说明

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