testhelloclient.java

来自「用JAVA 写 的 web service 的axis 应用实现」· Java 代码 · 共 42 行

JAVA
42
字号
package test;
import javax.xml.namespace.QName;

import org.apache.axis.client.Call;

import org.apache.axis.client.Service;

public class TestHelloClient {
	public static void main(String[] args) {

        try {

//        	String URL = "http://localhost:8090/axis/HelloClient.jws";
            String URL = "http://fhs.6617.com/GetWeatherPlus.asmx";

            Service service = new Service();

            Call call = null;

            call = (Call) service.createCall();

            call.setOperationName(new QName(

                    "http://fhs.6617.com/GetWeatherPlus.asmx", "GetSupportCity"));

            call.setTargetEndpointAddress(new java.net.URL(URL));

            String str = (String) call.invoke(new Object[] { "西安" });

            System.out.println(str);

        } catch (Exception ex) {

            ex.printStackTrace();

        }

    }


}

⌨️ 快捷键说明

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