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

📄 call.java

📁 Java有关XML编程需要用到axis 的源代码 把里面bin下的包导入相应的Java工程 进行使用
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                    Messages.getMessage("operationAlreadySet"));        }        if (operation == null)            operation = new OperationDesc();        ParameterDesc param = new ParameterDesc();        param.setQName(new QName(paramName.getNamespaceURI(),Utils.getLastLocalPart(paramName.getLocalPart())));        param.setTypeQName(xmlType);        param.setJavaType(javaType);        if (parameterMode == ParameterMode.IN) {            param.setMode(ParameterDesc.IN);        }        else if (parameterMode == ParameterMode.INOUT) {            param.setMode(ParameterDesc.INOUT);        }        else if (parameterMode == ParameterMode.OUT) {            param.setMode(ParameterDesc.OUT);        }        if (headerMode == ParameterMode.IN) {            param.setInHeader(true);        }        else if (headerMode == ParameterMode.INOUT) {            param.setInHeader(true);            param.setOutHeader(true);        }        else if (headerMode == ParameterMode.OUT) {            param.setOutHeader(true);        }        operation.addParameter(param);        parmAndRetReq = true;    } // addParameterAsHeader    /**     * Return the QName of the type of the parameters with the given name.     *     * @param  paramName  name of the parameter to return     * @return XMLType    XMLType of paramName, or null if not found.     */    public QName getParameterTypeByName(String paramName) {        QName paramQName = new QName("", paramName);        return getParameterTypeByQName(paramQName);    }    /**     * Return the QName of the type of the parameters with the given name.     *     * Note: Not part of JAX-RPC specification.     *     * @param  paramQName  QName of the parameter to return     * @return XMLType    XMLType of paramQName, or null if not found.     */    public QName getParameterTypeByQName(QName paramQName) {        ParameterDesc param = operation.getParamByQName(paramQName);        if (param != null) {            return param.getTypeQName();        }        return( null );    }    /**     * Sets the return type of the operation associated with this Call object.     *     * @param type QName of the return value type.     */    public void setReturnType(QName type) {        if (operationSetManually) {            throw new RuntimeException(                    Messages.getMessage("operationAlreadySet"));        }        if (operation == null)            operation = new OperationDesc();        // In order to allow any Call to be re-used, Axis        // chooses to allow setReturnType to be changed when        // parmAndRetReq==false.  This does not conflict with        // JSR 101 which indicates an exception MAY be thrown.        //if (parmAndRetReq) {        operation.setReturnType(type);        TypeMapping tm = getTypeMapping();        operation.setReturnClass(tm.getClassForQName(type));        parmAndRetReq = true;        //}        //else {        //throw new JAXRPCException(Messages.getMessage("noParmAndRetReq"));        //}    }    /**     * Sets the return type for a specific operation.     *     * @param xmlType - QName of the data type of the return value     * @param javaType - Java class of the return value     * @exception JAXRPCException - if isParameterAndReturnSpecRequired returns     * false, then setReturnType MAY throw JAXRPCException...Axis allows     * modification without throwing the exception.     */    public void setReturnType(QName xmlType, Class javaType) {        setReturnType(xmlType);        // Use specified type as the operation return        operation.setReturnClass(javaType);    }    /**     * Set the return type as a header     */    public void setReturnTypeAsHeader(QName xmlType) {        setReturnType(xmlType);        operation.setReturnHeader(true);    } // setReturnTypeAsHeader    /**     * Set the return type as a header     */    public void setReturnTypeAsHeader(QName xmlType, Class javaType) {        setReturnType(xmlType, javaType);        operation.setReturnHeader(true);    } // setReturnTypeAsHeader    /**     * Returns the QName of the type of the return value of this Call - or null     * if not set.     *     * Note: Not part of JAX-RPC specification.     *     * @return the XMLType specified for this Call (or null).     */    public QName getReturnType() {        if (operation != null)            return operation.getReturnType();        return null;    }    /**     * Set the QName of the return element     *     * NOT part of JAX-RPC     */    public void setReturnQName(QName qname) {        if (operationSetManually) {            throw new RuntimeException(                    Messages.getMessage("operationAlreadySet"));        }        if (operation == null)            operation = new OperationDesc();        operation.setReturnQName(qname);    }    /**     * Sets the desired return Java Class.  This is a convenience method     * which will cause the Call to automatically convert return values     * into a desired class if possible.  For instance, we return object     * arrays by default now for SOAP arrays - you could specify:     *     * setReturnClass(Vector.class)     *     * and you'd get a Vector back from invoke() instead of having to do     * the conversion yourself.     *     * Note: Not part of JAX-RPC specification.  To be JAX-RPC compliant,     *       use setReturnType(QName, Class).     *     * @param cls the desired return class.     */    public void setReturnClass(Class cls) {        if (operationSetManually) {            throw new RuntimeException(                    Messages.getMessage("operationAlreadySet"));        }        if (operation == null)            operation = new OperationDesc();        operation.setReturnClass(cls);        TypeMapping tm = getTypeMapping();        operation.setReturnType(tm.getTypeQName(cls));        parmAndRetReq = true;    }    /**     * Clears the list of parameters.     * @exception JAXRPCException - if isParameterAndReturnSpecRequired returns     *  false, then removeAllParameters MAY throw JAXRPCException...Axis allows     *  modification to the Call object without throwing an exception.     */    public void removeAllParameters() {        //if (parmAndRetReq) {        operation = new OperationDesc();        operationSetManually = false;        parmAndRetReq = true;        //}        //else {        //throw new JAXRPCException(Messages.getMessage("noParmAndRetReq"));        //}    }    /**     * Returns the operation name associated with this Call object.     *     * @return String Name of the operation or null if not set.     */    public QName getOperationName() {        return( operationName );    }    /**     * Sets the operation name associated with this Call object.  This will     * not check the WSDL (if there is WSDL) to make sure that it's a valid     * operation name.     *     * @param opName Name of the operation.     */    public void setOperationName(QName opName) {        operationName = opName ;    }    /**     * This is a convenience method.  If the user doesn't care about the QName     * of the operation, the user can call this method, which converts a String     * operation name to a QName.     */    public void setOperationName(String opName) {        operationName = new QName(opName);    }    /**     * Prefill as much info from the WSDL as it can.     * Right now it's SOAPAction, operation qname, parameter types     * and return type of the Web Service.     *     * This methods considers that port name and target endpoint address have     * already been set. This is useful when you want to use the same Call     * instance for several calls on the same Port     *     * Note: Not part of JAX-RPC specification.     *     * @param  opName          Operation(method) that's going to be invoked     * @throws JAXRPCException     */    public void setOperation(String opName) {        if ( service == null ) {            throw new JAXRPCException( Messages.getMessage("noService04") );        }        // remove all settings concerning an operation        // leave portName and targetEndPoint as they are        this.setOperationName( opName );        this.setEncodingStyle( null );        this.setReturnType( null );        this.removeAllParameters();        javax.wsdl.Service wsdlService = service.getWSDLService();        // Nothing to do is the WSDL is not already set.        if(wsdlService == null) {            return;        }        Port port = wsdlService.getPort( portName.getLocalPart() );        if ( port == null ) {            throw new JAXRPCException( Messages.getMessage("noPort00", "" +                                                           portName) );        }        Binding   binding  = port.getBinding();        PortType  portType = binding.getPortType();        if ( portType == null ) {            throw new JAXRPCException( Messages.getMessage("noPortType00", "" +                                                           portName) );        }        this.setPortTypeName(portType.getQName());                List operations = portType.getOperations();        if ( operations == null ) {            throw new JAXRPCException( Messages.getMessage("noOperation01",                                                           opName) );        }        Operation op = null ;        for ( int i = 0 ; i < operations.size() ; i++, op=null ) {            op = (Operation) operations.get( i );            if ( opName.equals( op.getName() ) ) {                break ;            }        }        if ( op == null ) {            throw new JAXRPCException( Messages.getMessage("noOperation01",                                                           opName) );        }        // Get the SOAPAction        ////////////////////////////////////////////////////////////////////        List list = port.getExtensibilityElements();        String opStyle = null;        BindingOperation bop = binding.getBindingOperation(opName,                                                           null, null);        if ( bop == null ) {            throw new JAXRPCException( Messages.getMessage("noOperation02",                                                            opName ));        }        list = bop.getExtensibilityElements();        for ( int i = 0 ; list != null && i < list.size() ; i++ ) {            Object obj = list.get(i);            if ( obj instanceof SOAPOperation ) {                SOAPOperation sop    = (SOAPOperation) obj ;                opStyle = ((SOAPOperation) obj).getStyle();                String action = sop.getSoapActionURI();                if ( action != null ) {                    setUseSOAPAction(true);                    setSOAPActionURI(action);                }                else {                    setUseSOAPAction(false);                    setSOAPActionURI(null);                }                break ;            }        }        // Get the body's namespace URI and encoding style        ////////////////////////////////////////////////////////////////////        BindingInput bIn = bop.getBindingInput();        if ( bIn != null ) {            list = bIn.getExtensibilityElements();            for ( int i = 0 ; list != null && i < list.size() ; i++ ) {                Object obj = list.get(i);                if( obj instanceof MIMEMultipartRelated){                  MIMEMultipartRelated mpr=(MIMEMultipartRelated) obj;                  Object part= null;                  List l=  mpr.getMIMEParts();                  for(int j=0; l!= null && j< l.size() && part== null; j++){                     MIMEPart mp = (MIMEPart)l.get(j);                     List ll= mp.getExtensibilityElements();                     for(int k=0; ll != null && k < ll.size() && part == null;                           k++){                       part= ll.get(k);                       if ( !(part instanceof SOAPBody)) {                           part = null;                       }                     }                  }                  if(null != part) {                      obj= part;                  }                }                if ( obj instanceof SOAPBody ) {                    SOAPBody sBody  = (SOAPBody) obj ;                    list = sBody.getEncodingStyles();                    if ( list != null && list.size() > 0 ) {                        this.setEncodingStyle( (String) list.get(0) );                    }                    String ns = sBody.getNamespaceURI();                    if (ns != null && !ns.equals("")) {

⌨️ 快捷键说明

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