chemistryprovider.java

来自「手机游戏设计一书的源代码」· Java 代码 · 共 30 行

JAVA
30
字号
package  webservice.web;

import  java.rmi.*;


public class ChemistryProvider {

    //根据元素周期表中的元素编号获取元素的名称
    public String getNameByNumber (int number) {
        String retValue = null;
        try {
            de.bov.spheon.ChemistryBindingStub binding = null;
            try {
                binding = (de.bov.spheon.ChemistryBindingStub)new de.bov.spheon.ChemistryLocator().getChemistryPort();
            } catch (javax.xml.rpc.ServiceException jre) {
                jre.getLinkedCause().printStackTrace();
            }

//设置连接超时为1分钟
binding.setTimeout(60000);
//调用Chemistry Web Service 远程方法
            retValue = binding.getNameByNumber(number);
            return  retValue;
        } catch (RemoteException ex) {
            ex.printStackTrace();
            return  retValue;
        }
    }
}

⌨️ 快捷键说明

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