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

📄 receivesmsservicestub.java

📁 中国电信sms的开发代码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                                getEnvelopeNamespaces(resultEnv));
                        callback.receiveResultgetReceivedSms((cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.GetReceivedSmsResponse5) object);
                    } catch (org.apache.axis2.AxisFault e) {
                        callback.receiveErrorgetReceivedSms(e);
                    }
                }

                public void onError(java.lang.Exception error) {
                    if (error instanceof org.apache.axis2.AxisFault) {
                        org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error;
                        org.apache.axiom.om.OMElement faultElt = f.getDetail();

                        if (faultElt != null) {
                            if (faultExceptionNameMap.containsKey(
                                        faultElt.getQName())) {
                                //make the fault by reflection
                                try {
                                    java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(faultElt.getQName());
                                    java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
                                    java.lang.Exception ex = (java.lang.Exception) exceptionClass.newInstance();

                                    //message class
                                    java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(faultElt.getQName());
                                    java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
                                    java.lang.Object messageObject = fromOM(faultElt,
                                            messageClass, null);
                                    java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
                                            new java.lang.Class[] { messageClass });
                                    m.invoke(ex,
                                        new java.lang.Object[] { messageObject });

                                    if (ex instanceof cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.PolicyException) {
                                        callback.receiveErrorgetReceivedSms((cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.PolicyException) ex);

                                        return;
                                    }

                                    if (ex instanceof cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ServiceException) {
                                        callback.receiveErrorgetReceivedSms((cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ServiceException) ex);

                                        return;
                                    }

                                    callback.receiveErrorgetReceivedSms(new java.rmi.RemoteException(
                                            ex.getMessage(), ex));
                                } catch (java.lang.ClassCastException e) {
                                    // we cannot intantiate the class - throw the original Axis fault
                                    callback.receiveErrorgetReceivedSms(f);
                                } catch (java.lang.ClassNotFoundException e) {
                                    // we cannot intantiate the class - throw the original Axis fault
                                    callback.receiveErrorgetReceivedSms(f);
                                } catch (java.lang.NoSuchMethodException e) {
                                    // we cannot intantiate the class - throw the original Axis fault
                                    callback.receiveErrorgetReceivedSms(f);
                                } catch (java.lang.reflect.InvocationTargetException e) {
                                    // we cannot intantiate the class - throw the original Axis fault
                                    callback.receiveErrorgetReceivedSms(f);
                                } catch (java.lang.IllegalAccessException e) {
                                    // we cannot intantiate the class - throw the original Axis fault
                                    callback.receiveErrorgetReceivedSms(f);
                                } catch (java.lang.InstantiationException e) {
                                    // we cannot intantiate the class - throw the original Axis fault
                                    callback.receiveErrorgetReceivedSms(f);
                                } catch (org.apache.axis2.AxisFault e) {
                                    // we cannot intantiate the class - throw the original Axis fault
                                    callback.receiveErrorgetReceivedSms(f);
                                }
                            } else {
                                callback.receiveErrorgetReceivedSms(f);
                            }
                        } else {
                            callback.receiveErrorgetReceivedSms(f);
                        }
                    } else {
                        callback.receiveErrorgetReceivedSms(error);
                    }
                }

                public void onFault(
                    org.apache.axis2.context.MessageContext faultContext) {
                    org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext);
                    onError(fault);
                }

                public void onComplete() {
                    // Do nothing by default
                }
            });

        org.apache.axis2.util.CallbackReceiver _callbackReceiver = null;

        if ((_operations[0].getMessageReceiver() == null) &&
                _operationClient.getOptions().isUseSeparateListener()) {
            _callbackReceiver = new org.apache.axis2.util.CallbackReceiver();
            _operations[0].setMessageReceiver(_callbackReceiver);
        }

        //execute the operation client
        _operationClient.execute(false);
    }

    /**
     *  A utility method that copies the namepaces from the SOAPEnvelope
     */
    private java.util.Map getEnvelopeNamespaces(
        org.apache.axiom.soap.SOAPEnvelope env) {
        java.util.Map returnMap = new java.util.HashMap();
        java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();

        while (namespaceIterator.hasNext()) {
            org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();
            returnMap.put(ns.getPrefix(), ns.getNamespaceURI());
        }

        return returnMap;
    }

    private boolean optimizeContent(javax.xml.namespace.QName opName) {
        if (opNameArray == null) {
            return false;
        }

        for (int i = 0; i < opNameArray.length; i++) {
            if (opName.equals(opNameArray[i])) {
                return true;
            }
        }

        return false;
    }

    private org.apache.axiom.om.OMElement toOM(
        cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.GetReceivedSms4 param,
        boolean optimizeContent) throws org.apache.axis2.AxisFault {
        try {
            return param.getOMElement(cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.GetReceivedSms4.MY_QNAME,
                org.apache.axiom.om.OMAbstractFactory.getOMFactory());
        } catch (org.apache.axis2.databinding.ADBException e) {
            throw org.apache.axis2.AxisFault.makeFault(e);
        }
    }

    private org.apache.axiom.om.OMElement toOM(
        cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.GetReceivedSmsResponse5 param,
        boolean optimizeContent) throws org.apache.axis2.AxisFault {
        try {
            return param.getOMElement(cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.GetReceivedSmsResponse5.MY_QNAME,
                org.apache.axiom.om.OMAbstractFactory.getOMFactory());
        } catch (org.apache.axis2.databinding.ADBException e) {
            throw org.apache.axis2.AxisFault.makeFault(e);
        }
    }

    private org.apache.axiom.om.OMElement toOM(
        cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.PolicyException1 param,
        boolean optimizeContent) throws org.apache.axis2.AxisFault {
        try {
            return param.getOMElement(cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.PolicyException1.MY_QNAME,
                org.apache.axiom.om.OMAbstractFactory.getOMFactory());
        } catch (org.apache.axis2.databinding.ADBException e) {
            throw org.apache.axis2.AxisFault.makeFault(e);
        }
    }

    private org.apache.axiom.om.OMElement toOM(
        cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.ServiceException2 param,
        boolean optimizeContent) throws org.apache.axis2.AxisFault {
        try {
            return param.getOMElement(cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.ServiceException2.MY_QNAME,
                org.apache.axiom.om.OMAbstractFactory.getOMFactory());
        } catch (org.apache.axis2.databinding.ADBException e) {
            throw org.apache.axis2.AxisFault.makeFault(e);
        }
    }

    private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
        org.apache.axiom.soap.SOAPFactory factory,
        cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.GetReceivedSms4 param,
        boolean optimizeContent) throws org.apache.axis2.AxisFault {
        try {
            org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
            emptyEnvelope.getBody()
                         .addChild(param.getOMElement(
                    cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.GetReceivedSms4.MY_QNAME,
                    factory));

            return emptyEnvelope;
        } catch (org.apache.axis2.databinding.ADBException e) {
            throw org.apache.axis2.AxisFault.makeFault(e);
        }
    }

    /* methods to provide back word compatibility */

    /**
     *  get the default envelope
     */
    private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
        org.apache.axiom.soap.SOAPFactory factory) {
        return factory.getDefaultEnvelope();
    }

    private java.lang.Object fromOM(org.apache.axiom.om.OMElement param,
        java.lang.Class type, java.util.Map extraNamespaces)
        throws org.apache.axis2.AxisFault {
        try {
            if (cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.GetReceivedSms4.class.equals(
                        type)) {
                return cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.GetReceivedSms4.Factory.parse(param.getXMLStreamReaderWithoutCaching());
            }

            if (cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.GetReceivedSmsResponse5.class.equals(
                        type)) {
                return cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.GetReceivedSmsResponse5.Factory.parse(param.getXMLStreamReaderWithoutCaching());
            }

            if (cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.PolicyException1.class.equals(
                        type)) {
                return cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.PolicyException1.Factory.parse(param.getXMLStreamReaderWithoutCaching());
            }

            if (cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.ServiceException2.class.equals(
                        type)) {
                return cn.com.chinatelecom.www.wsdl.ctcc.sms.receive.v2_1.service.ReceiveSmsServiceStub.ServiceException2.Factory.parse(param.getXMLStreamReaderWithoutCaching());
            }
        } catch (java.lang.Exception e) {
            throw org.apache.axis2.AxisFault.makeFault(e);
        }

        return null;
    }

    //http://localhost:9080/ReceiveSmsService/services/ReceiveSms
    public static class RequestSOAPHeader0 implements org.apache.axis2.databinding.ADBBean {
        public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://www.chinatelecom.com.cn/schema/ctcc/common/v2_1",
                "RequestSOAPHeader", "ns1");

        /**
         * field for RequestSOAPHeader
         */
        protected RequestSOAPHeader localRequestSOAPHeader;

        private static java.lang.String generatePrefix(
            java.lang.String namespace) {
            if (namespace.equals(
                        "http://www.chinatelecom.com.cn/schema/ctcc/common/v2_1")) {
                return "ns1";
            }

            return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
        }

        /**
         * Auto generated getter method
         * @return RequestSOAPHeader
         */
        public RequestSOAPHeader getRequestSOAPHeader() {
            return localRequestSOAPHeader;
        }

        /**
         * Auto generated setter method
         * @param param RequestSOAPHeader
         */
        public void setRequestSOAPHeader(RequestSOAPHeader param) {
            this.localRequestSOAPHeader = param;
        }

        /**
         * isReaderMTOMAware
         * @return true if the reader supports MTOM
         */
        public static boolean isReaderMTOMAware(
            javax.xml.stream.XMLStreamReader reader) {
            boolean isReaderMTOMAware = false;

            try {
                isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(
                            org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE));
            } catch (java.lang.IllegalArgumentException e) {
                isReaderMTOMAware = false;
            }

            return isReaderMTOMAware;
        }

⌨️ 快捷键说明

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