sessionclient.java

来自「axis入门文档、代码 配置好jdk和tomcat」· Java 代码 · 共 38 行

JAVA
38
字号

package anni.session;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class SessionClient {

    public static void main(String [] args) throws Exception {

        Log log = LogFactory.getLog(SessionClient.class);
        String endpoint = "http://localhost:8080/axis/services/SessionService";
        Service service = new Service();
        service.setMaintainSession(true);

        Call    call    = (Call) service.createCall();
        call.setTargetEndpointAddress(new java.net.URL(endpoint));
        call.setOperationName("echo");
        String res = (String) call.invoke(new Object[]{"lingo"});
        System.out.println(res);

        call    = (Call) service.createCall();
        call.setTargetEndpointAddress(new java.net.URL(endpoint));
        call.setOperationName("echo");
        res = (String) call.invoke(new Object[]{"sophia"});
        System.out.println(res);

        call    = (Call) service.createCall();
        call.setTargetEndpointAddress(new java.net.URL(endpoint));
        call.setOperationName("echo");
        res = (String) call.invoke(new Object[]{"swallow"});
        System.out.println(res);
   }

}

⌨️ 快捷键说明

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